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

If user passes running => false, then the enable flag for the service should be false too #308

Open
lorijean44 opened this issue Jul 23, 2015 · 5 comments
Labels

Comments

@lorijean44
Copy link

The service block for the container is hardcoded to enable => true. If the user passes running => false, then enable should not get set to true.

I would say enable should default to false if running is set to false.

Maybe something like:

service { "docker-${sanitised_title}":
  ensure    => $running,
  enable    => $running ? { true => true, false => false },
  hasstatus => $hasstatus,
  require   => File[$initscript],
}
@garethr
Copy link
Owner

garethr commented Jul 26, 2015

Related to #309 as well.

@jniesen
Copy link

jniesen commented Jan 12, 2016

Does it make sense to have running and enable be considered separately?

The current behavior is that when running == false, then enable will equal false. If running == true, then enabled will equal true.

In our use case, we're running puppet when baking an AMI and we don't want these services starting until the first boot of an EC2 instance built from the AMI. Because of this, we would like to be able to set enabled to true and ensure that the container services are stopped.

We're working on a pull request that will support our use case. We can take into account that the default should be enable == running, but we'd like enabled to be override-able.

@lorijean44
Copy link
Author

In our use case, we're running puppet when baking an AMI and we don't want these services starting until the first boot of an EC2 instance built from the AMI. Because of this, we would like to be able to set enabled to true and ensure that the container services are stopped.

Do you only run puppet to build a host and after reboot it doesn't ever run again?

Because otherwise puppet will stop your containers the next time it runs because you have ensure=> stopped.

Sounds like they should be overrideable regardless.

@jantman
Copy link

jantman commented Jan 12, 2016

I'm working with @jniesen at the moment.

@lorijean44 yes. The pattern of immutable infrastructure, and just using Puppet to "bake" an immutable image (docker image, AMI, etc.) is getting quite common.

We use pretty much all "cloud" infrastructure, so we're not using Puppet to build a "host", we're building an image/template that then gets deployed.

@lorijean44
Copy link
Author

It looks like this was partially done in 5.1. Now it says "if $manage_service is true, and running is false, then the docker service is set to ensure false, and enable false. Then later if running is true, then ensure is set to true and enable is set to true. So it doesn't quite do what @jniesen and @jantman were asking for. (But it does handle my scenario).

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

No branches or pull requests

4 participants