jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

jenkinsapi.custom_exceptions.UnknownJob in 0.3.11

Open PierreMagna opened this issue 4 years ago • 4 comments

ISSUE TYPE
  • Bug Report
Jenkinsapi VERSION

0.3.11

Jenkins VERSION
SUMMARY

jobs are not anymore found. This was working with the release 0.3.6

EXPECTED RESULTS

We have a smal program to catch information from our Jenkins :

Import jenkinsapi from jenkinsapi.jenkins import Jenkins

J=Jenkins('http://tramsjen1.magna.global:8080/job/Platform/job/SwCompTst/Job/StaticTst/Job/CBasedTst/',User,'PassWord') J.keys()

it returns :

['http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'http:/http:/tramsjen1.magna.global/job/job/job/job/job', 'AutoUpdate/NightlyCheck', 'AutoUpdate/NightlyCheck_Asap2Files', 'AutoUpdate/NightlyCheck_BusAdpr', 'AutoUpdate/NightlyCheck_CustCpt', 'AutoUpdate/NightlyCheck_DiagcMgr', 'AutoUpdate/NightlyCheck_FltMgr', 'AutoUpdate/NightlyCheck_Imob', 'AutoUpdate/NightlyCheck_MagnaBswGen2', 'AutoUpdate/NightlyCheck_SftyIgbtMgr', 'AutoUpdate/NightlyCheck_SftyMcuMonrLvl3', 'AutoUpdate/NightlyCheck_SftyStrtUpLvHvFct', 'AutoUpdate/NightlyCheck_SftySysProtnFast', 'CodeProver/CodeProverBusAdpr', 'CodeProver/CodeProverCustCpt', 'CodeProver/CodeProverDbgLed', 'CodeProver/CodeProverDiagcMgr', 'CodeProver/CodeProverDsadcCal', 'CodeProver/CodeProverEdi200xAs', 'CodeProver/CodeProverEdiStM', 'CodeProver/CodeProverEol', 'CodeProver/CodeProverFltColl', 'CodeProver/CodeProverFltMgr', 'CodeProver/CodeProverGpt12', 'CodeProver/CodeProverHwTst', 'CodeProver/CodeProverImob', 'CodeProver/CodeProverIntegration', 'CodeProver/CodeProverIoHwAb', 'CodeProver/CodeProverIoHwAb_Adc', 'CodeProver/CodeProverIoHwAb_Dma', 'CodeProver/CodeProverIoHwAb_HVLD', 'CodeProver/CodeProverIoHwAb_I', 'CodeProver/CodeProverIoHwAb_Icu', 'CodeProver/CodeProverIoHwAb_Pos', 'CodeProver/CodeProverIoHwAb_Pwm', 'CodeProver/CodeProverIoHwAb_T', 'CodeProver/CodeProverIoHwAb_U', 'CodeProver/CodeProverIoHwAb_UART', 'CodeProver/CodeProverIoHwAb_WhlSpd', 'CodeProver/CodeProverMagnaBswGen2', 'CodeProver/CodeProverPECGlb', 'CodeProver/CodeProverPIC', 'CodeProver/CodeProverPwm_53_Gtm', 'CodeProver/CodeProverRslvStM', 'CodeProver/CodeProverScu', 'CodeProver/CodeProverSftyBusAdpr', 'CodeProver/CodeProverSftyIgbtMgr', 'CodeProver/CodeProverSftyIoHwAb', 'CodeProver/CodeProverSftyIoHwAb_T_EM', 'CodeProver/CodeProverSftyMcuMonrLvl3', 'CodeProver/CodeProverSftySharedMem', 'CodeProver/CodeProverSftyStrtUpLvHvFct', 'CodeProver/CodeProverSftySysProtnFast', 'CodeProver/CodeProverStrtUp', 'CodeProver/CodeProverTimer', 'CodeProver/CodeProverUcb', 'CodeProver/CodeProverVADC', 'CodeProver/UploadMetricToServer']

all the job located here http://tramsjen1.magna.global:8080/job/Platform/job/SwCompTst/Job/StaticTst/Job/CBasedTst/ are not found

here a screnshot : image

if we try to get a job :

job = J['BugFinderBusAdpr'] Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\jenkinsapi\jenkins.py", line 269, in getitem return self.jobs[jobname] File "C:\Python27\lib\site-packages\jenkinsapi\jobs.py", line 89, in getitem raise UnknownJob(job_name) jenkinsapi.custom_exceptions.UnknownJob: 'BugFinderBusAdpr'

This script was working corretly with the release 0.3.6

could you help me ? Thanks Best Regards Pierre

PierreMagna avatar Mar 02 '20 13:03 PierreMagna

We had the same problem when using 0.3.11 version of jenkinsapi. Reverting to 0.3.9 removed the problem.

Right now we had to fix the version of jenkinsapi to 0.3.9.

theold190 avatar May 04 '20 13:05 theold190

Facing the same issue but I had the same version 0.3.11 when things were working for me now suddenly its not working the only difference is that in my case is that I changed the jenkins servers but the pipeline remains same and I am able to find my deployed pipeline in .keys() output

kmoza avatar Oct 12 '21 09:10 kmoza

+1 to this issue of not being able to find the job on 0.3.11. Using 0.3.9 resolved that issue.

cpagravel avatar Nov 02 '21 09:11 cpagravel

I had the same problem when I redeployed to another server. The workaround of backing out to v3.9 worked for me then. That was over a year ago. Now, I've redeployed again and backing out to 3.9 does not work. I really don't understand what's going on. It appears the jobs method is a property that is dynamically populated. I don't know much about @property, but reading the code isn't straight forward for me. Not familiar with this.

I saw a post somewhere that a workaround was this:

self.jobs._data = self.poll().get('jobs', [])

As it turns out, that, indeed populates the jobs._data, but not in a format that would accept a jobname as an index (which our code was doing before). Worse, the code seems to be referencing job_container._data. Both exist when I look in a debugger.

psbrightly avatar Feb 08 '22 03:02 psbrightly