docker_logout: report change on successful logout (#60381)
* Mark logout as changed when docker logout does not return 'Not logged in to '.
* Add changelog.
* Improve logout detection.
* Also return output of 'docker logout'.
(cherry picked from commit 99fb0fcb2f
)
This commit is contained in:
parent
9fe0971004
commit
b66433f47d
2 changed files with 11 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "docker_login - report change on successful logout (https://github.com/ansible/ansible/issues/59232)"
|
|
@ -224,6 +224,15 @@ class LoginManager(DockerBaseClass):
|
|||
(rc, out, err) = self.client.module.run_command(cmd)
|
||||
if rc != 0:
|
||||
self.fail("Could not log out: %s" % err)
|
||||
if b'Not logged in to ' in out:
|
||||
self.results['changed'] = False
|
||||
elif b'Removing login credentials for ' in out:
|
||||
self.results['changed'] = True
|
||||
else:
|
||||
self.client.module.warn('Unable to determine whether logout was successful.')
|
||||
|
||||
# Adding output to actions, so that user can inspect what was actually returned
|
||||
self.results['actions'].append(to_text(out))
|
||||
|
||||
def config_file_exists(self, path):
|
||||
if os.path.exists(path):
|
||||
|
|
Loading…
Reference in a new issue