From b8f16f86a4012018d630b5a737da1e0ae5fef288 Mon Sep 17 00:00:00 2001 From: Mattias Winther Date: Wed, 25 Sep 2013 14:41:10 +0200 Subject: [PATCH] Added workaround support for Solaris 11 registry --- manifests/init.pp | 4 ++++ solaris.pp | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 solaris.pp diff --git a/manifests/init.pp b/manifests/init.pp index ddf3bbd..2f3d4c0 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -17,6 +17,10 @@ validate_re($vas_nss_module, '^vas(3|4)$', 'Valid values for vas_nss_module are \'vas3\' and \'vas4\'.') + if $::kernel == 'SunOS' { + include nsswitch::solaris + } + file { 'nsswitch_config_file': ensure => file, path => $config_file, diff --git a/solaris.pp b/solaris.pp new file mode 100644 index 0000000..0882136 --- /dev/null +++ b/solaris.pp @@ -0,0 +1,28 @@ +class nsswitch::solaris { + + if $::kernelrelease == 5.11 { + exec { 'pre-nscfg': + path => ['/usr/bin'], + command => '/usr/bin/cp /etc/nsswitch.conf /tmp/smf-workaround', + subscribe => File['/etc/nsswitch.conf'], + refreshonly => true + } + + exec { 'nscfg': + path => ['/usr/sbin'], + onlyif => 'nscfg import -f svc:/system/name-service/switch:default', + command => 'svcadm refresh name-service/switch', + subscribe => Exec['pre-nscfg'], + refreshonly => true, + before => Exec['post-nscfg'] + } + + exec { 'post-nscfg': + path => ['/usr/bin'], + onlyif => '/usr/bin/sleep 2', + command => 'mv /tmp/smf-workaround /etc/nsswitch.conf', + subscribe => Exec['nscfg'], + refreshonly => true + } + } +}