Issue #18798 has been updated by Charlie Sharpsteen.

Category set to Solaris

----------------------------------------
Feature #18798: Add support for all zonecfg(1M) resources and properties to 
Solaris Zone type
https://projects.puppetlabs.com/issues/18798#change-89177

* Author: Alex Box
* Status: Unreviewed
* Priority: Normal
* Assignee: 
* Category: Solaris
* Target version: 
* Affected Puppet version: 
* Keywords: Solaris zones zonecfg
* Branch: 
----------------------------------------
The Zone type only supports a limited set of functionality for Solaris zones. 
See zonecfg(1M) for the list of missing resources.

Setting up loop back file systems (type=lofs in zonecfg(1M)) is particularly 
important for me, so I have resorted to this nasty exec wrapped in a defined 
type:

<pre>
# As of 3.0.1 the zone type does not support managing fs properties (file 
systems, e.g. loop
# backs). This is a workaround. Missing loopback mounts will be created, mounts 
with special=
# or dir= deviating from config will be removed before being recreated 
correctly.
define solaris-config::zonedef_loopback (
        $zonedef_loopback_dir,
        $zonedef_loopback_special,
        $zonedef_loopback_zone = $title
) {
        exec {
                "/usr/bin/echo \"add fs; set type=lofs; set 
dir=${zonedef_loopback_dir}; set special=${zonedef_loopback_special}; end;\" | 
/usr/sbin/zonecfg -z $zonedef_loopback_zone -f -":
                        environment => [
                             
"xml_pattern_special=special=\"$zonedef_loopback_special\"",
                             
"xml_pattern_dir=directory=\"$zonedef_loopback_dir\"",
                             
"xml_pattern_all=special=\"$zonedef_loopback_special\" 
directory=\"$zonedef_loopback_dir\"",
                             
"xml_pattern_special_zonecfg=special=\"$zonedef_loopback_special\"",
                             
"xml_pattern_dir_zonecfg=dir=\"$zonedef_loopback_dir\"",
                             "xml_file=/etc/zones/${zonedef_loopback_zone}.xml",
                             "zonecfg=/usr/sbin/zonecfg -z 
$zonedef_loopback_zone -f -", ],
                        onlyif => "/usr/bin/ksh -c 'set -x; egrep 
\"\$xml_pattern_all\" \$xml_file && exit 1; egrep \$xml_pattern_special 
\$xml_file && /usr/bin/echo remove fs \$xml_pattern_special_zonecfg | 
\$zonecfg; egrep \$xml_pattern_dir \$xml_file && /usr/bin/echo remove fs 
\$xml_pattern_dir_zonecfg | \$zonecfg; exit 0'";
        }
}
</pre>

It takes two Puppet runs for this type to be useful. In the first run two 
things happen: the zone is created using the zone type with ensure => 
'configured'; the zonedef_loopback mount is executed with require => 
Zone['myzone'] to define the loop backs. In the second run, ensure => 
'configured' is changed to ensure => 'installed'.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to