Bug #7175

Zone provider unable to create new zones since 0.24.8

Added by Ben Hughes about 2 years ago. Updated 10 months ago.

Status:ClosedStart date:04/20/2011
Priority:NormalDue date:
Assignee:Rahul Gopinath% Done:

0%

Category:Solaris
Target version:3.0.0
Affected Puppet version:0.25.0 Branch:https://github.com/puppetlabs/puppet/pull/976
Keywords:solaris zones

Description

Overview

The zone{} provider for Solaris zones is unable to provision new zones since Puppet version 0.24.8.

Expected Behavior

On 0.24.8:

[root@solaris:~]# cat zone.pp                                                                                                                       2
zone{
    'testzone':
        ensure           => 'running',
        create_args    => "-b", # not needed, it calls it with -b already
        autoboot        => true,
        path               => '/disky/zones/',
        ip                   => 'e1000g0:192.168.1.240:192.168.1.254',
}
[root@solaris:~]# puppet -dv  --trace zone.pp ; puppet --version                                                                                      
debug: Creating default schedules
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone list -p'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zonecfg -z testzone info'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' allowed-address not specified'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' defrouter not specified'
debug: //Zone[testzone]: Changing ensure
debug: //Zone[testzone]: 1 change(s)
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone list -p'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zonecfg -z testzone info'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' allowed-address not specified'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' defrouter not specified'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone install'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone list -p'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zonecfg -z testzone info'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' allowed-address not specified'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' defrouter not specified'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone boot'
notice: //Zone[testzone]/ensure: ensure changed 'configured' to 'running'
debug: Finishing transaction 69073970 with 1 changes
0.24.8
[root@solaris:~]# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              ipkg     shared
   1 testzone         running    /disky/zones                   ipkg     shared

Actual Behavior

On 2.6.7 (and 0.25.4)

[root@solaris:~]# puppet -dv  --trace zone.pp ; puppet --version
debug: Creating default schedules
debug: Failed to load library 'shadow' for feature 'libshadow'
debug: Failed to load library 'ldap' for feature 'ldap'
debug: Puppet::Type::User::ProviderLdap: feature ldap is missing
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
debug: Puppet::Type::User::ProviderUseradd: file chage does not exist
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows is missing
debug: /File[/etc/puppet/ssl]: Autorequiring File[/etc/puppet]
debug: /File[/etc/puppet/ssl/certs/solaris.home.gateway.pem]: Autorequiring File[/etc/puppet/ssl/certs]
debug: /File[/etc/puppet/ssl/private_keys/solaris.home.gateway.pem]: Autorequiring File[/etc/puppet/ssl/private_keys]
debug: /File[/etc/puppet/ssl/public_keys]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/lib/puppet/run]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/ssl/certificate_requests]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/etc/puppet/ssl/public_keys/solaris.home.gateway.pem]: Autorequiring File[/etc/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/ssl/certs]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/ssl/private]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/lib/puppet/log]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/ssl/crl.pem]: Autorequiring File[/etc/puppet/ssl]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/etc/puppet/ssl/certs/ca.pem]: Autorequiring File[/etc/puppet/ssl/certs]
debug: /File[/etc/puppet/ssl/private_keys]: Autorequiring File[/etc/puppet/ssl]
debug: Finishing transaction 73584620
debug: Loaded state in 0.00 seconds
debug: Loaded state in 0.00 seconds
info: Applying configuration version '1303219224'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zoneadm -z testzone list -p'
debug: Puppet::Type::Zone::ProviderSolaris: Executing '/usr/sbin/zonecfg -z testzone info'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' allowed-address not specified'
debug: Zone[testzone](provider=solaris): Ignoring zone output ' defrouter not specified'
/home/ben/repos//puppet/lib/puppet/type/zone.rb:183:in `<'
/home/ben/repos//puppet/lib/puppet/type/zone.rb:183:in `up?'
/home/ben/repos//puppet/lib/puppet/type/zone.rb:153:in `sync'
/home/ben/repos//puppet/lib/puppet/transaction/resource_harness.rb:114:in `apply_parameter'
/home/ben/repos//puppet/lib/puppet/transaction/resource_harness.rb:56:in `perform_changes'
/home/ben/repos//puppet/lib/puppet/transaction/resource_harness.rb:133:in `evaluate'
/home/ben/repos//puppet/lib/puppet/transaction.rb:48:in `apply'
/home/ben/repos//puppet/lib/puppet/transaction.rb:113:in `eval_children_and_apply_resource'
/home/ben/repos//puppet/lib/puppet/transaction.rb:91:in `eval_resource'
/home/ben/repos//puppet/lib/puppet/transaction.rb:142:in `evaluate'
/home/ben/repos//puppet/lib/puppet/util.rb:429:in `thinmark'
/opt/csw/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/ben/repos//puppet/lib/puppet/util.rb:428:in `thinmark'
/home/ben/repos//puppet/lib/puppet/transaction.rb:141:in `evaluate'
/home/ben/repos//puppet/lib/puppet/transaction.rb:134:in `each'
/home/ben/repos//puppet/lib/puppet/transaction.rb:134:in `evaluate'
/home/ben/repos//puppet/lib/puppet/resource/catalog.rb:144:in `apply'
/home/ben/repos//puppet/lib/puppet/configurer.rb:150:in `run'
/home/ben/repos//puppet/lib/puppet/util.rb:193:in `benchmark'
/opt/csw/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/home/ben/repos//puppet/lib/puppet/util.rb:192:in `benchmark'
/home/ben/repos//puppet/lib/puppet/configurer.rb:149:in `run'
/home/ben/repos//puppet/lib/puppet/application/apply.rb:126:in `main'
/home/ben/repos//puppet/lib/puppet/application/apply.rb:35:in `run_command'
/home/ben/repos//puppet/lib/puppet/application.rb:304:in `run'
/home/ben/repos//puppet/lib/puppet/application.rb:410:in `exit_on_fail'
/home/ben/repos//puppet/lib/puppet/application.rb:304:in `run'
/home/ben/repos//puppet/lib/puppet/util/command_line.rb:59:in `execute'
/home/ben/repos//puppet/bin/puppet:4
err: /Stage[main]//Zone[testzone]/ensure: change from running to running failed: comparison of Fixnum with nil failed
debug: Finishing transaction 73360500
debug: Storing state
debug: Stored state in 0.02 seconds
notice: Finished catalog run in 0.36 seconds
2.6.7

Same function on 0.25.0.

Detail

The comparison in the trace points to lib/puppet/type/zone.rb:

    # Are we moving up the property tree?
    def up?
      current_value = self.retrieve
      self.class.state_index(current_value) < self.class.state_index(self.should)
    end

Tested on:

[ben@solaris:~]% uname -a                        
SunOS solaris 5.11 snv_151a i86pc i386 i86pc

Work Around

None. That’s the minimal zone.pp I could muster really so I can’t see there being much scope for doing it differently.


Related issues

Related to Puppet - Bug #8200: puppet resources balks on zfs and zone under Solaris 10 u... Closed 07/01/2011
Duplicated by Puppet - Bug #3004: zone resource on Solaris tries to change from 'running to... Duplicate 01/05/2010
Blocks Puppet - Bug #6678: zone type fails with internal error when :ip is not speci... Closed 03/10/2011

History

#1 Updated by Ben Hughes about 1 year ago

This is not the case, with a different configuration on 2.7.14:

$sysconfig = inline_template( "# $confdir/modules/site/templates/sysidcfg.erb
system_locale=en_US
timezone=PDT
terminal=xterms
security_policy=NONE
root_password=puppet
timeserver=localhost
name_service=DNS {domain_name=example.org name_server=10.0.1.20}
network_interface=primary {hostname=smelly
  ip_address=10.0.10.11/24
  netmask=255.255.255.0
  protocol_ipv6=no
  default_route=10.0.10.1
nfs4_domain=dynamic" )

  zfs{ "rpool/zones/smelly":
    ensure => present
  }

  zone{ 'smelly':
    autoboot     => true,
    create_args  => "-b",
    ip           => "vlan10:10.0.10.11/24",
    path         => "/zoneds/%s",
    realhostname => 'smelly',
    sysidcfg     => $sysidcfg,
    require      => [Zfs["rpool/zones/smelly"]],
 }

Gives me:

[root@mundilfari:~]# zoneadm list -v
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              solaris  shared
   1 smelly           running    /zoneds/smelly                 solaris  shared

Typos included!

#2 Updated by Rahul Gopinath 11 months ago

  • Status changed from Investigating to Accepted
  • Assignee set to Rahul Gopinath
  • Target version set to 3.x

workaround:

It seems that removing the “ensure => ‘running’” incantation allows the zone creation to proceed, and leaves the zone running.

| puppet --version
2.7.14

| cat zone.pp 
zone { 'myzone':
  create_args => '-b',
  autoboot    => true,
  path        => "/export/zone/myzone",
  ip          => 'e1000g0:192.168.100.101:192.168.100.101',
}

| puppet apply zone.pp
notice: /Stage[main]//Zone[myzone]/ensure: created
notice: Finished catalog run in 27.35 seconds
| zoneadm list -vc
  ID NAME             STATUS     PATH                           BRAND    IP    
   0 global           running    /                              native   shared
   4 z1               running    /export/zone/z1                native   shared
  10 myzone           running    /export/zone/myzone            native   shared

#3 Updated by Rahul Gopinath 11 months ago

  • Status changed from Accepted to In Topic Branch Pending Review
  • Branch set to fixnum

Here is a fix

https://github.com/puppetlabs/puppet/pull/954

The problem was caused by zone provider returning Strings instead of symbols in its ensurable.

#4 Updated by Rahul Gopinath 11 months ago

  • Branch changed from fixnum to https://github.com/puppetlabs/puppet/pull/954

#5 Updated by Josh Cooper 11 months ago

  • Branch changed from https://github.com/puppetlabs/puppet/pull/954 to https://github.com/puppetlabs/puppet/pull/976

#6 Updated by Josh Cooper 10 months ago

  • Status changed from In Topic Branch Pending Review to Merged - Pending Release
  • Target version changed from 3.x to 3.0.0

#7 Updated by Matthaus Owens 10 months ago

  • Status changed from Merged - Pending Release to Closed

Released in Puppet 3.0.0-rc4

Also available in: Atom PDF