components/ruby/puppet/patches/puppet-03-zone-provider.patch
changeset 4505 66ff214a993c
parent 2081 1f1144fb0e4e
child 5728 19424f2daf9f
equal deleted inserted replaced
4503:bf30d46ab06e 4505:66ff214a993c
     1 Enhance the zone provider to configure zones using a zonecfg export file format.
     1 Enhance the zone provider to configure zones using a zonecfg export file format.
     2 Enhance the output of puppet resource zone, and fix zone clone functionality.
     2 Enhance the output of puppet resource zone, and fix zone clone functionality, which omitted '-c'.
     3 
     3 
     4 --- puppet-3.6.2/lib/puppet/provider/zone/solaris.rb.orig	2014-06-18 09:28:43.538680821 -0600
     4 --- puppet-3.6.2/lib/puppet/provider/zone/solaris.rb.~1~	2014-06-09 14:08:19.000000000 -0700
     5 +++ puppet-3.6.2/lib/puppet/provider/zone/solaris.rb	2014-06-16 10:47:24.834849592 -0600
     5 +++ puppet-3.6.2/lib/puppet/provider/zone/solaris.rb	2015-06-11 12:57:24.736534091 -0700
     6 @@ -1,5 +1,5 @@
     6 @@ -1,5 +1,5 @@
     7  Puppet::Type.type(:zone).provide(:solaris) do
     7  Puppet::Type.type(:zone).provide(:solaris) do
     8 -  desc "Provider for Solaris Zones."
     8 -  desc "Provider for Solaris Zones."
     9 +  desc "Provider for Solaris zones."
     9 +  desc "Provider for Solaris zones."
    10  
    10  
   151 +      if !@resource[:zonecfg_export].nil? && @resource[:archive].nil?
   151 +      if !@resource[:zonecfg_export].nil? && @resource[:archive].nil?
   152 +        command = "#{command(:cfg)} -z #{@resource[:name]} \'#{str}\'"
   152 +        command = "#{command(:cfg)} -z #{@resource[:name]} \'#{str}\'"
   153 +      end
   153 +      end
   154      end
   154      end
   155 -  end
   155 -  end
   156  
   156 -
   157 -  def my_properties
   157 -  def my_properties
   158 -    [:path, :iptype, :autoboot, :pool, :shares, :ip, :dataset, :inherit]
   158 -    [:path, :iptype, :autoboot, :pool, :shares, :ip, :dataset, :inherit]
   159 -  end
   159 -  end
   160 -
   160 -
   161 -  # Perform all of our configuration steps.
   161 -  # Perform all of our configuration steps.
   162 -  def configure
   162 -  def configure
   163 -    self.fail "Path is required" unless @resource[:path]
   163 -    self.fail "Path is required" unless @resource[:path]
   164 -    arr = ["create -b #{@resource[:create_args]}"]
   164 -    arr = ["create -b #{@resource[:create_args]}"]
   165 -
   165  
   166 -    # Then perform all of our configuration steps.  It's annoying
   166 -    # Then perform all of our configuration steps.  It's annoying
   167 -    # that we need this much internal info on the resource.
   167 -    # that we need this much internal info on the resource.
   168 -    self.resource.properties.each do |property|
   168 -    self.resource.properties.each do |property|
   169 -      next unless my_properties.include? property.name
   169 -      next unless my_properties.include? property.name
   170 -      method = (property.name.to_s + '_conf').intern
   170 -      method = (property.name.to_s + '_conf').intern
   185 -  end
   185 -  end
   186 -
   186 -
   187    def exists?
   187    def exists?
   188      properties[:ensure] != :absent
   188      properties[:ensure] != :absent
   189    end
   189    end
   190 @@ -138,31 +93,31 @@
   190 @@ -138,31 +93,35 @@
   191    # We cannot use the execpipe in util because the pipe is not opened in
   191    # We cannot use the execpipe in util because the pipe is not opened in
   192    # read/write mode.
   192    # read/write mode.
   193    def exec_cmd(var)
   193    def exec_cmd(var)
   194 -    # In bash, the exit value of the last command is the exit value of the
   194 -    # In bash, the exit value of the last command is the exit value of the
   195 -    # entire pipeline
   195 -    # entire pipeline
   232 +    end
   232 +    end
   233 +       
   233 +       
   234      if @resource[:clone] # TODO: add support for "-s snapshot"
   234      if @resource[:clone] # TODO: add support for "-s snapshot"
   235 -      zoneadm :clone, @resource[:clone]
   235 -      zoneadm :clone, @resource[:clone]
   236 -    elsif @resource[:install_args]
   236 -    elsif @resource[:install_args]
   237 +      zoneadm :clone, @resource[:clone] 
   237 +      if @resource[:config_profile]
       
   238 +        zoneadm :clone, @resource[:install_args].split(" "), @resource[:clone]
       
   239 +      else
       
   240 +        zoneadm :clone, @resource[:clone]
       
   241 +      end
   238 +    elsif @resource[:install_args] 
   242 +    elsif @resource[:install_args] 
   239        zoneadm :install, @resource[:install_args].split(" ")
   243        zoneadm :install, @resource[:install_args].split(" ")
   240      else
   244      else
   241        zoneadm :install
   245        zoneadm :install
   242 @@ -182,11 +137,12 @@
   246 @@ -182,11 +141,12 @@
   243        end
   247        end
   244      end
   248      end
   245      @property_hash.dup
   249      @property_hash.dup
   246 +    
   250 +    
   247    end
   251    end
   251 -  def processing?
   255 -  def processing?
   252 +  def processing?  
   256 +  def processing?  
   253      hash = status
   257      hash = status
   254      return false unless hash
   258      return false unless hash
   255      ["incomplete", "ready", "shutting_down"].include? hash[:ensure]
   259      ["incomplete", "ready", "shutting_down"].include? hash[:ensure]
   256 @@ -214,7 +170,6 @@
   260 @@ -214,7 +174,6 @@
   257    #
   261    #
   258    def getconfig
   262    def getconfig
   259      output = zonecfg :info
   263      output = zonecfg :info
   260 -
   264 -
   261      name = nil
   265      name = nil
   262      current = nil
   266      current = nil
   263      hash = {}
   267      hash = {}
   264 @@ -244,14 +199,9 @@
   268 @@ -244,14 +203,9 @@
   265      hash
   269      hash
   266    end
   270    end
   267  
   271  
   268 -  # Execute a configuration string.  Can't be private because it's called
   272 -  # Execute a configuration string.  Can't be private because it's called
   269 -  # by the properties.
   273 -  # by the properties.
   275      # Check the sysidcfg stuff
   279      # Check the sysidcfg stuff
   276 +   if ['5.10'].include? Facter.value(:kernelrelease)
   280 +   if ['5.10'].include? Facter.value(:kernelrelease)
   277      if cfg = @resource[:sysidcfg]
   281      if cfg = @resource[:sysidcfg]
   278        self.fail "Path is required" unless @resource[:path]
   282        self.fail "Path is required" unless @resource[:path]
   279        zoneetc = File.join(@resource[:path], "root", "etc")
   283        zoneetc = File.join(@resource[:path], "root", "etc")
   280 @@ -272,7 +222,9 @@
   284 @@ -272,7 +226,9 @@
   281          end
   285          end
   282        end
   286        end
   283      end
   287      end
   284 +   end
   288 +   end
   285  
   289  
   286 +    # Boots the zone
   290 +    # Boots the zone
   287      zoneadm :boot
   291      zoneadm :boot
   288    end
   292    end
   289  
   293  
   290 @@ -285,64 +237,35 @@
   294 @@ -285,64 +241,35 @@
   291      end
   295      end
   292  
   296  
   293      main = self.class.line2hash(output.chomp)
   297      main = self.class.line2hash(output.chomp)
   294 -
   298 -
   295 -    # Now add in the configuration information
   299 -    # Now add in the configuration information