Jira (PUP-6743) Classes should propagate schedule metaparameter to its contained resources

7 views
Skip to first unread message

cameris (JIRA)

unread,
Sep 27, 2016, 5:35:05 AM9/27/16
to puppe...@googlegroups.com
cameris created an issue
 
Puppet / New Feature PUP-6743
Classes should propagate schedule metaparameter to its contained resources
Issue Type: New Feature New Feature
Assignee: Kylo Ginsberg
Components: Language, Types and Providers
Created: 2016/09/27 2:34 AM
Priority: Normal Normal
Reporter: cameris

Classes with a schedule metaparameter should propagate it to resources contained in the class.
Other metaparameters work as intended (notify/require), but schedule is ignored.
small example:

# definitions
define res {
    notify { 'in def':
        message => 'DEFINITION',
    }
}
 
class cls {
    notify { 'in class':
        message => 'CLASS',
    }
}
 
# instances
service { 'notify_me': }
 
notify { 'outside':
    message => 'OUTSIDE',
    schedule => 'never',
    notify => Service['notify_me'],
}
 
res { 'res inst':
    schedule => 'never',
    notify => Service['notify_me'],
}
 
class { 'cls':
    schedule => 'never',
    notify => Service['notify_me'],
}

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

cameris (JIRA)

unread,
Sep 27, 2016, 5:39:02 AM9/27/16
to puppe...@googlegroups.com

William Hopper (JIRA)

unread,
Sep 27, 2016, 2:11:04 PM9/27/16
to puppe...@googlegroups.com
William Hopper updated an issue
 
Change By: William Hopper
Labels: maintenance
Team: Puppet Developer Support

Henrik Lindberg (JIRA)

unread,
Sep 28, 2016, 8:25:04 AM9/28/16
to puppe...@googlegroups.com
Henrik Lindberg commented on New Feature PUP-6743
 
Re: Classes should propagate schedule metaparameter to its contained resources

It is unclear to me if this is something that should take place during compilation (inheriting meta params from containing class and propagating them to the catalog) or done in the resource framework when applying.

Kylo Ginsberg do you know how it is done, or do we need to do some detective work?

cameris (JIRA)

unread,
Oct 18, 2016, 9:46:03 AM10/18/16
to puppe...@googlegroups.com
cameris commented on New Feature PUP-6743

Apparently defined resources get non relation-metaparameters assigned during the finish step in compilation, but only if the not already have a parameter of the same name:
https://github.com/puppetlabs/puppet/blob/6e5bcd85ca1f718978a47b432d82c6dfc8c5b54d/lib/puppet/parser/compiler.rb#L709

So if an embedded resource has a schedule that is not overwritten, it does execute.

define res {
schedule { 'always':
    repeat => -1,
    range  => "00:00:00 - 23:59:59",
}
 
define res {
    notify { 'in def':
        message  => 'DEFINITION',
        schedule => 'always',
    }
}
 
res { 'res inst':
    schedule => 'never',
}

So it does not work as expected for defined resources either, since i would expect that the whole resource would be skipped.

cameris (JIRA)

unread,
Oct 19, 2016, 10:16:05 AM10/19/16
to puppe...@googlegroups.com
cameris commented on New Feature PUP-6743

I did dig a little deeper and see the following problems when done while compilation:

On the transaction (resource framework) side:
The current state is that each resources schedule is checked ( https://github.com/puppetlabs/puppet/blob/5fb5e2deacb6043d2417e2d9acb4ebe78547f971/lib/puppet/transaction/resource_harness.rb#L48-L56 ) during evaluation of the transaction ( https://github.com/puppetlabs/puppet/blob/5fb5e2deacb6043d2417e2d9acb4ebe78547f971/lib/puppet/transaction.rb#L339-L340 ). In order to get all the schedules we would have to recursively ask the resources parent for their schedule parameters (and since the catalog is already in RAL while this is checked, its a bit hard to find the parent). This seems pretty inelegant.

Maggie Dreyer (JIRA)

unread,
May 16, 2017, 5:48:04 PM5/16/17
to puppe...@googlegroups.com

Lindsey Smith (JIRA)

unread,
Oct 5, 2017, 5:25:03 PM10/5/17
to puppe...@googlegroups.com
Lindsey Smith updated an issue
Change By: Lindsey Smith
Team: Puppet Developer Experience Platform Core

Jose Alvarez (JIRA)

unread,
May 16, 2018, 11:09:05 AM5/16/18
to puppe...@googlegroups.com
Jose Alvarez commented on New Feature PUP-6743
 
Re: Classes should propagate schedule metaparameter to its contained resources

What is the state of this issue? Adding the schedule parameter for our own code works ok, but it still happens with resources such as concat and concat::fragment that are ignoring the schedule parameter, making the parameter useless for the whole role just by one concat if it can't be allowed to run for the schedule to be of any use.

This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Luca Zecca (JIRA)

unread,
Nov 24, 2018, 2:50:03 PM11/24/18
to puppe...@googlegroups.com
Luca Zecca commented on New Feature PUP-6743

Should be really useful and more powerful the propagation of the schedule in classes and define, i am really looking forward for this, hoping that pretty soon will be available!

Kevin Reeuwijk (JIRA)

unread,
Apr 5, 2019, 12:22:04 PM4/5/19
to puppe...@googlegroups.com

I just ran into this issue as well, where the following code didn't behave as expected:

windows_updates::kb { $kb :
  ensure   => 'present',
  kb       => $kb,
  notify   => Reboot['patch_window_reboot'],
  schedule => 'patch_window'
}
 
schedule { 'maintenance_window':
  range   => '22:00 - 04:00',
  weekday => 'Saturday',
}
 
reboot { 'patch_window_reboot':
  apply    => 'finished',
  onlyif   => [ 'windows_auto_update' ],
  when     => 'pending',
  schedule => 'patch_window'
}

 

The reboot{} resource did get skipped outside of the 'patch_window', but the windows_updates::kb{} resource would still create Exec{} resources that didn't inherit the schedule. This is frustrating to troubleshoot for the end user.

Ruben Stein (Jira)

unread,
Jan 21, 2021, 4:20:03 AM1/21/21
to puppe...@googlegroups.com
Ruben Stein commented on New Feature PUP-6743

It is very frustrating that schedules cannot be used for any third party code where you can't dig deep enough to inject the schedule in the leaf resources. I just wanted our puppet agents to be updated only during a maintenance window, but adding a schedule to the
puppet_agent resource is completely useless.

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Austin Boyd (Jira)

unread,
Mar 18, 2022, 8:09:01 AM3/18/22
to puppe...@googlegroups.com
Austin Boyd updated an issue
 
Change By: Austin Boyd
Zendesk Ticket Count: 1
Zendesk Ticket IDs: 47711
This message was sent by Atlassian Jira (v8.20.2#820002-sha1:829506d)
Atlassian logo

Austin Boyd (Jira)

unread,
Mar 18, 2022, 8:09:02 AM3/18/22
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages