Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-6268) Fix error when switching monthly trigger types #17

Merged
merged 1 commit into from
Feb 21, 2018

Conversation

glennsarti
Copy link
Contributor

Previously when changing from a monthly day of week to a monthly date trigger
type (and vice versa) Puppet would raise an error. This was due to Puppet using
the same schedule name (monthly) for two distinct trigger types in windows API.
This commit adds an additional check to the tiggers_same? method which also
evaluates the underlying trigger type, not just the Puppet representation to
determine if two triggers are indeed the same. This commit also adds tests for
this scenario.

Previously when changing from a monthly day of week to a monthly date trigger
type (and vice versa) Puppet would raise an error.  This was due to Puppet using
the same schedule name (monthly) for two distinct trigger types in windows API.
This commit adds an additional check to the tiggers_same? method which also
evaluates the underlying trigger type, not just the Puppet representation to
determine if two triggers are indeed the same.  This commit also adds tests for
this scenario.
@michaeltlombardi michaeltlombardi merged commit bf131de into puppetlabs:master Feb 21, 2018
@@ -241,6 +241,7 @@ def flush
def triggers_same?(current_trigger, desired_trigger)
return false unless current_trigger['schedule'] == desired_trigger['schedule']
return false if current_trigger.has_key?('enabled') && !current_trigger['enabled']
return false if translate_hash_to_trigger(desired_trigger)['trigger_type'] != translate_hash_to_trigger(current_trigger)['trigger_type']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is an unnecessary conversion for 2 reasons:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussing with @glennsarti, realized that in its current state, we do need to perform the conversion to compare because there are 2 different types of "monthly" schedules.

That said, we identified some room for improvement in the overall flow of trigger hash building / initial resource population and will file a new ticket for refactoring some of that, which will introduce some refactoring here as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was finally cleaned up in #38 / particularly as part of refactoring triggers_same? in 2e97281 and d7d218c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants