The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Refactor #1537

"ensure" and "enable" running order for a service is inappropriate

Added by Oliver Hookins over 5 years ago. Updated almost 4 years ago.

Status:AcceptedStart date:08/29/2008
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:service
Target version:-
Affected Puppet version:0.24.8 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the PUP project on JIRA using the button below:


Description

Granted, I only have a single use case for this but it is valid. Say we have several service levels of machine, and on the lowest level we don’t want to run puppet aside from during the build where we set up some defaults.

So we have something like this defined in the manifests:

class puppet::disable {

    # Disable puppet
    service { "puppet":
            ensure => stopped,
            enable => false,
    }

}

Hovever, the “ensure” part is run first, which stops puppet in the middle of the run. Since the “enable” part would usually be run afterwards, it is never run. Therefore quite possibly puppet will stay chkconfig'ed on.

To fix this we just need the running order reversed. I can’t think of any reason why this would break things.

History

#1 Updated by James Turnbull over 5 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies

#2 Updated by Luke Kanies over 5 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Luke Kanies to Puppet Community

I guess I’m ok with this but it involves hacking the ensure property so that it checks if ‘enable’ is out of sync, and if so, runs it first. Puppet’s model requires that ensure always runs first, so anything that needs to run before it must be done explicitly by the ‘ensure’ property.

See the hackery in the file type around content and source for an example.

#3 Updated by James Turnbull almost 5 years ago

  • Assignee deleted (Puppet Community)
  • Affected Puppet version set to 0.24.8

Also available in: Atom PDF