本文整理汇总了Python中autojenkins.Jenkins.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Jenkins.delete方法的具体用法?Python Jenkins.delete怎么用?Python Jenkins.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类autojenkins.Jenkins
的用法示例。
在下文中一共展示了Jenkins.delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_jobs
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
def delete_jobs(host, jobnames, options):
"""
Delete existing jobs.
"""
jenkins = Jenkins(host, auth=get_auth(options))
for jobname in jobnames:
print ("Deleting job '{0}'".format(jobname))
response = jenkins.delete(jobname)
print(response.status_code)
示例2: delete_job
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
def delete_job(host, jobname):
"""
Delete an existing job
"""
print ("Deleting job '{0}'".format(jobname))
jenkins = Jenkins(host)
response = jenkins.delete(jobname)
print('Status: {0}'.format(response.status_code))
示例3: delete_jobs
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
def delete_jobs(host, jobnames):
"""
Delete existing jobs.
"""
for jobname in jobnames:
print ("Deleting job '{0}'".format(jobname))
jenkins = Jenkins(host)
response = jenkins.delete(jobname)
print(response.status_code)
示例4: delete_jobs
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
def delete_jobs(host, jobnames, options):
"""
Delete existing jobs.
"""
jenkins = Jenkins(host, proxies=get_proxy(options), auth=get_auth(options))
for jobname in jobnames:
print ("Deleting job '{0}'".format(jobname))
try:
response = jenkins.delete(jobname)
if response.status_code == 200:
print("Job '%s' deleted" % jobname)
except jobs.JobInexistent as error:
print("Error:", error.msg)
print("Error:", error.msg)
except (jobs.HttpForbidden, jobs.HttpUnauthorized):
pass
示例5: sorted
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
datestamp = dateflag.groups()[0]
#print "Jobname=%-90s Date=%-20s Status=%-10s" % ( jobname, datestamp, jobstatus )
if jobHash.has_key(datestamp):
jobHash[datestamp].append(jobname)
else:
jobHash[datestamp] = []
jobHash[datestamp].append(jobname)
for key in sorted(jobHash.keys()):
if cmp(key, "2014-11-08") == 1:
continue
print "Date=%-20s " % key
for job in jobHash[key]:
print " %s" % job
print j.job_url( job )
j.delete( job )
print "Size=",len(jobs)
'''
for job, color in jobs:
if color in ['red', 'blue', 'yellow']:
full_info = j.job_info(job)
last_build = j.last_build_info(job)
when = datetime.fromtimestamp(last_build['timestamp'] / 1000)
else:
when = '(unknown)'
print("{0!s:<19} {1:<6} {2}".format(when, color, job))
示例6: Jenkins
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [as 别名]
from autojenkins import Jenkins
if __name__ == '__main__':
j = Jenkins('http://jenkins.pe.local')
# dir = path.dirname(path.dirname(__file__))
# config_file = path.join(dir, 'templates/story-dev-job.xml')
response = j.delete('aaa')
response = j.create_copy('aaa', 'template',
repo='mbf-warehouse-screens',
branch='us544_login',
package='warehouse_screens')
print(response.status_code)
if response.status_code == 200:
j.build('aaa')
示例7: __init__
# 需要导入模块: from autojenkins import Jenkins [as 别名]
# 或者: from autojenkins.Jenkins import delete [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)