class UserAttr

Public Class Methods

get_attributes_by_name(name) click to toggle source
   # File lib/puppet/util/user_attr.rb
 2 def self.get_attributes_by_name(name)
 3   attributes = nil
 4 
 5   File.readlines('/etc/user_attr').each do |line|
 6     next if line =~ /^#/
 7 
 8     token = line.split(':')
 9 
10     if token[0] == name
11       attributes = {:name => name}
12       token[4].split(';').each do |attr|
13         key_value = attr.split('=')
14         attributes[key_value[0].intern] = key_value[1].strip
15       end
16       break
17     end
18   end
19   attributes
20 end