def _install_plugin(self, plugins_site, plugin, wget_options):
"""Download and install a given plugin."""
plugin_filename = "%s.hpi" % plugin
url = os.path.join(plugins_site, plugin_filename)
plugin_path = os.path.join(paths.PLUGINS, plugin_filename)
if not os.path.isfile(plugin_path):
hookenv.log("Installing plugin %s" % plugin_filename)
command = ("wget",) + wget_options + ("-q", "-O", "-", url)
plugin_data = subprocess.check_output(command)
host.write_file(
plugin_path, plugin_data, owner="jenkins", group="jenkins",
perms=0o0744)
else:
hookenv.log("Plugin %s already installed" % plugin_filename)
return plugin_path
评论列表
文章目录