本文整理汇总了Python中autojenkins.Jenkins.enable方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.enable方法的具体用法?Python Jenkins.enable怎么用?Python Jenkins.enable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autojenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.enable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import enable [as 别名]
class jenkins:
def __init__(self):
self.jenkins_url = jenkins_config.get('url')
self.user = jenkins_config.get('user')
self.password = jenkins_config.get('password')
if self.jenkins_url is not None:
try:
self.jenkins = Jenkins(
self.jenkins_url, auth=(self.user, self.password))
except Exception as e:
log_error(e)
def help(self, req, resp):
h = '''
jenkins CI
ops jenkins create_copy -j job -t template -r repo -b branch -p package
ops jenkins result -j job
ops jenkins info -t template
ops jenkins build -j job
ops jenkins enable -j job
ops jenkins disable -j job
ops jenkins delete -j job
'''
return h
def result(self, req, resp):
job = req.get_param(name='j')
if job is None:
return '-j(job) need'
return self.jenkins.last_result(job)['result']
def info(self, req, resp):
template = req.get_param(name='t')
if template is None:
return '-t(template) need'
return self.jenkins.get_config_xml(template)
def create_copy(self, req, resp):
job = req.get_param(name='j')
template = req.get_param(name='t')
repo = req.get_param(name='r')
branch = req.get_param(name='b')
package = req.get_param(name='p')
if job is None:
return '-j(job) need'
if template is None:
return '-t(template) need'
if repo is None:
return '-r(repo) need'
if branch is None:
return '-b(branch) need'
if package is None:
return '-p(package) need'
return self.jenkins.create_copy(
job, template, repo=repo, branch=branch, package=package)
def build(self, req, resp):
job = req.get_param(name='j')
if job is None:
return '-j(job) need'
return self.jenkins.build(job)
def enable(self, req, resp):
job = req.get_param(name='j')
if job is None:
return '-j(job) need'
return self.jenkins.enable(job)
def disable(self, req, resp):
job = req.get_param(name='j')
if job is None:
return '-j(job) need'
return self.jenkins.disable(job)
def delete(self, req, resp):
job = req.get_param(name='j')
if job is None:
return '-j(job) need'
return self.jenkins.delete(job)