Hi i''m trying to describe some class with a package to install, which should work on different linux-distro''s as well on linux and openbsd: class vim { package { ''vim'': name => $operatingsystem ? { centos => vim-enhanced, default => vim, }, alias => vim, category => $operatingsystem ? { gentoo => ''app-editors'', default => '''', }, ensure => present, source => $operatingsystem ? { openbsd => ''ftp://mirror.switch.ch/pub/OpenBSD/4.2/packages/i386/vim-7.1.33-no_x11.tgz'', default => '''', }, } } until I added the package-source line everything worked as expected. However as I need now some OpenBSD Boxes as well, I have to add the package-source line. (Or am I wrong and I could do it as well without the source line?) But puppet is now complaining about that for BSD I have to specifiy the source. So and with the added package-source line it works with OpenBSD however it isn''t working anymore under linux. For example I get: err: Could not create vim: Parameter source failed: Package sources must be fully qualified files or URLs, depending on the platform. at /var/lib/puppet/modules/vim/manifests/init.pp:24 err: Parameter source failed: Package sources must be fully qualified files or URLs, depending on the platform. at /var/lib/puppet/modules/vim/manifests/init.pp:24 Well one possibility would be to add a different Package defintion extra for OpenBSD. However this would at least double the code, as well I''m lazy and don''t want to that for all packages, as well I think there might be a prettier way. So any suggestions how to solve that problem? Thanks a lot and greets pete
Peter Meier wrote:> Hi > > i''m trying to describe some class with a package to install, which > should work on different linux-distro''s as well on linux and openbsd: > > class vim { > > package { ''vim'': > name => $operatingsystem ? { > centos => vim-enhanced, > default => vim, > }, > alias => vim, > category => $operatingsystem ? { > gentoo => ''app-editors'', > default => '''', > },Try using "undef" (without the quotes) instead of '''' to indicate that a value should be unset, like this: category => $operatingsystem ? { gentoo => ''app-editors'', default => undef, } -- Frank Sweetser fs at wpi.edu | For every problem, there is a solution that WPI Senior Network Engineer | is simple, elegant, and wrong. - HL Mencken GPG fingerprint = 6174 1257 129E 0D21 D8D4 E8A3 8E39 29E3 E2E8 8CEC
On Jan 2, 2008, at 8:13 PM, Frank Sweetser wrote:> Peter Meier wrote: >> Hi >> >> i''m trying to describe some class with a package to install, which >> should work on different linux-distro''s as well on linux and openbsd: >> >> class vim { >> >> package { ''vim'': >> name => $operatingsystem ? { >> centos => vim-enhanced, >> default => vim, >> }, >> alias => vim, >> category => $operatingsystem ? { >> gentoo => ''app-editors'', >> default => '''', >> }, > > Try using "undef" (without the quotes) instead of '''' to indicate > that a value > should be unset, like this: > > category => $operatingsystem ? { > gentoo => ''app-editors'', > default => undef, > }Alternatively, just override on that platform: case $operatingsystem { gentoo: { Package[vim] { category => app-editors } } } -- You can''t have everything. Where would you put it? -- Stephen Wright --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Hi> Try using "undef" (without the quotes) instead of '''' to indicate that a value > should be unset, like this: > > category => $operatingsystem ? { > gentoo => ''app-editors'', > default => undef, > }great this seems to work. :) Where would be the best place to document the undef behaviour? On the Type Reference Site within the Package Section under Source? undef is only mentioned shortly in the Language Tutorial and not in a context that I could assume that it would work for that. Or did I miss some documentation? greets pete
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Peter Meier wrote:> Hi > >> Try using "undef" (without the quotes) instead of '''' to indicate that a value >> should be unset, like this: >> >> category => $operatingsystem ? { >> gentoo => ''app-editors'', >> default => undef, >> } > > great this seems to work. :) > > Where would be the best place to document the undef behaviour? On the > Type Reference Site within the Package Section under Source? > undef is only mentioned shortly in the Language Tutorial and not in a > context that I could assume that it would work for that. Or did I miss > some documentation?I''ve added an example to the selector conditional documentation in the Language Tutorial. Regards James Turnbull - -- James Turnbull (james@lovedthanlost.net) - -- Author of: - - Pulling Strings with Puppet (http://www.amazon.com/gp/product/1590599780/) - - Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) - - Hardening Linux (http://www.amazon.com/gp/product/1590594444/) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHfLMN9hTGvAxC30ARAngyAJ9KJUERXUELeu/Hp/pwNDLsTZTylQCgxcnv de9yN+CYIpOxRwmSLY6IAAI=bpuR -----END PGP SIGNATURE-----