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

Duplicate jobs if baseurl contains consecutive slashes #655

Closed snewell closed 5 years ago

snewell commented 6 years ago
ISSUE TYPE
Jenkinsapi VERSION

0.3.6

Jenkins VERSION

2.133 and 2.121.1

SUMMARY

If the baseurl passed to jenkinsapi.jenkins.Jenkins contains consecutive slashes, two entries are returned for each job in the get_jobs method return. Every second job just has a URL for its name (I haven't examined the Job part of the results).

EXPECTED RESULTS

One copy of each job. From the example code below:

('gtest-clang', <jenkinsapi.job.Job gtest-clang>)
('gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
ACTUAL RESULTS

Multiple copies of each job. From the example code below:

('gtest-clang', <jenkinsapi.job.Job gtest-clang>)
('https:/localhost:8443/gtest/gtest-clang', <jenkinsapi.job.Job gtest-clang>)
('gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
('https:/localhost:8443/gtest/gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
USEFUL INFORMATION

This was observed with both https (self-signed certificate, so ssl_verify was used) and over http. In both cases, baseurl includes a folder (in the example below, "gtest").

$ python -vvvv
import jenkinsapi.jenkins
 j = jenkinsapi.jenkins.Jenkins('https://localhost:8443/job/gtest', 'snewell', <trimmed>, ssl_verify=False)            
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
>>> for i in j.get_jobs():
...     print(i)
... 
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
('gtest-clang', <jenkinsapi.job.Job gtest-clang>)
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
('gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
>>> j = jenkinsapi.jenkins.Jenkins('https://localhost:8443//job/gtest', 'snewell', <trimmed>, ssl_verify=False)
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
>>> for i in j.get_jobs():
...     print(i)
... 
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
('gtest-clang', <jenkinsapi.job.Job gtest-clang>)
('https:/localhost:8443/gtest/gtest-clang', <jenkinsapi.job.Job gtest-clang>)
/usr/lib64/python3.6/site-packages/urllib3/connectionpool.py:858: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
('gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
('https:/localhost:8443/gtest/gtest-gcc', <jenkinsapi.job.Job gtest-gcc>)
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 5 years ago

Closed due to inactivity