Commit 9c7042cf authored by Jens Langhammer's avatar Jens Langhammer

fix nexus upload not not taking auth param

parent 47f34bc0
pyazo (1.9.5) stable; urgency=medium
* fix redis package being too old
* fix non-applicable config in default config
-- Jens Langhammer <> Tue, 05 Mar 2019 12:38:07 +0000
pyazo (1.9.3) stable; urgency=medium
* rewrite debian packaging
"""Pyazo nexus_upload management command"""
from getpass import getpass
"""pyazo nexus_upload management command"""
from base64 import b64decode
import requests
from import BaseCommand
......@@ -24,9 +24,9 @@ class Command(BaseCommand):
help='Nexus root URL',
help='Username to use for Nexus upload',
help='base64-encoded string of username:password',
......@@ -37,29 +37,21 @@ class Command(BaseCommand):
help=('Method used for uploading files to nexus. '
'Apt repositories use post, Helm uses put.'),
help=("Password to use for Nexus upload. "
"If parameter not given, we'll interactively ask"))
# Positional arguments
parser.add_argument('file', nargs='+', type=str)
def handle(self, *args, **options):
"""Upload debian package to nexus repository"""
if options.get('password') is None:
options['password'] = getpass()
auth = tuple(b64decode(options.get('auth')).decode('utf-8').split(':', 1))
responses = {}
url = 'https://%(url)s/repository/%(repo)s//' % options
url = 'https://%(url)s/repository/%(repo)s/' % options
method = options.get('method')
exit_code = 0
for file in options.get('file'):
if method == 'post':
responses[file] =, data=open(file, mode='rb'),
auth=(options.get('user'), options.get('password')))
responses[file] =, data=open(file, mode='rb'), auth=auth)
responses[file] = requests.put(url+file, data=open(file, mode='rb'),
auth=(options.get('user'), options.get('password')))
responses[file] = requests.put(url+file, data=open(file, mode='rb'), auth=auth)
self.stdout.write('Upload results:\n')
sep = '-' * 60
self.stdout.write('%s\n' % sep)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment