docker_login: fix Python 3 problem in #60381 (#62621)

* Fix Python 3 problem: run_command() returns native strings, not byte strings.

* Add changelog.

(cherry picked from commit 2e5137078d)
pull/62951/head
Felix Fontein 5 years ago committed by Toshio Kuratomi
parent b07ac9cb96
commit 9efac6864d

@ -0,0 +1,2 @@
bugfixes:
- "docker_login - correct broken fix for https://github.com/ansible/ansible/pull/60381 which crashes for Python 3."

@ -224,9 +224,9 @@ class LoginManager(DockerBaseClass):
(rc, out, err) = self.client.module.run_command(cmd) (rc, out, err) = self.client.module.run_command(cmd)
if rc != 0: if rc != 0:
self.fail("Could not log out: %s" % err) self.fail("Could not log out: %s" % err)
if b'Not logged in to ' in out: if 'Not logged in to ' in out:
self.results['changed'] = False self.results['changed'] = False
elif b'Removing login credentials for ' in out: elif 'Removing login credentials for ' in out:
self.results['changed'] = True self.results['changed'] = True
else: else:
self.client.module.warn('Unable to determine whether logout was successful.') self.client.module.warn('Unable to determine whether logout was successful.')

Loading…
Cancel
Save