From 6df3685d42f35147b73f08237b3dea73e8d36e9a Mon Sep 17 00:00:00 2001 From: Alexander Moiseenko Date: Wed, 26 May 2021 08:00:53 +0300 Subject: [PATCH] jenkins_plugin: HTTP Error 405: Method Not Allowed on disable/enable plugin #2510 (#2511) * define POST method for pluginManager api requests Jenkins makeEnable/makeDisable api requests requires to use POST method * add changelog fragment * fix my yoda lang thx to aminvakil Co-authored-by: Amin Vakil * update changelog fragment Co-authored-by: Felix Fontein Co-authored-by: Amin Vakil Co-authored-by: Felix Fontein --- changelogs/fragments/2510-jenkins_plugin_use_post_method.yml | 2 ++ plugins/modules/web_infrastructure/jenkins_plugin.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/2510-jenkins_plugin_use_post_method.yml diff --git a/changelogs/fragments/2510-jenkins_plugin_use_post_method.yml b/changelogs/fragments/2510-jenkins_plugin_use_post_method.yml new file mode 100644 index 0000000000..b310e27061 --- /dev/null +++ b/changelogs/fragments/2510-jenkins_plugin_use_post_method.yml @@ -0,0 +1,2 @@ +bugfixes: + - jenkins_plugin - use POST method for sending request to jenkins API when ``state`` option is one of ``enabled``, ``disabled``, ``pinned``, ``unpinned``, or ``absent`` (https://github.com/ansible-collections/community.general/issues/2510). diff --git a/plugins/modules/web_infrastructure/jenkins_plugin.py b/plugins/modules/web_infrastructure/jenkins_plugin.py index c9946023ac..be335fcfd3 100644 --- a/plugins/modules/web_infrastructure/jenkins_plugin.py +++ b/plugins/modules/web_infrastructure/jenkins_plugin.py @@ -696,7 +696,8 @@ class JenkinsPlugin(object): self._get_url_data( url, msg_status="Plugin not found. %s" % url, - msg_exception="%s has failed." % msg) + msg_exception="%s has failed." % msg, + method="POST") def main():