當前位置: 首頁>>代碼示例>>Python>>正文


Python Jenkins.enable方法代碼示例

本文整理匯總了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)
開發者ID:xiaomatech,項目名稱:ops,代碼行數:84,代碼來源:jenkins.py


注:本文中的autojenkins.Jenkins.enable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。