Anyone know of how I can do in puppet the equivalent of this from the land of shell scripting? foo=$(cat /tmp/bar) or if you prefer foo=`cat /tmp/bar` --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brandon Evans
2009-May-01 21:59 UTC
[Puppet Users] Re: Assign variable with content of a file?
no-can-do. What exactly are you trying to get done? -brandon John Florian wrote:> Anyone know of how I can do in puppet the equivalent of this from the > land of shell scripting? > > foo=$(cat /tmp/bar) > > or if you prefer > > foo=`cat /tmp/bar` > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Allan Marcus
2009-May-01 23:04 UTC
[Puppet Users] Re: Assign variable with content of a file?
Can you create a "fact", then use the "fact" in you puppet manifest? --- Thanks, Allan Marcus 505-667-5666 On May 1, 2009, at 3:04 PM, John Florian wrote:> > Anyone know of how I can do in puppet the equivalent of this from the > land of shell scripting? > > foo=$(cat /tmp/bar) > > or if you prefer > > foo=`cat /tmp/bar` > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
James Turnbull
2009-May-01 23:28 UTC
[Puppet Users] Re: Assign variable with content of a file?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Florian wrote:> Anyone know of how I can do in puppet the equivalent of this from the > land of shell scripting? > > foo=$(cat /tmp/bar) > > or if you prefer > > foo=`cat /tmp/bar`On the master you can use the generate function to populate a variable value. http://reductivelabs.com/trac/puppet/wiki/FunctionReference#generate Otherwise you should use a fact. Regards James Turnbull - -- Author of: * Pro Linux Systems Administration (http://www.amazon.com/gp/product/1430219122/) * 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 iD8DBQFJ+4W09hTGvAxC30ARAv05AJ9jQZksz+/bX5NBsGkh18+jom8ukQCdF0cr GAdPLI/EG9JUgndFnbnZI/I=zcAM -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Florian
2009-May-04 12:45 UTC
[Puppet Users] Re: Assign variable with content of a file?
On May 1, 7:28 pm, James Turnbull <ja...@lovedthanlost.net> wrote:> On the master you can use the generate function to populate a variable > value.That looks promising. However, in this particular situation, I cannot use the regular puppetmasterd/puppetd arrangement. I must use the stand-alone puppet instead. Will this still work?> Otherwise you should use a fact.I hadn''t realized that I could create custom facts. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
John Florian
2009-May-04 18:52 UTC
[Puppet Users] Re: Assign variable with content of a file?
On May 1, 5:59 pm, Brandon Evans <bev...@adicio.com> wrote:> no-can-do. What exactly are you trying to get done?Apologies for leaving that out -- I''d hoped to not muddy the water with the details, but now it seems I must. I want to install a home-built package whose application runs on a virtual console exclusively. Which VC specifically is controlled by that app''s conf file. This app must be able to run on a VC that is normally occupied by a getty so therefore prior to app startup, it is necessary to tell upstart to disable that getty. I want puppet to do all of this, of course. The basic steps and required sequence are: 1. install package 2. install conf file for package 3. extract VC number from conf file, say as $ttynum 4. exec "initctl stop tty$ttynum" 5. exec "app" Puppet does NOT know what VC number is in the conf file -- it must extract this. (The reasons are way beyond the scope here.) Now, I''ve made step 3 a bit easier by revising the package so that it''s possible to run "app --show-vc" and it''ll parse the conf file and send the number to stdout. I cannot run this command directly with the generate function because of the embedded space character. So I thought I''d cheat and have puppet generate a temp file that is essentially a one-line shell script to run that command and have the generate function call this temporary file instead. Now it becomes a question of how to ensure that puppet creates the temp script before the generate function calls it. This is starting to look like a real headache. Unless someone sees an easier way to do something like this, I think I''ll just revise the app to do step 4 itself -- although that is rather icky in itself. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---