Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def read_config(config_path=default_config_path):
[https://artifactory-instance.local/artifactory]
username = foo
password = @dmin
verify = false
verify = true/false or ~/path-to-ca-chain
cert = ~/path-to-cert

config-path - specifies where to read the config from
Expand All @@ -80,7 +80,14 @@ def read_config(config_path=default_config_path):
for section in p.sections():
username = p.get(section, 'username') if p.has_option(section, 'username') else None
password = p.get(section, 'password') if p.has_option(section, 'password') else None
verify = p.getboolean(section, 'verify') if p.has_option(section, 'verify') else True
if p.has_option(section, 'verify'):
try:
verify = p.getboolean(section, 'verify')
except ValueError:
# Verify CA cert path may contain '~'
verify = os.path.expanduser(p.get(section, 'verify'))
else:
verify = True
cert = p.get(section, 'cert') if p.has_option(section, 'cert') else None

result[section] = {'username': username,
Expand Down