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

docker_container action redeploy should not start container which have never run #432

Closed
jperville opened this issue Sep 17, 2015 · 2 comments

Comments

@jperville
Copy link
Contributor

Docker containers are declared either with action :create or action :run (which is a shortcut to mean "create then start"). When a container has been created (never started) and then redeployed, I'd like action :redeploy to not start the container.

In other words, I'd like action redeploy to:

  • delete then run the container if it was previously running
  • delete then create the container if it was not previously running
    So that the running state of the container after the redeploy is the same as it was before it.

In the current version (1.0.25), the docker_container action :redeploy is implemented like this:

action :redeploy do
  action_delete
  action_run
end

In the older version (0.37) it has been implemented like this:

action :redeploy do
  stop if (previously_running = running?)
  remove_container if exists?
  if previously_running
    run
  else
    create
  end
  new_resource.updated_by_last_action(true)
end

Would you take a PR to restore the behavior of version 0.37 (which was introduced in #242).

From reading the code, I know that I can tell if a container is running like this:

c = Docker::Container.get(new_resource.container_name)
next if c.info['State']['Running']
@someara
Copy link
Contributor

someara commented Sep 17, 2015

Indeed I would! Thanks!
-s

On Thu, Sep 17, 2015 at 11:09 AM, Julien Pervillé [email protected]
wrote:

Docker containers are declared either with action :create or action :run
(which is a shortcut to mean "create then start"). When a container has
been created (never started) and then redeployed, I'd like action
:redeploy to not start the container.

In other words, I'd like action redeploy to:

  • delete then run the container if it was previously running
  • delete then create the container if it was not previously running So
    that the running state of the container after the redeploy is the same as
    it was before it.

In the current version (1.0.25), the docker_container action :redeploy is
implemented like this:

action :redeploy do
action_delete
action_runend

In the older version (0.37) it has been implemented like this:

action :redeploy do
stop if (previously_running = running?)
remove_container if exists?
if previously_running
run
else
create
end
new_resource.updated_by_last_action(true)end

Would you take a PR to restore the behavior of version 0.37 (which was
introduced in #242 #242).

From reading the code, I know that I can tell if a container is running
like this:

c = Docker::Container.get(new_resource.container_name)next if c.info['State']['Running']


Reply to this email directly or view it on GitHub
#432.

@jperville
Copy link
Contributor Author

Fixed in PR #437.

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

No branches or pull requests

2 participants