summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-19 05:35:53 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-19 05:35:53 +0000
commit8cbe19f2aa68bd9c331bd8423fed149120754f70 (patch)
tree0cf0b67fb19bd432f385f82f70b922b92448df69
parent613781258282a3928ca9dfead457d73303636241 (diff)
downloadpuppet-8cbe19f2aa68bd9c331bd8423fed149120754f70.tar.gz
puppet-8cbe19f2aa68bd9c331bd8423fed149120754f70.tar.xz
puppet-8cbe19f2aa68bd9c331bd8423fed149120754f70.zip
Fixing the same bug in the netinfo provider -- it was retrieving the "is" value instead of the "should" value
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1625 980ebf18-57e1-0310-9a29-db15c13687c0
-rw-r--r--lib/puppet/provider/nameservice/netinfo.rb20
-rwxr-xr-xtest/providers/group.rb2
-rw-r--r--test/providers/user.rb2
3 files changed, 11 insertions, 13 deletions
diff --git a/lib/puppet/provider/nameservice/netinfo.rb b/lib/puppet/provider/nameservice/netinfo.rb
index d7d6123e6..5d6c19969 100644
--- a/lib/puppet/provider/nameservice/netinfo.rb
+++ b/lib/puppet/provider/nameservice/netinfo.rb
@@ -62,7 +62,7 @@ class NetInfo < Puppet::Provider::NameService
# We need to generate the id if it's missing.
@model.class.validstates.each do |name|
next if name == :ensure
- unless val = @model[name]
+ unless val = @model.should(name)
if (@model.class.name == :user and name == :uid) or
(@model.class.name == :group and name == :gid)
val = autogen()
@@ -77,14 +77,6 @@ class NetInfo < Puppet::Provider::NameService
end
end
- #def exists?
- # if self.report(:name)
- # return true
- # else
- # return false
- # end
- #end
-
# Retrieve a specific value by name.
def get(param)
hash = getinfo(false)
@@ -149,9 +141,15 @@ class NetInfo < Puppet::Provider::NameService
self.class.name
end
end
- self.debug "Executing %s" % cmd.join(" ").inspect
- %x{#{cmd.join(" ")} 2>&1}.split("\n").each { |line|
+ begin
+ output = execute(cmd.join(" "))
+ rescue Puppet::ExecutionFailure => detail
+ Puppet.err "Failed to call nireport: %s" % detail
+ return nil
+ end
+
+ output.split("\n").each { |line|
values = line.split(/\t/)
hash = {}
diff --git a/test/providers/group.rb b/test/providers/group.rb
index 364d1750d..a23dbb50c 100755
--- a/test/providers/group.rb
+++ b/test/providers/group.rb
@@ -65,7 +65,7 @@ class TestGroupProvider < Test::Unit::TestCase
%x{nireport / /groups name gid}.split("\n").each { |line|
group, id = line.chomp.split(/\s+/)
assert(id =~ /^-?\d+$/, "Group id %s for %s is not a number" %
- [id, group])
+ [id.inspect, group])
if group == name
return Integer(id)
end
diff --git a/test/providers/user.rb b/test/providers/user.rb
index e400ff3ad..0778a257f 100644
--- a/test/providers/user.rb
+++ b/test/providers/user.rb
@@ -129,7 +129,7 @@ class TestUserProvider < Test::Unit::TestCase
when :name: name
when :ensure: :present
when :comment: "Puppet Testing User %s" % name
- when :gid: Process.gid()
+ when :gid: nonrootgroup.name
when :shell: findshell()
when :home: "/home/%s" % name
else