[英]get_job_info() giving item not found error : python-jenkins
I am using python-jenkins and python 3.6 我正在使用python-jenkins和python 3.6
Trying to get the information regarding the jobs in jenkins but facing an error. 试图获取有关詹金斯工作的信息,但遇到错误。
File "/usr/local/lib/python3.6/dist-packages/jenkins/ init .py", line 359, in get_job_info self._build_url(JOB_INFO, locals()) File "/usr/local/lib/python3.6/dist-packages/jenkins/ init .py", line 451, in jenkins_open raise NotFoundException('Requested item could not be found') jenkins.NotFoundException: Requested item could not be found 在get_job_info self._build_url(JOB_INFO,locals())中的文件“ /usr/local/lib/python3.6/dist-packages/jenkins/ init .py”,第359行,文件“ / usr / local / lib / python3。 6 / dist-packages / jenkins / init .py“,行451,在jenkins_open中引发NotFoundException('找不到请求的项')jenkins.NotFoundException:找不到请求的项
jobs = server.get_all_jobs()
for j in jobs:
jobName = j['name'] # get job name
print(jobName)
lastJobId = getLastJobId(session, jobName) # get last locally stored job of this name
print(lastJobId)
lastBuildNumber = server.get_job_info(jobName)
get_all_jobs() is working fine but get_job_info() is not working. get_all_jobs()工作正常,但get_job_info()无法工作。
Any help will be appreciated. 任何帮助将不胜感激。
You might need to use the fullname
key instead of the name
key. 您可能需要使用fullname
键而不是name
键。
jobName = j['fullname'] # get job name
There could be multiple jobs with the same job name, but in different folders/views. 可能有多个作业具有相同的作业名称,但位于不同的文件夹/视图中。 And fullname
will fully qualify a specific job. fullname
名将完全胜任特定工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.