mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-11 17:54:06 +02: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:
@@ -112,6 +112,7 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
|
|||||||
'user': None,
|
'user': None,
|
||||||
'pass': None,
|
'pass': None,
|
||||||
'passx': None,
|
'passx': None,
|
||||||
|
'sshkey': None,
|
||||||
'packagecachedir': '/var/tmp/osbuild-packagecache',
|
'packagecachedir': '/var/tmp/osbuild-packagecache',
|
||||||
'su-wrapper': 'sudo',
|
'su-wrapper': 'sudo',
|
||||||
|
|
||||||
@@ -222,7 +223,7 @@ boolean_opts = ['debug', 'do_package_tracking', 'http_debug', 'post_mortem', 'tr
|
|||||||
integer_opts = ['build-jobs']
|
integer_opts = ['build-jobs']
|
||||||
|
|
||||||
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
|
api_host_options = ['user', 'pass', 'passx', 'aliases', 'http_headers', 'realname', 'email', 'sslcertck', 'cafile', 'capath', 'trusted_prj',
|
||||||
'downloadurl']
|
'downloadurl', 'sshkey']
|
||||||
|
|
||||||
new_conf_template = """
|
new_conf_template = """
|
||||||
[general]
|
[general]
|
||||||
@@ -980,7 +981,7 @@ def get_config(override_conffile=None,
|
|||||||
'http_headers': http_headers}
|
'http_headers': http_headers}
|
||||||
api_host_options[apiurl] = APIHostOptionsEntry(entry)
|
api_host_options[apiurl] = APIHostOptionsEntry(entry)
|
||||||
|
|
||||||
optional = ('realname', 'email', 'sslcertck', 'cafile', 'capath')
|
optional = ('realname', 'email', 'sslcertck', 'cafile', 'capath', 'sshkey')
|
||||||
for key in optional:
|
for key in optional:
|
||||||
if cp.has_option(url, key):
|
if cp.has_option(url, key):
|
||||||
if key == 'sslcertck':
|
if key == 'sslcertck':
|
||||||
@@ -1011,6 +1012,9 @@ def get_config(override_conffile=None,
|
|||||||
else:
|
else:
|
||||||
api_host_options[apiurl]['downloadurl'] = None
|
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
|
# add the auth data we collected to the config dict
|
||||||
config['api_host_options'] = api_host_options
|
config['api_host_options'] = api_host_options
|
||||||
config['apiurl_aliases'] = aliases
|
config['apiurl_aliases'] = aliases
|
||||||
|
Reference in New Issue
Block a user