diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-15 03:22:50 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-15 03:22:50 +0000 |
| commit | 6bb4814ec66f2cb09381a1bc0fa30f9c85d47443 (patch) | |
| tree | eae4168b4117caee7bc451a69274995a4440b792 /lib | |
| parent | e5aa761d3b45a722d9644776755572447161bba3 (diff) | |
| download | puppet-6bb4814ec66f2cb09381a1bc0fa30f9c85d47443.tar.gz puppet-6bb4814ec66f2cb09381a1bc0fa30f9c85d47443.tar.xz puppet-6bb4814ec66f2cb09381a1bc0fa30f9c85d47443.zip | |
Fixing #267. The problem was that the user provider was retrieving the @is value instead of the @should value, because it was using [] instead of the should method. I fixed the FakeModel to behave a bit more like real types, so that it keeps track of the is/should values, and also to keep track of which attributes are valid, since I immediately ran into another problem stemming from the use of the fakemodel.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1599 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/provider/group/groupadd.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/provider/group/pw.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/provider/nameservice/netinfo.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/provider/user/pw.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/provider/user/useradd.rb | 6 |
5 files changed, 10 insertions, 13 deletions
diff --git a/lib/puppet/provider/group/groupadd.rb b/lib/puppet/provider/group/groupadd.rb index 4c204ddf6..fe6150bd2 100644 --- a/lib/puppet/provider/group/groupadd.rb +++ b/lib/puppet/provider/group/groupadd.rb @@ -12,9 +12,9 @@ Puppet::Type.type(:group).provide :groupadd, :parent => Puppet::Provider::NameSe def addcmd cmd = [command(:add)] - if gid = @model[:gid] + if gid = @model.should(:gid) unless gid == :absent - cmd << flag(:gid) << "'%s'" % @model[:gid] + cmd << flag(:gid) << "'%s'" % gid end end if @model[:allowdupe] == :true diff --git a/lib/puppet/provider/group/pw.rb b/lib/puppet/provider/group/pw.rb index 48934a3c5..4cfcf997a 100644 --- a/lib/puppet/provider/group/pw.rb +++ b/lib/puppet/provider/group/pw.rb @@ -12,9 +12,9 @@ Puppet::Type.type(:group).provide :pw, :parent => Puppet::Provider::NameService: def addcmd cmd = [command(:pw), "groupadd", @model[:name]] - if gid = @model[:gid] + if gid = @model.should(:gid) unless gid == :absent - cmd << flag(:gid) << "'%s'" % @model[:gid] + cmd << flag(:gid) << "'%s'" % gid end end diff --git a/lib/puppet/provider/nameservice/netinfo.rb b/lib/puppet/provider/nameservice/netinfo.rb index be73f7cae..d7d6123e6 100644 --- a/lib/puppet/provider/nameservice/netinfo.rb +++ b/lib/puppet/provider/nameservice/netinfo.rb @@ -59,9 +59,6 @@ class NetInfo < Puppet::Provider::NameService # Because our stupid type can't create the whole thing at once, # we have to do this hackishness. Yay. if arg == :present - if @model.class.name == :user - notice modifycmd(:groups, @model[:groups]).inspect - end # We need to generate the id if it's missing. @model.class.validstates.each do |name| next if name == :ensure diff --git a/lib/puppet/provider/user/pw.rb b/lib/puppet/provider/user/pw.rb index 7342c42fe..393e2d8e0 100644 --- a/lib/puppet/provider/user/pw.rb +++ b/lib/puppet/provider/user/pw.rb @@ -22,11 +22,11 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService:: def addcmd cmd = [command(:pw), "useradd", @model[:name]] @model.class.validstates.each do |state| - next if name == :ensure + next if state == :ensure # the value needs to be quoted, mostly because -c might # have spaces in it - if value = @model[state] and value != "" - cmd << flag(state) << "'%s'" % @model[state] + if value = @model.should(state) and value != "" + cmd << flag(state) << "'%s'" % value end end diff --git a/lib/puppet/provider/user/useradd.rb b/lib/puppet/provider/user/useradd.rb index edd5ec6e3..3b217e013 100644 --- a/lib/puppet/provider/user/useradd.rb +++ b/lib/puppet/provider/user/useradd.rb @@ -20,11 +20,11 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ def addcmd cmd = [command(:add)] @model.class.validstates.each do |state| - next if name == :ensure + next if state == :ensure # the value needs to be quoted, mostly because -c might # have spaces in it - if value = @model[state] and value != "" - cmd << flag(state) << "'%s'" % @model[state] + if value = @model.should(state) and value != "" + cmd << flag(state) << "'%s'" % value end end # stupid fedora |
