pycontribs / jenkinsapi

A Python API for accessing resources and configuring Hudson & Jenkins continuous-integration servers
http://pypi.python.org/pypi/jenkinsapi
MIT License
859 stars 485 forks source link

Changing to *args and **kwargs in requester init. Fixing TypeError bug #640

Closed hokadiri closed 6 years ago

hokadiri commented 6 years ago

The current krb_requester has a bug that spits out TypeError:

Sample code to reproduce


from jenkinsapi.utils.krb_requester import KrbRequester
import requests_kerberos
from jenkinsapi.jenkins import Jenkins
jenkins_url = <some_jenkins_url>
jobname = 'somejob'
requester = KrbRequester(baseurl=jenkins_url, mutual_auth=requests_kerberos.OPTIONAL)
myjenkins = Jenkins(jenkins_url, requester=requester)
job = myjenkins.get_job(jobname)
last_stable_build = job.get_last_stable_build()
print('last stable build slave is:')
print last_stable_build.get_slave()```

Error:
```Traceback (most recent call last):
  File "krb_test.py", line 9, in <module>
    requester = KrbRequester(baseurl='someurl', mutual_auth=requests_kerberos.OPTIONAL)
  File "/Users/foobar/Library/Python/2.7/lib/python/site-packages/jenkinsapi/utils/krb_requester.py", line 25, in __init__
    super(KrbRequester, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'mutual_auth'```

This is caused by the `mutual_auth` argument in KrbRequester class which gets passed down to the parent Requester class.

This PR fixes that issue.
codecov[bot] commented 6 years ago

Codecov Report

Merging #640 into master will decrease coverage by 0.02%. The diff coverage is 83.33%.

@@            Coverage Diff             @@
##           master     #640      +/-   ##
==========================================
- Coverage   78.74%   78.72%   -0.03%     
==========================================
  Files          34       34              
  Lines        2574     2580       +6     
==========================================
+ Hits         2027     2031       +4     
- Misses        547      549       +2
hokadiri commented 6 years ago

Could I get this change merged pls. ATTN: @lechat :) Thanks