components/puppet/patches/puppet-02-zone-type.patch
branchs11-update
changeset 3458 4912663e9858
parent 3455 6bba35ecb6b8
child 3459 e1b247c39c22
--- a/components/puppet/patches/puppet-02-zone-type.patch	Mon Nov 03 23:01:35 2014 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,281 +0,0 @@
-Enhance the zone type to configure zones using a zonecfg export file format.
-Enhance the output of the puppet resource zone.
-
---- puppet-3.4.1/lib/puppet/type/zone.rb.orig	2013-07-16 16:44:01.005467245 -0600
-+++ puppet-3.4.1/lib/puppet/type/zone.rb	2013-07-16 16:45:04.216692249 -0600
-@@ -1,10 +1,5 @@
--require 'puppet/property/list'
- Puppet::Type.newtype(:zone) do
--  @doc = "Manages Solaris zones.
--
--**Autorequires:** If Puppet is managing the directory specified as the root of
--the zone's filesystem (with the `path` attribute), the zone resource will
--autorequire that directory."
-+  @doc = "Manages Solaris zones."
- 
-   class StateMachine
-     # A silly little state machine.
-@@ -73,7 +68,7 @@
- 
-     # This is seq value because the order of declaration is important.
-     # i.e we go linearly from :absent -> :configured -> :installed -> :running
--    seqvalue :absent, :down => :destroy
-+    seqvalue :absent, :down => :unconfigure
-     seqvalue :configured, :up => :configure, :down => :uninstall
-     seqvalue :installed, :up => :install, :down => :stop
-     seqvalue :running, :up => :start
-@@ -102,10 +97,10 @@
-         sleep 1
-       end
-       provider.send(method)
--      provider.flush()
-     end
- 
-     def sync
-+
-       method = nil
-       direction = up? ? :up : :down
- 
-@@ -129,127 +124,34 @@
- 
-   newparam(:name) do
-     desc "The name of the zone."
--
-     isnamevar
-   end
- 
--  newparam(:id) do
--    desc "The numerical ID of the zone.  This number is autogenerated
--      and cannot be changed."
--  end
--
--  newparam(:clone) do
--    desc "Instead of installing the zone, clone it from another zone.
--      If the zone root resides on a zfs file system, a snapshot will be
--      used to create the clone; if it resides on a ufs filesystem, a copy of the
--      zone will be used. The zone from which you clone must not be running."
--  end
--
--  newproperty(:ip, :parent => Puppet::Property::List) do
--    require 'ipaddr'
--
--    desc "The IP address of the zone.  IP addresses must be specified
--      with the interface, separated by a colon, e.g.: bge0:192.168.0.1.
--      For multiple interfaces, specify them in an array."
--
--    # The default action of list should is to lst.join(' '). By specifying
--    # @should, we ensure the should remains an array. If we override should, we
--    # should also override insync?() -- property/list.rb
--    def should
--      @should
--    end
--
--    # overridden so that we match with self.should
--    def insync?(is)
--      return true unless is
--      is = [] if is == :absent
--      is.sort == self.should.sort
--    end
--  end
--
--  newproperty(:iptype) do
--    desc "The IP stack type of the zone."
--    defaultto :shared
--    newvalue :shared
--    newvalue :exclusive
--  end
--
--  newproperty(:autoboot, :boolean => true) do
--    desc "Whether the zone should automatically boot."
--    defaultto true
--    newvalues(:true, :false)
-+  newparam(:config_profile) do
-+    desc "Path to the config_profile to use to configure a solaris zone.
-+          This is set when providing a sysconfig profile instead of running the
-+	  sysconfig SCI tool on first boot of the zone."
-   end
- 
--  newproperty(:path) do
--    desc "The root of the zone's filesystem.  Must be a fully qualified
--      file name.  If you include `%s` in the path, then it will be
--      replaced with the zone's name.  Currently, you cannot use
--      Puppet to move a zone. Consequently this is a readonly property."
--
--    validate do |value|
--      raise ArgumentError, "The zone base must be fully qualified" unless value =~ /^\//
--    end
--
--    munge do |value|
--      if value =~ /%s/
--        value % @resource[:name]
--      else
--        value
--      end
--    end
--  end
--
--  newproperty(:pool) do
--    desc "The resource pool for this zone."
-+  newparam(:zonecfg_export) do
-+    desc "Contains the zone configuration information. This can be passed in
-+    in the form of a file generated by the zonecfg command, in the form
-+    of a template, or a string."
-   end
- 
--  newproperty(:shares) do
--    desc "Number of FSS CPU shares allocated to the zone."
-+  newparam(:archive) do
-+    desc "The archive file containing an archived zone."
-   end
- 
--  newproperty(:dataset, :parent => Puppet::Property::List ) do
--    desc "The list of datasets delegated to the non-global zone from the
--      global zone.  All datasets must be zfs filesystem names which are
--      different from the mountpoint."
--
--    def should
--      @should
--    end
--
--    # overridden so that we match with self.should
--    def insync?(is)
--      return true unless is
--      is = [] if is == :absent
--      is.sort == self.should.sort
--    end
--
--    validate do |value|
--      unless value !~ /^\//
--        raise ArgumentError, "Datasets must be the name of a zfs filesystem"
--      end
--    end
-+  newparam(:archived_zonename) do
-+    desc "The archived zone to configure and install"
-   end
--
--  newproperty(:inherit, :parent => Puppet::Property::List) do
--    desc "The list of directories that the zone inherits from the global
--      zone.  All directories must be fully qualified."
--
--    def should
--      @should
--    end
--
--    # overridden so that we match with self.should
--    def insync?(is)
--      return true unless is
--      is = [] if is == :absent
--      is.sort == self.should.sort
--    end
--
--    validate do |value|
--      unless value =~ /^\//
--        raise ArgumentError, "Inherited filesystems must be fully qualified"
--      end
--    end
-+  
-+  newparam(:clone) do
-+    desc "Instead of installing the zone, clone it from another zone.
-+      If the zone root resides on a zfs file system, a snapshot will be
-+      used to create the clone; if it resides on a ufs filesystem, a copy of the
-+      zone will be used. The zone from which you clone must not be running."
-   end
- 
-   # Specify the sysidcfg file.  This is pretty hackish, because it's
-@@ -286,70 +188,11 @@
-       so Puppet only checks for it at that time.}
-   end
- 
--  newparam(:create_args) do
--    desc "Arguments to the `zonecfg` create command.  This can be used to create branded zones."
--  end
--
-   newparam(:install_args) do
-     desc "Arguments to the `zoneadm` install command.  This can be used to create branded zones."
-   end
- 
--  newparam(:realhostname) do
--    desc "The actual hostname of the zone."
--  end
--
--  # If Puppet is also managing the base dir or its parent dir, list them
--  # both as prerequisites.
--  autorequire(:file) do
--    if @parameters.include? :path
--      [@parameters[:path].value, ::File.dirname(@parameters[:path].value)]
--    else
--      nil
--    end
--  end
--
--  # If Puppet is also managing the zfs filesystem which is the zone dataset
--  # then list it as a prerequisite.  Zpool's get autorequired by the zfs
--  # type.  We just need to autorequire the dataset zfs itself as the zfs type
--  # will autorequire all of the zfs parents and zpool.
--  autorequire(:zfs) do
--    # Check if we have datasets in our zone configuration and autorequire each dataset
--    self[:dataset] if @parameters.include? :dataset
--  end
--
--  def validate_ip(ip, name)
--    IPAddr.new(ip) if ip
--  rescue ArgumentError
--    self.fail "'#{ip}' is an invalid #{name}"
--  end
--
--  def validate_exclusive(interface, address, router)
--    return if !interface.nil? and address.nil?
--    self.fail "only interface may be specified when using exclusive IP stack: #{interface}:#{address}"
--  end
--  def validate_shared(interface, address, router)
--    self.fail "ip must contain interface name and ip address separated by a \":\"" if interface.nil? or address.nil?
--    [address, router].each do |ip|
--      validate_ip(address, "IP address") unless ip.nil?
--    end
--  end
--
--  validate do
--    return unless self[:ip]
--    # self[:ip] reflects the type passed from proeprty:ip.should. If we
--    # override it and pass @should, then we get an array here back.
--    self[:ip].each do |ip|
--      interface, address, router = ip.split(':')
--      if self[:iptype] == :shared
--        validate_shared(interface, address, router)
--      else
--        validate_exclusive(interface, address, router)
--      end
--    end
--  end
--
-   def retrieve
--    provider.flush
-     hash = provider.properties
-     return setstatus(hash) unless hash.nil? or hash[:ensure] == :absent
-     # Return all properties as absent.
-@@ -372,4 +215,25 @@
-     end
-     prophash
-   end
-+
-+  # Private Properties
-+  # The following properties are used in conjunction with the "puppet resource zone"
-+  # output. They are valid properties for configuring a zone.
-+
-+  newproperty(:id) do
-+    desc "The numerical ID of the zone.  This number is autogenerated
-+    and cannot be changed."
-+  end
-+
-+  newproperty(:zonepath) do
-+    desc "The path to zone's file system."
-+  end
-+
-+  newproperty(:iptype) do
-+    desc "Displays exclusive or shared instance of IP."
-+  end
-+
-+  newproperty(:brand) do
-+    desc "The zone's brand type"
-+  end
- end