Fix plugin management with Jenkins restart
- change plugin managent logic from per-plugin management to plugin set
- for plugin set management add two parameters:
* jenkins.client.plugin_remove_unwanted - to remove plugins not listed
in jenkins.client.plugin
* jenkins.client.plugin_force_remove - to forcible remove plugins
including dependants but taking into account dependencies of installed
plugins
- update state waiting for jenkins availability
- change error catching in API crumb getting to not fail on 50x errors,
to be able to handle exception in state(s)
Change-Id: Ia62af392b30f92c7fdff87ea17fce2cf284d6818
diff --git a/_modules/jenkins_common.py b/_modules/jenkins_common.py
index 377a71f..225042f 100644
--- a/_modules/jenkins_common.py
+++ b/_modules/jenkins_common.py
@@ -111,10 +111,14 @@
tokenReq = requests.get("%s/crumbIssuer/api/json" % jenkins_url,
auth=(jenkins_user, jenkins_password) if jenkins_user else None)
if tokenReq.status_code == 200:
+ logger.debug("Got Jenkins API crumb: %s", tokenReq.json())
return tokenReq.json()
- elif tokenReq.status_code in [404, 401]:
+ elif tokenReq.status_code in [404, 401, 502, 503]:
# 404 means CSRF security is disabled, so api crumb is not necessary,
# 401 means unauthorized
+ # 50x means jenkins is unavailabe - fail in call_groovy_script, but
+ # not here, to handle exception in state
+ logger.debug("Got error %s: %s", str(tokenReq.status_code), tokenReq.reason)
return None
else:
raise Exception("Cannot obtain Jenkins API crumb. Status code: %s. Text: %s" %