class UserAttr

Public Class Methods

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