Fix job templates and grain
Change-Id: I50f3cfc78a57d9f7277954247e57c32434a502d1
diff --git a/_grains/jenkins_plugins.py b/_grains/jenkins_plugins.py
new file mode 100644
index 0000000..c13cb8b
--- /dev/null
+++ b/_grains/jenkins_plugins.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python
+
+import jenkins
+import salt.config
+
+def main():
+ output = { "jenkins_plugins" : {} }
+ opts = salt.config.minion_config('/etc/salt/minion')
+ user = opts['jenkins']['user']
+ password = opts['jenkins']['password']
+ url = opts['jenkins']['url']
+
+ server = jenkins.Jenkins(url, username=user, password=password)
+ plugins = server.get_plugins(depth=1)
+ for plugin_name, plugin_dict in plugins.iteritems():
+ output["jenkins_plugins"][plugin_name[0]] = {"version" : (plugin_dict["backupVersion"] or 0)}
+ return output