Skip to content

Commit

Permalink
Sync-Accounts can now accept a config file
Browse files Browse the repository at this point in the history
  • Loading branch information
malomalo committed Feb 14, 2014
1 parent 7f7f50e commit ff2673d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion sync-accounts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,21 @@ def write_authorized_keys(user, homedir, keys)
FileUtils.chmod(0600, filename)
end

def permission_url(config_file_or_url)
config_file_or_url ||= '/etc/sync-accounts.conf'

if File.exists?(config_file_or_url)
YAML.load(File.read(config_file_or_url))['url']
elsif config_file_or_url =~ URI::regexp
config_file_or_url
else
puts "Invalid permissions url or config file #{config_file_or_url}"
exit(false)
end
end

permissions = read_permissions(ARGV[0])

permissions = read_permissions(permission_url(ARGV[0]))

# Create missing users
system_usernames = system_users.map{|su| su[:name]}
Expand Down

0 comments on commit ff2673d

Please sign in to comment.