17798202 Several providers return errors due to Ruby 1.9 changes.
--- a/components/puppet/files/solaris/lib/puppet/provider/boot_environment/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/boot_environment/solaris.rb Thu Jan 23 09:56:38 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(:boot_environment).provide(:boot_environment) do
@@ -104,7 +104,7 @@
if zp = @resource[:zpool]
found = false
- for line in zpool(:list, "-o", "name", "-H") do
+ for line in zpool(:list, "-o", "name", "-H").each_line do
if zp == line.strip
found = true
flags << "-p" << zp
--- a/components/puppet/files/solaris/lib/puppet/provider/dns/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/dns/solaris.rb Thu Jan 23 09:56:38 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(:dns).provide(:dns) do
@@ -29,12 +29,11 @@
defaultfor :osfamily => :solaris, :kernelrelease => ['5.11', '5.12']
commands :svccfg => '/usr/sbin/svccfg', :svcprop => '/usr/bin/svcprop'
- class << self; attr_accessor :dns_fmri end
- @@dns_fmri = "svc:/network/dns/client"
+ Dns_fmri = "svc:/network/dns/client"
def self.instances
props = {}
- svcprop("-p", "config", @@dns_fmri).split("\n").each do |line|
+ svcprop("-p", "config", Dns_fmri).split("\n").each do |line|
fullprop, type, value = line.split(" ", 2)
pg, prop = fullprop.split("/")
props[prop] = value \
@@ -48,7 +47,7 @@
Puppet::Type.type(:dns).validproperties.each do |field|
define_method(field) do
begin
- svcprop("-p", "config/" + field.to_s, @@dns_fmri).strip()
+ svcprop("-p", "config/" + field.to_s, Dns_fmri).strip()
rescue
# if the property isn't set, don't raise an error
nil
@@ -63,10 +62,10 @@
should[0] = "(" + should[0]
should[-1] = should[-1] + ")"
- svccfg("-s", @@dns_fmri, "setprop",
+ svccfg("-s", Dns_fmri, "setprop",
"config/" + field.to_s, "=", should)
else
- svccfg("-s", @@dns_fmri, "setprop",
+ svccfg("-s", Dns_fmri, "setprop",
"config/" + field.to_s, "=", '"' + should + '"')
end
rescue => detail
@@ -78,6 +77,6 @@
end
def flush
- svccfg("-s", @@dns_fmri, "refresh")
+ svccfg("-s", Dns_fmri, "refresh")
end
end
--- a/components/puppet/files/solaris/lib/puppet/provider/ipmp_interface/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/ipmp_interface/solaris.rb Thu Jan 23 09:56:38 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(:ipmp_interface).provide(:ipmp_interface) do
@@ -31,8 +31,7 @@
def self.instances
ifaces = []
- ipadm("show-if", "-p", "-o", "IFNAME,CLASS,OVER").split(
- "\n").each do |line|
+ ipadm("show-if", "-p", "-o", "IFNAME,CLASS,OVER").each_line do |line|
name, linkclass, over = line.strip().split(":", 3)
next if linkclass != "ipmp"
ifaces << new(:name => name.strip(),
@@ -100,7 +99,7 @@
end
def destroy
- for iface in self.interfaces do
+ for iface in self.interfaces.each_line do
ipadm("remove-ipmp", "-i", iface, @resource[:name])
end
ipadm('delete-ipmp', @resource[:name])
--- a/components/puppet/files/solaris/lib/puppet/provider/ldap/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/ldap/solaris.rb Thu Jan 23 09:56:38 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(:ldap).provide(:ldap) do
@@ -29,8 +29,7 @@
defaultfor :osfamily => :solaris, :kernelrelease => ['5.11', '5.12']
commands :svccfg => '/usr/sbin/svccfg', :svcprop => '/usr/bin/svcprop'
- class << self; attr_accessor :ldap_fmri end
- @@ldap_fmri = "svc:/network/ldap/client"
+ Ldap_fmri = "svc:/network/ldap/client"
def initialize(resource)
super
@@ -44,7 +43,7 @@
props = {}
validprops = Puppet::Type.type(:ldap).validproperties
- svcprop("-p", "config", @@ldap_fmri).split("\n").collect do |line|
+ svcprop("-p", "config", Ldap_fmri).split("\n").collect do |line|
data = line.split()
fullprop = data[0]
type = data[1]
@@ -68,7 +67,7 @@
pg = Puppet::Type.type(:ldap).propertybyname(field).pg
define_method(field) do
begin
- svcprop("-p", pg + "/" + field.to_s, @@ldap_fmri).strip()
+ svcprop("-p", pg + "/" + field.to_s, Ldap_fmri).strip()
rescue
# if the property isn't set, don't raise an error
nil
@@ -85,10 +84,10 @@
should[0] = "(" + should[0]
should[-1] = should[-1] + ")"
- svccfg("-s", @@ldap_fmri, "setprop",
+ svccfg("-s", Ldap_fmri, "setprop",
pg + "/" + field.to_s, "=", should)
else
- svccfg("-s", @@ldap_fmri, "setprop",
+ svccfg("-s", Ldap_fmri, "setprop",
pg + "/" + field.to_s, "=", should.to_s)
end
@refresh_needed = true
@@ -102,7 +101,7 @@
def flush
if @refresh_needed == true
- svccfg("-s", @@ldap_fmri, "refresh")
+ svccfg("-s", Ldap_fmri, "refresh")
end
end
end
--- a/components/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/nis/solaris.rb Thu Jan 23 09:56:38 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(:nis).provide(:nis) do
@@ -30,8 +30,8 @@
commands :svccfg => '/usr/sbin/svccfg', :svcprop => '/usr/bin/svcprop'
class << self; attr_accessor :client_fmri, :domain_fmri end
- @@client_fmri = "svc:/network/nis/client"
- @@domain_fmri = "svc:/network/nis/domain"
+ Client_fmri = "svc:/network/nis/client"
+ Domain_fmri = "svc:/network/nis/domain"
def initialize(value={})
super(value)
@@ -43,7 +43,7 @@
props = {}
validprops = Puppet::Type.type(:nis).validproperties
- [@@client_fmri, @@domain_fmri].each do |svc|
+ [Client_fmri, Domain_fmri].each do |svc|
svcprop("-p", "config", svc).split("\n").collect do |line|
data = line.split()
fullprop = data[0]
@@ -66,7 +66,7 @@
[:use_broadcast, :use_ypsetme].each do |field|
define_method(field) do
begin
- svcprop("-p", "config/" + field.to_s, @@client_fmri).strip()
+ svcprop("-p", "config/" + field.to_s, Client_fmri).strip()
rescue
# if the property isn't set, don't raise an error
nil
@@ -75,7 +75,7 @@
define_method(field.to_s + "=") do |should|
begin
- svccfg("-s", @@client_fmri, "setprop", "config/" + field.to_s,
+ svccfg("-s", Client_fmri, "setprop", "config/" + field.to_s,
"=", '"' + should.to_s + '"')
rescue => detail
raise Puppet::Error,
@@ -90,7 +90,7 @@
[:domainname, :ypservers, :securenets].each do |field|
define_method(field) do
begin
- svcprop("-p", "config/" + field.to_s, @@domain_fmri).strip()
+ svcprop("-p", "config/" + field.to_s, Domain_fmri).strip()
rescue
# if the property isn't set, don't raise an error
nil
@@ -105,10 +105,10 @@
should[0] = "(" + should[0]
should[-1] = should[-1] + ")"
- svccfg("-s", @@domain_fmri, "setprop",
+ svccfg("-s", Domain_fmri, "setprop",
"config/" + field.to_s, "=", should)
else
- svccfg("-s", @@domain_fmri, "setprop",
+ svccfg("-s", Domain_fmri, "setprop",
"config/" + field.to_s, "=", '"' + should + '"')
end
rescue => detail
@@ -122,10 +122,10 @@
def flush
if @domain_refresh == true
- svccfg("-s", @@domain_fmri, "refresh")
+ svccfg("-s", Domain_fmri, "refresh")
end
if @client_refresh == true
- svccfg("-s", @@client_fmri, "refresh")
+ svccfg("-s", Client_fmri, "refresh")
end
end
end
--- a/components/puppet/files/solaris/lib/puppet/provider/pkg_publisher/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/pkg_publisher/solaris.rb Thu Jan 23 09:56:38 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(:pkg_publisher).provide(:pkg_publisher) do
@@ -46,7 +46,7 @@
origin = origin[0..-2]
end
- if publishers.has_key?(name):
+ if publishers.has_key?(name)
# if we've seen this publisher before, simply update the origin
# array
publishers[name]["origin"] << origin
@@ -57,7 +57,7 @@
publishers[name]["proxy"] = proxy if proxy != "-"
index = publisher_order.index(name)
- if index == 0:
+ if index == 0
publishers[name]["searchfirst"] = true
publishers[name]["searchafter"] = nil
else
--- a/components/puppet/files/solaris/lib/puppet/provider/vni_interface/solaris.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/provider/vni_interface/solaris.rb Thu Jan 23 09:56:38 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(:vni_interface).provide(:vni_interface) do
@@ -51,7 +51,7 @@
def exists?
p = exec_cmd(command(:ipadm), "show-if", "-p", "-o", "IFNAME,CLASS",
@resource[:name])
- if p[:exit] == 1:
+ if p[:exit] == 1
return false
end
--- a/components/puppet/files/solaris/lib/puppet/type/dns.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/type/dns.rb Thu Jan 23 09:56:38 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.
#
require 'ipaddr'
@@ -44,13 +44,9 @@
3 IP addresses may be specified. Specify multiple IP addresses
as an array"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -82,13 +78,9 @@
entries may be specified. Specify multiple search entries as an
array."
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -107,13 +99,9 @@
be specified in IP 'slash notation'. A maximum of 10 sortlist
entries may be specified. Specify multiple entries as an array."
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -141,13 +129,9 @@
no-check-names, inet6. For values with 'n', specify 'n' as an
integer. Specify multiple options as an array."
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
--- a/components/puppet/files/solaris/lib/puppet/type/ldap.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/type/ldap.rb Thu Jan 23 09:56:38 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.
#
require 'ipaddr'
@@ -71,13 +71,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -104,13 +100,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -158,13 +150,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -236,13 +224,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -266,13 +250,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -306,13 +286,9 @@
end
self.pg = "config"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
@@ -335,13 +311,9 @@
end
self.pg = "cred"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)
--- a/components/puppet/files/solaris/lib/puppet/type/nis.rb Thu Jan 23 09:00:26 2014 -0700
+++ b/components/puppet/files/solaris/lib/puppet/type/nis.rb Thu Jan 23 09:56:38 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.
#
require 'ipaddr'
@@ -52,13 +52,9 @@
desc "The hosts or IP addresses to use as NIS servers. Specify
multiple entries as an array"
- # ensure should remains an array as long as there's more than 1 entry
+ # ensure should remains an array
def should
- if @should.length == 1
- @should.to_s
- else
- @should
- end
+ @should
end
def insync?(is)