blob: e0743d1da4df824639f4f211a096fb2337beccfd [file] [log] [blame]
#!/usr/bin/env python
try:
import jenkins
HAS_JENKINS = True
except ImportError:
HAS_JENKINS = False
import salt.config
def main():
if not HAS_JENKINS:
return {}
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