chnyda | 124ca04 | 2017-08-03 16:40:51 +0200 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | import jenkins |
| 4 | import salt.config |
| 5 | |
| 6 | def main(): |
| 7 | output = { "jenkins_plugins" : {} } |
| 8 | opts = salt.config.minion_config('/etc/salt/minion') |
| 9 | user = opts['jenkins']['user'] |
| 10 | password = opts['jenkins']['password'] |
| 11 | url = opts['jenkins']['url'] |
| 12 | |
| 13 | server = jenkins.Jenkins(url, username=user, password=password) |
| 14 | plugins = server.get_plugins(depth=1) |
| 15 | for plugin_name, plugin_dict in plugins.iteritems(): |
| 16 | output["jenkins_plugins"][plugin_name[0]] = {"version" : (plugin_dict["backupVersion"] or 0)} |
| 17 | return output |