← Back to team overview

python-jenkins-developers team mailing list archive

[Bug 1417137] Re: While using jenkins API, getting a failure on reconfig_job

 

I am slo facing the issue while working with reconfig_job.Please note
that I am able to get all the other information after loggied in to the
server using the script. Python-jenkins fails to run reconfig_job only
with the modified xml and job name as parametre.

Traceback (most recent call last):
  File "get_build.py", line 47, in <module>
    server.reconfig_job(job1,'jenkins.config_xml')	
  File "/usr/local/lib/python2.7/dist-packages/jenkins/__init__.py", line 1019, in reconfig_job
    DEFAULT_HEADERS))
  File "/usr/local/lib/python2.7/dist-packages/jenkins/__init__.py", line 448, in jenkins_open
    e.code, e.msg)
jenkins.JenkinsException: Error in request. Possibly authentication failed [500]: Server Error

-- 
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