summaryrefslogtreecommitdiffstats
path: root/lib/puppet/provider/nameservice
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-19 22:42:39 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-19 22:42:39 +0000
commit36e8d65bbdf236203741d3a3b0d98a1eb51a75a9 (patch)
treef636bea92fe2fcc101b6541f1f84524c742a00ba /lib/puppet/provider/nameservice
parent115ec095357171381e2af3aa5ebbd61164b40064 (diff)
downloadpuppet-36e8d65bbdf236203741d3a3b0d98a1eb51a75a9.tar.gz
puppet-36e8d65bbdf236203741d3a3b0d98a1eb51a75a9.tar.xz
puppet-36e8d65bbdf236203741d3a3b0d98a1eb51a75a9.zip
Fixing #372 and #374. All is not perfect, since OS X still cannot set UID, but it is much better. There is still plenty of bug-fixing to do on other platforms, I expect.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1954 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/nameservice')
-rw-r--r--lib/puppet/provider/nameservice/netinfo.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/puppet/provider/nameservice/netinfo.rb b/lib/puppet/provider/nameservice/netinfo.rb
index 313b41753..54f2e8c00 100644
--- a/lib/puppet/provider/nameservice/netinfo.rb
+++ b/lib/puppet/provider/nameservice/netinfo.rb
@@ -12,7 +12,7 @@ class NetInfo < Puppet::Provider::NameService
# Attempt to flush the database, but this doesn't seem to work at all.
def self.flush
begin
- output = execute("/usr/sbin/lookupd -flushcache 2>&1")
+ output = execute(["/usr/sbin/lookupd", "-flushcache"])
rescue Puppet::ExecutionFailure
# Don't throw an error; it's just a failed cache flush
Puppet.err "Could not flush lookupd cache: %s" % output
@@ -89,7 +89,7 @@ class NetInfo < Puppet::Provider::NameService
end
begin
- output = execute(cmd.join(" "))
+ output = execute(cmd)
rescue Puppet::ExecutionFailure => detail
Puppet.err "Failed to call nireport: %s" % detail
return nil
@@ -111,7 +111,7 @@ class NetInfo < Puppet::Provider::NameService
cmd << "/" << "/%s/%s" %
[self.class.netinfodir(), @model[:name]]
- return cmd.join(" ")
+ return cmd
end
def deletecmd
@@ -175,14 +175,16 @@ class NetInfo < Puppet::Provider::NameService
cmd << "-createprop" << "/" << "/%s/%s" %
[self.class.netinfodir, @model[:name]]
+ value = [value] unless value.is_a?(Array)
if key = netinfokey(param)
- cmd << key << "'%s'" % value
+ cmd << key
+ cmd += value
else
raise Puppet::DevError,
"Could not find netinfokey for state %s" %
self.class.name
end
- cmd.join(" ")
+ cmd
end
# Determine the flag to pass to our command.
@@ -196,11 +198,10 @@ class NetInfo < Puppet::Provider::NameService
end
def setuserlist(group, list)
- cmd = "#{command(:niutil)} -createprop / /groups/%s users %s" %
- [group, list.join(",")]
+ cmd = [command(:niutil), "-createprop", "/", "/groups/%s" % group, "users", list.join(",")]
begin
output = execute(cmd)
- rescue Puppet::Execution::Failure => detail
+ rescue Puppet::ExecutionFailure => detail
raise Puppet::Error, "Failed to set user list on %s: %s" %
[group, detail]
end