The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say: file { "/etc/config": owner => $operatingsystem ? { "sunos" => "adm", "redhat" => "bin", default => undef, }, } I have this.. file { "home_dirs": name => $domain ? { "corp.xxx.com" => "/u", "fr.xxx.com" => "/home", }, ensure => directory; } As a result of this, on the remove end in the log files I see: (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created which in my opinion is confusing and hard to read. I want to see: (//Node[corporate_node]/ldap::client/File[/home]/ensure) created How can I refactor the manifest to do this? Basically I want to remove the use of the symbolic ''home_dirs" name. Doug -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang wrote:> The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say: > > file { "/etc/config": > owner => $operatingsystem ? { > "sunos" => "adm", > "redhat" => "bin", > default => undef, > }, > } > > I have this.. > > file { > "home_dirs": > name => $domain ? { > "corp.xxx.com" => "/u", > "fr.xxx.com" => "/home", > }, > ensure => directory; > } > > > As a result of this, on the remove end in the log files I see: > > (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created > > which in my opinion is confusing and hard to read. I want to see: > > (//Node[corporate_node]/ldap::client/File[/home]/ensure) created > > How can I refactor the manifest to do this? Basically I want to remove > the use of the symbolic ''home_dirs" name.> $blah = $domain ? { > "corp.xxx.com" => "/u", > "fr.xxx.com" => "/home", > }, > file { > $blah: > ensure => directory; > } Regards, DavidS -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Douglas Garstang wrote:> The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say: > > file { "/etc/config": > owner => $operatingsystem ? { > "sunos" => "adm", > "redhat" => "bin", > default => undef, > }, > } > > I have this.. > > file { > "home_dirs": > name => $domain ? { > "corp.xxx.com" => "/u", > "fr.xxx.com" => "/home", > }, > ensure => directory; > } > > > As a result of this, on the remove end in the log files I see: > > (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created > > which in my opinion is confusing and hard to read. I want to see: > > (//Node[corporate_node]/ldap::client/File[/home]/ensure) created > > How can I refactor the manifest to do this? Basically I want to remove > the use of the symbolic ''home_dirs" name.> $blah = $domain ? { > "corp.xxx.com" => "/u", > "fr.xxx.com" => "/home", > } > file { > $blah: > ensure => directory; > } Regards, DavidS -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Nov 26, 2009, at 12:03 AM, David Schmitt wrote:> Douglas Garstang wrote: >> The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say: >> >> file { "/etc/config": >> owner => $operatingsystem ? { >> "sunos" => "adm", >> "redhat" => "bin", >> default => undef, >> }, >> } >> >> I have this.. >> >> file { >> "home_dirs": >> name => $domain ? { >> "corp.xxx.com" => "/u", >> "fr.xxx.com" => "/home", >> }, >> ensure => directory; >> } >> >> >> As a result of this, on the remove end in the log files I see: >> >> (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created >> >> which in my opinion is confusing and hard to read. I want to see: >> >> (//Node[corporate_node]/ldap::client/File[/home]/ensure) created >> >> How can I refactor the manifest to do this? Basically I want to remove >> the use of the symbolic ''home_dirs" name. > >> $blah = $domain ? { >> "corp.xxx.com" => "/u", >> "fr.xxx.com" => "/home", >> } >> file { >> $blah: >> ensure => directory; >> } > > > Regards, DavidS > >$blah = $domain ? { "corp.xxx.com" => "/u", "fr.xxx.com" => "/home", } file { $blah: ensure => directory; } That would work, however, if there was a ZZZ.xxx.com domain, it would fail. I suggest wrapping a case statement around the variable definition which would allow for a "default" value. case $domain { corp.xxxx.com: { $homedir = "/u" } fr.xxx.com: { $homedir = "/home" } default: { $homedir = "/home" } file { $homedir: ensure => directory; } It is a few more lines typed out but it is easy to read. -Jason -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jason Rojas wrote:> On Nov 26, 2009, at 12:03 AM, David Schmitt wrote: > >> Douglas Garstang wrote: >>> The docs at http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial say: >>> >>> file { "/etc/config": >>> owner => $operatingsystem ? { >>> "sunos" => "adm", >>> "redhat" => "bin", >>> default => undef, >>> }, >>> } >>> >>> I have this.. >>> >>> file { >>> "home_dirs": >>> name => $domain ? { >>> "corp.xxx.com" => "/u", >>> "fr.xxx.com" => "/home", >>> }, >>> ensure => directory; >>> } >>> >>> >>> As a result of this, on the remove end in the log files I see: >>> >>> (//Node[corporate_node]/ldap::client/File[home_dirs]/ensure) created >>> >>> which in my opinion is confusing and hard to read. I want to see: >>> >>> (//Node[corporate_node]/ldap::client/File[/home]/ensure) created >>> >>> How can I refactor the manifest to do this? Basically I want to remove >>> the use of the symbolic ''home_dirs" name. >>> $blah = $domain ? { >>> "corp.xxx.com" => "/u", >>> "fr.xxx.com" => "/home", >>> } >>> file { >>> $blah: >>> ensure => directory; >>> } >> >> Regards, DavidS >> >> > > $blah = $domain ? { > "corp.xxx.com" => "/u", > "fr.xxx.com" => "/home", > } > > file { > $blah: > ensure => directory; > } > > That would work, however, if there was a ZZZ.xxx.com domain, it would fail. > I suggest wrapping a case statement around the variable definition which would allow for a "default" value. >the ?{} selector also allows for default=> values. Regards, D -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.