1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-03 18:16:17 +01:00

Allow to configure a ssh key in the config

We support a global key and a key specific to an apiurl.
This commit is contained in:
mls 2022-04-26 13:55:54 +02:00 committed by Michael Schroeder
parent 119ffd6027
commit e47a265388
No known key found for this signature in database
GPG Key ID: 6AEFFADDED5BE4F9

View File

@ -112,6 +112,7 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
'user': None,
'pass': None,
'passx': None,
'sshkey': None,
'packagecachedir': '/var/tmp/osbuild-packagecache',
'su-wrapper': 'sudo',
@ -222,7 +223,7 @@ boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'tr
integer_opts = ['build-jobs']
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
'downloadurl']
'downloadurl', 'sshkey']
new_conf_template = """
[general]
@ -980,7 +981,7 @@ def get_config(override_conffile=None,
'http_headers': http_headers}
api_host_options[apiurl] = APIHostOptionsEntry(entry)
optional = ('realname', 'email', 'sslcertck', 'cafile', 'capath')
optional = ('realname', 'email', 'sslcertck', 'cafile', 'capath', 'sshkey')
for key in optional:
if cp.has_option(url, key):
if key == 'sslcertck':
@ -1011,6 +1012,9 @@ def get_config(override_conffile=None,
else:
api_host_options[apiurl]['downloadurl'] = None
if api_host_options[apiurl]['sshkey'] is None:
api_host_options[apiurl]['sshkey'] = config['sshkey']
# add the auth data we collected to the config dict
config['api_host_options'] = api_host_options
config['apiurl_aliases'] = aliases