ansible / mazer

Experimental Ansible Galaxy Content Manager
GNU General Public License v3.0
114 stars 18 forks source link

publish uses http regardless of galaxy server url #217

Closed alikins closed 5 years ago

alikins commented 5 years ago

Bug Report

A mazer publish command like:

mazer --server https://galaxy-dev.ansible.com publish --api-key "${GALAXY_DEV_TOKEN}" releases/alikins-collection_inspect-0.0.22.tar.gz

will make the publish REST API call (POST /api/v2/collections) via http to port 80 regardless of the http/https scheme in the server url.

For galaxy-dev.ansible.com, http requests to port 80 just get redirected to https://galaxy-dev.ansible.com with a 302 Found response.

The http connection used by publish() is different than the connection used elsewhere, so this only affects publish.

Proposed fix:

quickfix: Choose correct http/https connection classes based on server url scheme

better fix: Port the publish() and all of rest_api connection handling to use requests http module instead of the ansible 'urls.py' based code used in most of rest_api.py and 'httplib/http_client' code used in publish

MAZER VERSION
name = mazer
version = 0.4.0
config_file = /home/adrian/.ansible/mazer.yml
uname = Linux, newswoop, 5.0.5-200.fc29.x86_64, #1 SMP Wed Mar 27 20:58:04 UTC 2019, x86_64
executable_location = /home/adrian/venvs/mazer040test/bin/mazer
python_version = 3.6.8 (default, Jan 27 2019, 09:00:23) [GCC 8.2.1 20181215 (Red Hat 8.2.1-6)]
python_executable = /home/adrian/venvs/mazer040test/bin/python
CONFIGURATION
EXPECTED RESULTS

Publish works.

ACTUAL RESULTS

Publish fails because of the 302 Found response.