diff options
author | Andrew Shafer <andrew@reductivelabs.com> | 2008-10-01 17:23:14 -0600 |
---|---|---|
committer | Andrew Shafer <andrew@reductivelabs.com> | 2008-10-01 18:35:36 -0600 |
commit | 4a863c38ced0e2581454888b15275aa1eb381e56 (patch) | |
tree | b96b35f2c9660489fc35f4dc24630c6ad13f07fb /lib | |
parent | 93f952a210ff6099c04f8c0157d79e338b901df5 (diff) | |
download | puppet-4a863c38ced0e2581454888b15275aa1eb381e56.tar.gz puppet-4a863c38ced0e2581454888b15275aa1eb381e56.tar.xz puppet-4a863c38ced0e2581454888b15275aa1eb381e56.zip |
Adding user_attr util to parse attributes on solaris
read /etc/user_attr and makes a hash based on the file contents
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/util/user_attr.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/util/user_attr.rb b/lib/puppet/util/user_attr.rb new file mode 100644 index 000000000..db8fb81b9 --- /dev/null +++ b/lib/puppet/util/user_attr.rb @@ -0,0 +1,21 @@ +class UserAttr + def self.get_attributes_by_name(name) + attributes = nil + + File.readlines('/etc/user_attr').each do |line| + next if line =~ /^#/ + + token = line.split(':') + + if token[0] == name + attributes = {:name => name} + token[4].split(';').each do |attr| + key_value = attr.split('=') + attributes[key_value[0].intern] = key_value[1].strip + end + break + end + end + return attributes + end +end |