From 01a1ce16ce12d1e40fa3db4ccc8f6f26118b6c56 Mon Sep 17 00:00:00 2001 From: Gavin Williams Date: Thu, 20 Dec 2018 15:51:02 +0000 Subject: [PATCH] Jenkins_plugin: Handle 'latest' version when installing plugin for first time (#49723) * Handle 'latest' version when installing module for first time Otherwise, a fresh install of a plugin with 'version: latest' gets installed without its dependencies, rendering the plugin effectively useless. * Add changelog --- changelogs/fragments/49723-jenkins-plugin-install-latest.yaml | 2 ++ lib/ansible/modules/web_infrastructure/jenkins_plugin.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/49723-jenkins-plugin-install-latest.yaml diff --git a/changelogs/fragments/49723-jenkins-plugin-install-latest.yaml b/changelogs/fragments/49723-jenkins-plugin-install-latest.yaml new file mode 100644 index 0000000000..e1fb97f2e8 --- /dev/null +++ b/changelogs/fragments/49723-jenkins-plugin-install-latest.yaml @@ -0,0 +1,2 @@ +bugfixes: + - "jenkins_plugin - ``version: latest`` should install new plugins with their dependencies" diff --git a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py index 27234573bc..34dcc28889 100644 --- a/lib/ansible/modules/web_infrastructure/jenkins_plugin.py +++ b/lib/ansible/modules/web_infrastructure/jenkins_plugin.py @@ -387,7 +387,7 @@ class JenkinsPlugin(object): self.params['jenkins_home'], self.params['name'])) - if not self.is_installed and self.params['version'] is None: + if not self.is_installed and self.params['version'] in [None, 'latest']: if not self.module.check_mode: # Install the plugin (with dependencies) install_script = (