/usr/lib/python2.7/dist-packages/jenkinsapi/plugins.py is in python-jenkinsapi 0.2.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | """
jenkinsapi plugins
"""
import logging
from jenkinsapi.jenkinsbase import JenkinsBase
from jenkinsapi.plugin import Plugin
log = logging.getLogger(__name__)
class Plugins(JenkinsBase):
"""
Plugins class for jenkinsapi
"""
def __init__(self, url, jenkins_obj):
self.jenkins_obj = jenkins_obj
JenkinsBase.__init__(self, url)
# print 'DEBUG: Plugins._data=', self._data
def get_jenkins_obj(self):
return self.jenkins_obj
def _poll(self):
return self.get_data(self.baseurl)
def keys(self):
return self.get_plugins_dict().keys()
def iteritems(self):
return self._get_plugins()
def values(self):
return [a[1] for a in self.iteritems()]
def _get_plugins(self):
if not 'plugins' in self._data:
pass
else:
for p_dict in self._data["plugins"]:
yield p_dict["shortName"], Plugin(p_dict)
def get_plugins_dict(self):
return dict(self._get_plugins())
def __len__(self):
return len(self.get_plugins_dict().keys())
def __getitem__(self, plugin_name):
return self.get_plugins_dict().get(plugin_name, None)
def __contains__(self, plugin_name):
"""
True if plugin_name is the name of a defined plugin
"""
return plugin_name in self.keys()
def __str__(self):
plugins = [plugin["shortName"] for plugin in self._data.get("plugins", [])]
return str(sorted(plugins))
|