Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
ordering or chaining for generate() function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
psychobyte  
View profile  
 More options Apr 24 2012, 4:53 pm
From: psychobyte <psychob...@gmail.com>
Date: Tue, 24 Apr 2012 13:53:04 -0700 (PDT)
Local: Tues, Apr 24 2012 4:53 pm
Subject: ordering or chaining for generate() function

Hi,

 I need to run a the generate() function (server side) in order to populate
a data file for one of my modules.  Is there a way to ensure that the
generate function is
run before a config file is created (the contents of the file doesn't come
directly from generate()).

Right now I'm getting around this by creating a bogus File resource and
chaining that before I write a config file.

===============================
  file { "mp_volumes.yaml":
    ensure  => 'present',
    path    => '/tmp/cmpllnt_vol.out',
    content => generate('/usr/bin/myscript'),
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }

  # Make sure mp_volumes.yaml is up to date before we create conf file
  File['mp_volumes.yaml']->File['conffile']
===============================

Is there a  more appropriate way of doing this?

Thanks,


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Luke Bigum  
View profile  
 More options Apr 25 2012, 3:49 am
From: Luke Bigum <Luke.Bi...@lmax.com>
Date: Wed, 25 Apr 2012 08:49:06 +0100
Local: Wed, Apr 25 2012 3:49 am
Subject: Re: [Puppet Users] ordering or chaining for generate() function
You might be able to do something like this (untested):

$blackhole_variable = generate('/usr/bin/myscript')

file { "conffile":
    ...

}

On 24/04/12 21:53, psychobyte wrote:

--
Luke Bigum

Information Systems
Ph: +44 (0) 20 3192 2520
luke.bi...@lmax.com | http://www.lmax.com
LMAX, Yellow Building, 1A Nicholas Road, London W11 4AN

FX and CFDs are leveraged products that can result in losses exceeding
your deposit.  They are not suitable for everyone so please ensure you
fully understand the risks involved.  The information in this email is not
directed at residents of the United States of America or any other
jurisdiction where trading in CFDs and/or FX is restricted or prohibited
by local laws or regulations.

The information in this email and any attachment is confidential and is
intended only for the named recipient(s). The email may not be disclosed
or used by any person other than the addressee, nor may it be copied in
any way. If you are not the intended recipient please notify the sender
immediately and delete any copies of this message. Any unauthorised
copying, disclosure or distribution of the material in this e-mail is
strictly forbidden.

LMAX operates a multilateral trading facility.  Authorised and regulated
by the Financial Services Authority (firm registration number 509778) and
is registered in England and Wales (number 06505809).
Our registered address is Yellow Building, 1A Nicholas Road, London, W11
4AN.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jcbollinger  
View profile  
 More options Apr 25 2012, 9:07 am
From: jcbollinger <John.Bollin...@stJude.org>
Date: Wed, 25 Apr 2012 06:07:05 -0700 (PDT)
Local: Wed, Apr 25 2012 9:07 am
Subject: Re: ordering or chaining for generate() function

On Apr 24, 3:53 pm, psychobyte <psychob...@gmail.com> wrote:

>  I need to run a the generate() function (server side) in order to populate
> a data file for one of my modules.  Is there a way to ensure that the
> generate function is
> run before a config file is created (the contents of the file doesn't come
> directly from generate()).

So the script run via generate() has some kind of side effect on the
master that later generation of the config file relies on?  What a
terrible strategy.  If you explain your problem in more detail then it
is likely that we can suggest a superior alternative.

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Krzysztof Wilczynski  
View profile  
 More options Apr 25 2012, 9:50 am
From: Krzysztof Wilczynski <krzysztof.wilczyn...@linux.com>
Date: Wed, 25 Apr 2012 06:50:52 -0700 (PDT)
Local: Wed, Apr 25 2012 9:50 am
Subject: Re: ordering or chaining for generate() function

Hi,

Am I right in thinking that something like that has place. On the Master:

generate() -> template() and/or "static file" -> /config/file/on/the/client

Then, if /config/file/on/the/client exists, you do not use generate(), yet
when on the contrary, then you have to fire generate() first to generate
content for said client-side configuration file?

KW


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
psychobyte  
View profile  
 More options Apr 25 2012, 12:49 pm
From: psychobyte <psychob...@gmail.com>
Date: Wed, 25 Apr 2012 09:49:03 -0700 (PDT)
Local: Wed, Apr 25 2012 12:49 pm
Subject: Re: ordering or chaining for generate() function

Essentially, yeah.

we have a data file that needs updating on the server.  This is done
through a custom script. i want to use generate() to run that script server
side
 before we re-create the config files via puppet.  I want to guarantee that
the generate function runs before any file resources.

Thanks.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
psychobyte  
View profile  
 More options Apr 25 2012, 12:50 pm
From: psychobyte <psychob...@gmail.com>
Date: Wed, 25 Apr 2012 09:50:58 -0700 (PDT)
Local: Wed, Apr 25 2012 12:50 pm
Subject: Re: ordering or chaining for generate() function

yes.  I'm running a server side script that creates some data used to
update a client-side config file.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Krzysztof Wilczynski  
View profile  
 More options Apr 25 2012, 3:48 pm
From: Krzysztof Wilczynski <krzysztof.wilczyn...@linux.com>
Date: Wed, 25 Apr 2012 12:48:54 -0700 (PDT)
Local: Wed, Apr 25 2012 3:48 pm
Subject: Re: ordering or chaining for generate() function

Hi,

On Wednesday, April 25, 2012 5:49:03 PM UTC+1, psychobyte wrote:

> Essentially, yeah.

[...]

> I want to guarantee that the generate function runs before any file
> resources.

In such case, look at stages, perhaps it will help. Other than that, if you
want to make sure that said configuration file is not present on the client
side and only then run generate, you could have a fact (I can help writing
one) that yields a boolean if the configuration file exists or not and then
use this value in an if-statement where you'd run generate() function
conditionally.

KW


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
jcbollinger  
View profile  
 More options Apr 26 2012, 9:16 am
From: jcbollinger <John.Bollin...@stJude.org>
Date: Thu, 26 Apr 2012 06:16:09 -0700 (PDT)
Local: Thurs, Apr 26 2012 9:16 am
Subject: Re: ordering or chaining for generate() function

On Apr 25, 11:49 am, psychobyte <psychob...@gmail.com> wrote:

> Essentially, yeah.

> we have a data file that needs updating on the server.  This is done
> through a custom script. i want to use generate() to run that script server
> side
>  before we re-create the config files via puppet.  I want to guarantee that
> the generate function runs before any file resources.

That doesn't make sense to me.  Is the data file you are trying to
generate specific to the node you want to configure?

If not, then why do you need to (re)generate it every time a node
requests a catalog?

If so, then why can't you incorporate the data generation directly
into the process of generating the target config file?  Alternatively,
why is it preferable to generate the node-specific data file on the
server instead of on the node?

If you insist on continuing with this unwise approach, then you need
to understand that Puppet's resource relationships (and thus also run
stages) influence only the order in which resources are applied to the
node, not the order in which related operations are performed on the
master.  Your best bet is Luke's suggestion, which is basically to
invoke generate() in the same class and above your declaration of
File['conffile'].  But really, think again.

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »