--- a/components/puppet/files/solaris/lib/puppet/provider/dns/solaris.rb Mon Feb 03 15:07:01 2014 -0800
+++ b/components/puppet/files/solaris/lib/puppet/provider/dns/solaris.rb Mon Feb 03 18:09:10 2014 -0700
@@ -65,8 +65,16 @@
svccfg("-s", Dns_fmri, "setprop",
"config/" + field.to_s, "=", should)
else
+ # Puppet seems to get confused about when to pass an empty
+ # string or "\"\"". Catch either condition to handle
+ # passing values to SMF correctly
+ if should.to_s.empty? or should.to_s == '""'
+ value = should.to_s
+ else
+ value = "\"" + should.to_s + "\""
+ end
svccfg("-s", Dns_fmri, "setprop",
- "config/" + field.to_s, "=", '"' + should + '"')
+ "config/" + field.to_s, "=", value)
end
rescue => detail
raise Puppet::Error,
--- a/components/puppet/files/solaris/lib/puppet/provider/ldap/solaris.rb Mon Feb 03 15:07:01 2014 -0800
+++ b/components/puppet/files/solaris/lib/puppet/provider/ldap/solaris.rb Mon Feb 03 18:09:10 2014 -0700
@@ -87,8 +87,16 @@
svccfg("-s", Ldap_fmri, "setprop",
pg + "/" + field.to_s, "=", should)
else
+ # Puppet seems to get confused about when to pass an empty
+ # string or "\"\"". Catch either condition to handle
+ # passing values to SMF correctly
+ if should.to_s.empty? or should.to_s == '""'
+ value = should.to_s
+ else
+ value = "\"" + should.to_s + "\""
+ end
svccfg("-s", Ldap_fmri, "setprop",
- pg + "/" + field.to_s, "=", should.to_s)
+ pg + "/" + field.to_s, "=", value)
end
@refresh_needed = true
rescue => detail
--- a/components/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb Mon Feb 03 15:07:01 2014 -0800
+++ b/components/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb Mon Feb 03 18:09:10 2014 -0700
@@ -108,8 +108,16 @@
svccfg("-s", Domain_fmri, "setprop",
"config/" + field.to_s, "=", should)
else
+ # Puppet seems to get confused about when to pass an empty
+ # string or "\"\"". Catch either condition to handle
+ # passing values to SMF correctly
+ if should.to_s.empty? or should.to_s == '""'
+ value = should.to_s
+ else
+ value = "\"" + should.to_s + "\""
+ end
svccfg("-s", Domain_fmri, "setprop",
- "config/" + field.to_s, "=", '"' + should + '"')
+ "config/" + field.to_s, "=", value)
end
rescue => detail
raise Puppet::Error,
--- a/components/puppet/files/solaris/lib/puppet/provider/nsswitch/solaris.rb Mon Feb 03 15:07:01 2014 -0800
+++ b/components/puppet/files/solaris/lib/puppet/provider/nsswitch/solaris.rb Mon Feb 03 18:09:10 2014 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
#
Puppet::Type.type(:nsswitch).provide(:nsswitch) do
@@ -30,11 +30,11 @@
commands :svccfg => '/usr/sbin/svccfg', :svcprop => '/usr/bin/svcprop'
class << self; attr_accessor :nsswitch_fmri end
- @@nsswitch_fmri = "svc:/system/name-service/switch"
+ Nsswitch_fmri = "svc:/system/name-service/switch"
def self.instances
props = {}
- svcprop("-p", "config", @@nsswitch_fmri).split("\n").collect do |line|
+ svcprop("-p", "config", Nsswitch_fmri).each_line.collect do |line|
fullprop, type, value = line.split(" ", 2)
pg, prop = fullprop.split("/")
props[prop] = value \
@@ -49,7 +49,7 @@
define_method(field) do
begin
out = svcprop("-p", "config/" + field.to_s,
- @@nsswitch_fmri).strip()
+ Nsswitch_fmri).strip()
out = out.delete("\\")
rescue
# if the property isn't set, don't raise an error
@@ -59,7 +59,7 @@
define_method(field.to_s + "=") do |should|
begin
- svccfg("-s", @@nsswitch_fmri, "setprop",
+ svccfg("-s", Nsswitch_fmri, "setprop",
"config/" + field.to_s, "=", '"' + should + '"')
rescue => detail
raise Puppet::Error,
@@ -70,6 +70,6 @@
end
def flush
- svccfg("-s", @@nsswitch_fmri, "refresh")
+ svccfg("-s", Nsswitch_fmri, "refresh")
end
end
--- a/components/puppet/files/solaris/lib/puppet/type/dns.rb Mon Feb 03 15:07:01 2014 -0800
+++ b/components/puppet/files/solaris/lib/puppet/type/dns.rb Mon Feb 03 18:09:10 2014 -0700
@@ -150,9 +150,6 @@
raise Puppet::Error, "option #{value} is invalid" \
if not simple_opts.include? data[0]
elsif data.length == 2
- # XXX
- raise Puppet::Error, "svccfg is bugged with prop:N options"
-
raise Puppet::Error, "option #{value} is invalid" \
if not arg_opts.include? data[0]