1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixes #24241 Module always updates installed plugins (#40591)

* Update jenkins_plugin.py

When setting state=latest, plugin are always updated because plugin_data['sha1'] contains trailing '\r\n' (so it always detecting a sha1 change)

+label: docsite_pr

* rstrip wasn't the solution but to_bytes is
This commit is contained in:
Benoit Dunand-Laisin 2018-05-24 04:15:47 +02:00 committed by Jordan Borean
parent 2d0891e089
commit 3d6828949e

View file

@ -261,7 +261,7 @@ state:
sample: "present"
'''
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.basic import AnsibleModule, to_bytes
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.urls import fetch_url, url_argument_spec
from ansible.module_utils._text import to_native
@ -491,7 +491,7 @@ class JenkinsPlugin(object):
sha1sum_old = base64.b64encode(sha1_old.digest())
# If the latest version changed, download it
if sha1sum_old != plugin_data['sha1']:
if sha1sum_old != to_bytes(plugin_data['sha1']):
if not self.module.check_mode:
r = self._download_plugin(plugin_url)
self._write_file(plugin_file, r)