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-7554) Fix crash on Puppet 4 / WMF < 5 #72

Conversation

Iristyle
Copy link
Contributor

  • 914d934 introduced a new feature for
    dsc_lite. In situations where the proper WMF5 version was not
    available, a warning would be generated using the Puppet.warn_once
    helper.

    However, it was not realized that Puppet 4 and Puppet 5 have
    different numbers of arguments that can be passed to warn_once, and
    that only Puppet 5 supported changing warning to error.

    That change was introduced in
    puppetlabs/puppet@3d82337

  • Calling a Ruby method with too many arguments causes a Ruby crash and
    results in a completely terminated Puppet run that produces no report
    for the master. In other words, this is a completely catastrophic
    failure case.

  • Resolve this problem by checking the arity of the Puppet.warn_once
    call to send the right number of arguments on Puppet 4.

    The concession was made to vary the message type on Puppet 4 (warning)
    vs Puppet 5 (error), because the alternative solution did not
    preserve the warn_once style behavior. Instead, it would have
    produced an error for every single dsc_lite resource, which was far
    less desirable.

 - 914d934 introduced a new feature for
   dsc_lite. In situations where the proper WMF5 version was not
   available, a warning would be generated using the Puppet.warn_once
   helper.

   However, it was not realized that Puppet 4 and Puppet 5 have
   different numbers of arguments that can be passed to warn_once, and
   that only Puppet 5 supported changing warning to error.

   That change was introduced in
   puppetlabs/puppet@3d82337

 - Calling a Ruby method with too many arguments causes a Ruby crash and
   results in a completely terminated Puppet run that produces no report
   for the master. In other words, this is a completely catastrophic
   failure case.

 - Resolve this problem by checking the arity of the Puppet.warn_once
   call to send the right number of arguments on Puppet 4.

   The concession was made to vary the message type on Puppet 4 (warning)
   vs Puppet 5 (error), because the alternative solution did not
   preserve the warn_once style behavior. Instead, it would have
   produced an error for every single dsc_lite resource, which was far
   less desirable.
]

# Puppet 5 allows changing warning to error
params << :err if Puppet.method(:warn_once).arity > 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we leave a message to "de-splat" when puppet 4 reaches EOL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe just file a ticket for later? I could go either way...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ticket ensures it's added to a backlog with a priority equal to other work. A todo in code is forgotten until the file is looked at again.

@jpogran jpogran merged commit 3da68fe into puppetlabs:master Aug 1, 2018
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.

None yet

4 participants