Open gaoyanyu opened 4 years ago
run result is below: File "/root/PycharmProjects/test/test.py", line 52, in create_repo_credential_in_jenkins credens = Credentials(creden_baseurl, jenkins_obj) File "/root/PycharmProjects/test/venv/lib/python3.7/site-packages/jenkinsapi/credentials.py", line 30, in init JenkinsBase.init(self, baseurl) File "/root/PycharmProjects/test/venv/lib/python3.7/site-packages/jenkinsapi/jenkinsbase.py", line 38, in init self.poll() File "/root/PycharmProjects/test/venv/lib/python3.7/site-packages/jenkinsapi/jenkinsbase.py", line 60, in poll data = self._poll(tree=tree) File "/root/PycharmProjects/test/venv/lib/python3.7/site-packages/jenkinsapi/credentials.py", line 38, in _poll for cred_id, cred_dict in credentials.items(): AttributeError: 'list' object has no attribute 'items'
and I got the parameter credentials in my run process: 'credentials': [{'description': 'test for jenkins', 'displayName': '123root/** (test for jenkins)', 'fingerprint': None, 'fullName': 'system//dockerhub', 'id': 'dockerhub', 'typeName': 'Username with password'}, {'description': 'test for jenkins', 'displayName': '123root/** (test for jenkins)', 'fingerprint': None, 'fullName': 'system//dockerhub1', 'id': 'dockerhub1', 'typeName': 'Username with password'}, {'description': 'test for jenkins', 'displayName': '123root/** (test for jenkins)', 'fingerprint': None, 'fullName': 'system/_/dockerhub2', 'id': 'dockerhub2', 'typeName': 'Username with password'}]
parameter credentials is located in jenkinsapi/credentials.py, class Credentials's _poll function, which looks like below:
`def _poll(self, tree=None): url = self.python_api_url(self.baseurl) + '?depth=2' data = self.get_data(url, tree=tree) credentials = data['credentials'] for cred_id, cred_dict in credentials.items(): cred_dict['credential_id'] = cred_id credentials[cred_id] = self._make_credential(cred_dict)
return data`
Anyone meet this situation? please...
ISSUE TYPE
Jenkinsapi VERSION
0.3.11
Jenkins VERSION
Jenkins ver. 2.204.5
SUMMARY
when I create username/password type credential, just to initialize class Credentials which is in jenkinsapi/credentials.py, it throw out "AttributeError: 'list' object has no attribute 'items'".
EXPECTED RESULTS
create credential success.
ACTUAL RESULTS
fail to create it
USEFUL INFORMATION