Hi, I have an Exec which requires a lot of packages (15-20): Exec { ''name'': ... require => [ Package[''first''], Package[''second''], Package[''third''], ... ] } Is there a way to shorten this list and make it easier to read? Gergo Erdosi -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Tue, Mar 12, 2013 at 10:45 AM, <gergo@timble.net> wrote:> Hi, > > I have an Exec which requires a lot of packages (15-20): > > Exec { ''name'': > ... > require => [ Package[''first''], Package[''second''], Package[''third''], ... ] > } > > Is there a way to shorten this list and make it easier to read?15-20 packages for one exec statement? That seems excessive. What does that exec statement look like, at the moment, the only way I can imagine an exec statement requiring that number of packages is by it being a pipeline of 15 commands, each of which comes from a separate package. Ta, Matt. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
----- Original Message -----> From: "Matthew Burgess" <matthew.2.burgess@gmail.com> > To: puppet-users@googlegroups.com > Sent: Tuesday, March 12, 2013 10:52:05 AM > Subject: Re: [Puppet Users] Shorten require list > > On Tue, Mar 12, 2013 at 10:45 AM, <gergo@timble.net> wrote: > > Hi, > > > > I have an Exec which requires a lot of packages (15-20): > > > > Exec { ''name'': > > ... > > require => [ Package[''first''], Package[''second''], Package[''third''], ... ] > > } > > > > Is there a way to shorten this list and make it easier to read? > > 15-20 packages for one exec statement? That seems excessive. What > does that exec statement look like, at the moment, the only way I can > imagine an exec statement requiring that number of packages is by it > being a pipeline of 15 commands, each of which comes from a separate > package.if the packages are in a class, just require Class["foo"]. If the packages are tagged by some shared name ''foo'': Package<| tag == "foo" |> -> Exec["name"] -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hi Matt, It installs PHP from source. The required packages are mostly libraries (libxml2-dev, libpcre3-dev, etc). Here is the file if it helps to better understand my problem: https://www.assembla.com/code/nooku-server/git/nodes/master/puppet/modules/php/manifests/install.pp The exec is on line 175. Gergo Erdosi On Tuesday, March 12, 2013 11:52:05 AM UTC+1, Matthew Burgess wrote:> > On Tue, Mar 12, 2013 at 10:45 AM, <ge...@timble.net <javascript:>> > wrote: > > Hi, > > > > I have an Exec which requires a lot of packages (15-20): > > > > Exec { ''name'': > > ... > > require => [ Package[''first''], Package[''second''], Package[''third''], > ... ] > > } > > > > Is there a way to shorten this list and make it easier to read? > > 15-20 packages for one exec statement? That seems excessive. What > does that exec statement look like, at the moment, the only way I can > imagine an exec statement requiring that number of packages is by it > being a pipeline of 15 commands, each of which comes from a separate > package. > > Ta, > > Matt. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hi, Thanks, I will look into tags, it could be solution indeed. I also thought about moving those packages into a separate class (eg. packages.pp), was just wondering what my options are if I leave them in install.pp. Gergo Erdosi On Tuesday, March 12, 2013 11:57:41 AM UTC+1, R.I. Pienaar wrote:> > > > ----- Original Message ----- > > From: "Matthew Burgess" <matthew....@gmail.com <javascript:>> > > To: puppet...@googlegroups.com <javascript:> > > Sent: Tuesday, March 12, 2013 10:52:05 AM > > Subject: Re: [Puppet Users] Shorten require list > > > > On Tue, Mar 12, 2013 at 10:45 AM, <ge...@timble.net <javascript:>> > wrote: > > > Hi, > > > > > > I have an Exec which requires a lot of packages (15-20): > > > > > > Exec { ''name'': > > > ... > > > require => [ Package[''first''], Package[''second''], Package[''third''], > ... ] > > > } > > > > > > Is there a way to shorten this list and make it easier to read? > > > > 15-20 packages for one exec statement? That seems excessive. What > > does that exec statement look like, at the moment, the only way I can > > imagine an exec statement requiring that number of packages is by it > > being a pipeline of 15 commands, each of which comes from a separate > > package. > > if the packages are in a class, just require Class["foo"]. > > If the packages are tagged by some shared name ''foo'': > > Package<| tag == "foo" |> -> Exec["name"] >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
----- Original Message -----> From: gergo@timble.net > To: puppet-users@googlegroups.com > Sent: Tuesday, March 12, 2013 11:04:53 AM > Subject: Re: [Puppet Users] Shorten require list > > Hi, > > Thanks, I will look into tags, it could be solution indeed. I also thought > about moving those packages into a separate class (eg. packages.pp), was > just wondering what my options are if I leave them in install.pp.Really though it sounds like you''re to reinvent packaging by running a few execs and discovering that - unsurprisingly - it''s not that simple. You should make a package and use that instead of compiling php on demand. Use fpm, it makes it as easy as using tar. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
I know, this is not the first time I hear packages are the preferred way, and I completely agree. We will look into packaging later, but for now we needed to get the script to work. This is the first version, I already have ideas how to improve it. Gergo Erdosi On Tuesday, March 12, 2013 12:10:43 PM UTC+1, R.I. Pienaar wrote:> > > > ----- Original Message ----- > > From: ge...@timble.net <javascript:> > > To: puppet...@googlegroups.com <javascript:> > > Sent: Tuesday, March 12, 2013 11:04:53 AM > > Subject: Re: [Puppet Users] Shorten require list > > > > Hi, > > > > Thanks, I will look into tags, it could be solution indeed. I also > thought > > about moving those packages into a separate class (eg. packages.pp), was > > just wondering what my options are if I leave them in install.pp. > > Really though it sounds like you''re to reinvent packaging by running a few > execs and discovering that - unsurprisingly - it''s not that simple. > > You should make a package and use that instead of compiling php on demand. > > Use fpm, it makes it as easy as using tar. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On 12.03.2013 11:45, gergo@timble.net wrote:> Hi, > > I have an Exec which requires a lot of packages (15-20): > > Exec { ''name'': > ... > require => [ Package[''first''], Package[''second''], Package[''third''], ... ] > } > > Is there a way to shorten this list and make it easier to read?You can use require => Package[''first'', ''second'', ''third'', ...] instead. Also, putting this into a variable and using that instead, may improve your situation: $packages = [''first'', ''second'', ''third'', ...] package { $packages: ensure installed } exec { "foo": require => Package[$packages] } Best Regards, David -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Hi David, Nice, didn''t know I can use multiple packages inside Package. Thanks! Gergo Erdosi On Tue, Mar 12, 2013 at 12:19 PM, David Schmitt <david@dasz.at> wrote:> On 12.03.2013 11:45, gergo@timble.net wrote: >> >> Hi, >> >> I have an Exec which requires a lot of packages (15-20): >> >> Exec { ''name'': >> ... >> require => [ Package[''first''], Package[''second''], Package[''third''], ... >> ] >> } >> >> Is there a way to shorten this list and make it easier to read? > > > You can use > > require => Package[''first'', ''second'', ''third'', ...] > > instead. > > Also, putting this into a variable and using that instead, may improve your > situation: > > $packages = [''first'', ''second'', ''third'', ...] > > package { $packages: ensure installed } > > exec { "foo": require => Package[$packages] } > > Best Regards, David > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Puppet Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/puppet-users/LYxmrugXGps/unsubscribe?hl=en. > To unsubscribe from this group and all its topics, send an email to > puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Le 12 mars 2013 à 12:24, Gergo Erdosi <gergo@timble.net> a écrit :> Hi David, > > Nice, didn''t know I can use multiple packages inside Package. Thanks! > > Gergo Erdosi > > On Tue, Mar 12, 2013 at 12:19 PM, David Schmitt <david@dasz.at> wrote: >> On 12.03.2013 11:45, gergo@timble.net wrote: >>> >>> Hi, >>> >>> I have an Exec which requires a lot of packages (15-20): >>> >>> Exec { ''name'': >>> ... >>> require => [ Package[''first''], Package[''second''], Package[''third''], ... >>> ] >>> } >>> >>> Is there a way to shorten this list and make it easier to read? >> >> >> You can use >> >> require => Package[''first'', ''second'', ''third'', ...] >> >> instead. >> >> Also, putting this into a variable and using that instead, may improve your >> situation: >> >> $packages = [''first'', ''second'', ''third'', ...] >> >> package { $packages: ensure installed } >> >> exec { "foo": require => Package[$packages] } >> >> Best Regards, DavidThis works too : package{''needed for exec'': name => $packages, ensure => present, } exec { "foo": require => Package[''needed for exec''] } Less object, so a smaller catalog, and faster because your package tool is run once, not one time for each package. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
> This works too : > > package{''needed for exec'': > name => $packages, > ensure => present, > } > > exec { "foo": require => Package[''needed for exec''] } > > Less object, so a smaller catalog, and faster because your package tool is > run once, not one time for each package.I have trouble believing that that works completely, and if it does, I would be amazed to find that it avoids running the package tool separately for each package. Ways I imagine it might fail include: - Puppet attempts to manage a single package whose name is a concatenation of the names in $packages ("firstsecondthird...") - Puppet manages only the first package listed in $packages, ignoring the others - Puppet does not correctly detect when the packages are already installed, and therefore attempts to install them on every run If it does none of those things then I have great difficulty believing that it does not create a separate Package resource for each element of $packages, and therefore indeed run the package manager once for each. And if it in fact behaves exactly as promised, then that constitutes undocumented behavior, and it is therefore unsafe to rely upon. So don''t do that. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Le 12 mars 2013 à 17:46, jcbollinger <John.Bollinger@stJude.org> a écrit :> > This works too : > > package{''needed for exec'': > name => $packages, > ensure => present, > } > > exec { "foo": require => Package[''needed for exec''] } > > Less object, so a smaller catalog, and faster because your package tool is run once, not one time for each package. > > > I have trouble believing that that works completely, and if it does, I would be amazed to find that it avoids running the package tool separately for each package. > > Ways I imagine it might fail include: > Puppet attempts to manage a single package whose name is a concatenation of the names in $packages ("firstsecondthird...") > Puppet manages only the first package listed in $packages, ignoring the others > Puppet does not correctly detect when the packages are already installed, and therefore attempts to install them on every run > If it does none of those things then I have great difficulty believing that it does not create a separate Package resource for each element of $packages, and therefore indeed run the package manager once for each.It does nothing of that, I use it a lot in my modules and it solves many problems. I didn''t test it on many platform, but it works quite well on rpm-based providers.> > And if it in fact behaves exactly as promised, then that constitutes undocumented behavior, and it is therefore unsafe to rely upon.It not so undocumented. You don''t just convert a array to a string, you get an empty separator [''a'', ''b''] is converted to ''ab'', for what I saw in many of my mistakes. So someone was thinking about my use case and add the code to have a '' '' separator for the rpm command.> > So don''t do that. > > > John-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Tuesday, March 12, 2013 3:26:26 PM UTC-5, Fabrice Bacchella wrote:> > > It not so undocumented. >Point me to the docs, then. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.