testlib.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:lago-workshop 作者: lago-project 项目源码 文件源码
def create_credentials_on_jenkins(jenkins_api, _uuid):
    cred_exist = has_credentials_on_jenkins(jenkins_api, _uuid)
    if cred_exist:
        return cred_exist

    headers = {'Content-Type': 'application/x-www-form-urlencoded'}
    payload = '''json={
        "": "0",
        "credentials": {
            "scope": "GLOBAL",
            "id": "%s",
            "username": "root",
            "password": "123456",
            "description": "test",
            "$class": "com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl"
        }
    }''' % _uuid
    url = jenkins_api._build_url(
        'credentials/store/system/domain/_/createCredentials'
    )
    request = Request(url, payload, headers)
    jenkins_api.jenkins_open(request)

    return has_credentials_on_jenkins(jenkins_api, _uuid)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号