简体   繁体   中英

get_job_info() giving item not found error : python-jenkins

I am using python-jenkins and 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

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.

Any help will be appreciated.

You might need to use the fullname key instead of the name key.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM