python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00464
[Bug 1417137] Re: While using jenkins API, getting a failure on reconfig_job
It seems that reconfig_job() only works on Freestyle projects. If the
project is a Maven project, Multi-configuration project, or a Multi-job
project, (I haven't tested the rest), then the reconfig_job() call will
fail with the HTTP 500 error.
Jenkins==2.46.3
python-jenkins==0.4.15
python==3.5.2
--
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1417137
Title:
While using jenkins API, getting a failure on reconfig_job
Status in Python Jenkins:
New
Bug description:
I am using jenkins rest API to recurse through jobs and then
reconfigure this one. All methods work except one. He's is my code :
def get_server_instance():
jenkins_url = 'xxxx'
#server = Jenkins(jenkins_url, username = '', password = '')
# Connect to instance - username and password are optional
server = jenkins.Jenkins(jenkins_url, username = '', password = '')
return server
def get_job_details():
# Refer Example #1 for definition of function 'get_server_instance'
server = get_server_instance()
for job in server.get_jobs_list():
if job == "GithubMigration":
configuration = server.get_job(job).get_config().encode('utf-8')
#server.reconfig_job(job, configuration)
if server.has_job("GithubMigration"):
server.reconfig_job('GithubMigration', config_xml)
It gets my configuration.xml, find the job as well but fails on server.reconfig_job('GithubMigration', config_xml) with the error , AttributeError: 'Jenkins' object has no attribute 'reconfig_job'
when obviously this functions exists in the jenkins rest API and yes
I'm importing jenkins, from jenkinsapi.jenkins import Jenkins .
Edit 1 - I uninstalled Jenkinsapi and have only python-jenkins module
and now it fails even before saying
AttributeError: 'module' object has no attribute 'Jenkins' for line :
AttributeError: 'module' object has no attribute 'Jenkins'
Any ideas?
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1417137/+subscriptions
References