저는 Jenkins에서 Python과 jenkinsapi를 사용하여 여러 개의 중첩 된 뷰를 만들려고합니다. 내가 인증을 해제하고 '사람은 무엇이든 할 수있는'허용하는 경우jenkinsapi를 사용하여 Jenkins에서 뷰를 만들지 못했습니다.
jenkins_url = "http://127.0.0.1:8080/"
api = Jenkins(jenkins_url, 'jenkins_admin', 'jenkins_password')
logger.info('view_name is %s' %view_name)
new_view = api.views.create(view_name, Views.NESTED_VIEW)
모든 것이 잘 진행하지만 사용자/암호 인증 실패 :
코드는 다음과 같습니다. 우리는 Active Directory를 사용하고 있으며 사용자에게 관리 권한이 있습니다.
실패는 다음과 같습니다
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
DEBUG:requests.packages.urllib3.connectionpool:"GET /api/python **HTTP/1.1" 200 3290**
INFO:root: view_name is 9.8
INFO:jenkinsapi.views:Creating "hudson.plugins.nested_view.NestedView" view "9.8"
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
DEBUG:requests.packages.urllib3.connectionpool:"POST /createView **HTTP/1.1" 302 0**
DEBUG:requests.packages.urllib3.connectionpool:"GET /view/9.8/configure **HTTP/1.1" 401 1445**
Traceback (most recent call last):
File "JenkinsNewVersionJobsItems.py", line 46, in <module>
top_view = NewVersionJobsItemsUtils.createView(short_version, api, NESTED)
File "/tmp/NewVersionJobsItemsUtils.py", line 35, in createView
new_view = parent_view.views.create(view_name, Views.NESTED_VIEW)
File "build/bdist.linux-x86_64/egg/jenkinsapi/views.py", line 103, in create
File "build/bdist.linux-x86_64/egg/jenkinsapi/utils/requester.py", line 117, in post_and_confirm_status
jenkinsapi.custom_exceptions.JenkinsAPIException: Operation failed. url=http://127.0.0.1/view/9.8/configure, data={'json': '{"name": "9.8", "mode": "hudson.plugins.nested_view.NestedView"}', 'name': '9.8', 'Submit': 'OK', 'mode': 'hudson.plugins.nested_view.NestedView'}, headers={'Content-Type': 'application/x-www-form-urlencoded'}, status=401, text=<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>**Error 401 Invalid password/token for user: jenkins**</title>
</head>
<body><h2>HTTP ERROR 401</h2>
내가 인증이 뷰가 작성된 통과하고 내가 잘못된 암호 오류로 인해 실패보다, 구성 페이지 (HTTP 302) 리디렉션 된 참조하십시오.
실행 후 새로 만든보기를 볼 수 있습니다. 스크립트를 다시 실행하면보기가 발견되고 다음보기가 만들어지고 같은 오류로 다시 실패합니다. 문제는 그러한 열 가지의 견해가 필요하다는 것입니다.
아무도 도와 주거나 문제를 지적 할 수 있습니까? 미리 감사드립니다.
안녕하십니까, 여기의 젠 키나 피 관리자입니다. Github (https://github.com/salimfadhley/jenkinsapi)에서 문제를 열어 보시겠습니까? 톱뷰를 생성하는 실제 코드뿐만 아니라 실제 코드도 제공하십시오. 나는이 문제를 재현 할 수 없다. – LeChat