On Friday, September 13, 2013 5:16:06 AM UTC-5, Andreas Dvorak wrote:
>
> Hi,
>
> now I have used the "schedule" successfully.
> But I don't understand the method to override the schedule completely. Is 
> it true that I have to change vom node.pp file from 
> node 'vm6741.muc.baag' inherits base {
>    $motd_function = "Puppet Agent"
>    $motd_environment = "Test"
>    $motd_description = "RedHat 5 Test"
>    include motd
>    *include copy_file*
> }
>
> to 
> node 'vm6741.muc.baag' inherits base {
>    $motd_function = "Puppet Agent"
>    $motd_environment = "Test"
>    $motd_description = "RedHat 5 Test"
>    include motd
>    *include copy_file::now*
> }
>
> That would not be nice because I need to change a file.
>


There is a variety of ways to do what you ask.  Some involve tags, some 
involve facts, and a few involve agent command-line options.

For example, you could leverage Facter's environment-defined facts or 
stdlib's fact.d/ facts to communicate to the master via a fact that you 
want to override the schedule, then use a conditional statement based on 
the fact value to control whather class copy_file::now is included.

Alternatively, you could flip the places of classes copy_file and 
copy_file::now to give you copy_file::scheduled and copy_file, so that the 
base class does not declare a schedule, but the subclass overrides it to 
do.  Declare class copy_file::scheduled.  I think then you can override the 
schedule from the command line like so:

puppet agent --tags 'copy_file'

That should select the copy_file class but NOT the copy_file::sheduled 
class that adds a schedule to it.

 

>
> There is no option to run the puppet agent like this:
> puppet agent --class copy_file::now
> or
> puppet agent --ignore_schedule
>
>

Or there's that, provided you spell it correctly: puppet agent 
--ignoreschedules
(http://docs.puppetlabs.com/references/latest/configuration.html#ignoreschedules).
  
With that you should be able to forget about subclassing altogether, but do 
be aware that it will override ALL schedules.  If that turns out to be an 
issue then you could narrow the parts of your configuration to apply to 
those bearing particular tags, maybe

puppet agent --ignoreschedules --tags copy_file


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+unsubscr...@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.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to