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

Make dockerng.absent state honor test=true #34108

Merged
merged 1 commit into from
Jun 21, 2016

Conversation

l2ol33rt
Copy link
Contributor

@l2ol33rt l2ol33rt commented Jun 17, 2016

What does this PR do?

Fix dockerng.absent when passing in test=true

Previous Behavior

With the following state /srv/state/docker_test.sls:

delete_container:
  dockerng.absent:
    - name: test
    - force: True
(salt) root@jessie:/srv/salt# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
8caecab07a9b        ubuntu:14.04        "/bin/bash"         13 minutes ago      Up 13 minutes                           test

(salt) root@jessie:~/salt# salt '*' state.sls docker_test test=true

jessie:
----------
          ID: delete_container
    Function: dockerng.absent
        Name: test
      Result: True
     Comment: Forcibly removed container 'test'
     Started: 20:59:58.159183
    Duration: 842.916 ms
     Changes:   
              ----------
              removed:
                  - 8caecab07a9b8c44cabb1b7130222227611f582e6a100967569d734c3339a258

Summary for jessie
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1

(salt) root@jessie:~/salt# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

New Behavior

Same state as above and the fix:

(salt) root@jessie:~/salt# salt '*' state.sls docker_test test=true

jessie:
----------
          ID: delete_container
    Function: dockerng.absent
        Name: test
      Result: None
     Comment: Container 'test' will be removed
     Started: 22:04:53.411383
    Duration: 4.884 ms
     Changes:   

Summary for jessie
------------
Succeeded: 1 (unchanged=1)
Failed:    0
------------
Total states run:     1
(salt) root@jessie:~/salt# docker ps -a

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
6f332874952d        ubuntu:14.04        "/bin/bash"         2 minutes ago       Up 2 minutes                            test

And actually running the state works as expect still:

(salt) root@jessie:~/salt# salt '*' state.sls docker_test
jessie:
----------
          ID: delete_container
    Function: dockerng.absent
        Name: test
      Result: True
     Comment: Forcibly removed container 'test'
     Started: 22:28:42.605469
    Duration: 621.064 ms
     Changes:   
              ----------
              removed:
                  - 6f332874952d2e2887833e46740631396b56f4b3aad8b15f2dda3674b4bf4e49

Summary for jessie
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
(salt) root@jessie:~/salt# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Tests written?

No

Version output:

root@jessie:~/salt# salt --versions
Salt Version:
           Salt: 2016.3.1-31-gf9667ba

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.7
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Mar  1 2015, 12:57:24)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.3
            ZMQ: 4.1.4

System Versions:
           dist: debian 8.2
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.2

@cachedout cachedout merged commit b986878 into saltstack:2016.3 Jun 21, 2016
@cachedout
Copy link
Contributor

Thank you, @l2ol33rt

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

Successfully merging this pull request may close these issues.

None yet

2 participants