This commit is contained in:
Fred Park 2017-04-18 18:46:57 -07:00
Родитель 0161169daa
Коммит b8d36a065a
1 изменённых файлов: 36 добавлений и 35 удалений

Просмотреть файл

@ -454,46 +454,47 @@ def pool_settings(config):
raise KeyError()
except KeyError:
input_data = None
# ssh settings
try:
ssh_username = conf['ssh']['username']
sshconf = conf['ssh']
ssh_username = _kv_read_checked(sshconf, 'username')
if util.is_none_or_empty(ssh_username):
raise KeyError()
except KeyError:
ssh_username = None
try:
ssh_expiry_days = conf['ssh']['expiry_days']
if ssh_expiry_days is not None and ssh_expiry_days <= 0:
raise KeyError()
except KeyError:
ssh_expiry_days = 30
ssh_public_key = _kv_read_checked(conf['ssh'], 'ssh_public_key')
if util.is_not_empty(ssh_public_key):
ssh_public_key = pathlib.Path(ssh_public_key)
ssh_public_key_data = _kv_read_checked(conf['ssh'], 'ssh_public_key_data')
ssh_private_key = _kv_read_checked(conf['ssh'], 'ssh_private_key')
if util.is_not_empty(ssh_private_key):
ssh_private_key = pathlib.Path(ssh_private_key)
if ssh_public_key is not None and util.is_not_empty(ssh_public_key_data):
raise ValueError('cannot specify both an SSH public key file and data')
if (ssh_public_key is None and
util.is_none_or_empty(ssh_public_key_data) and
ssh_private_key is not None):
raise ValueError(
'cannot specify an SSH private key with no public key specified')
try:
ssh_gen_docker_tunnel = conf['ssh']['generate_docker_tunnel_script']
except KeyError:
ssh_gen_docker_tunnel = False
try:
ssh_gen_file_path = conf['ssh']['generated_file_export_path']
if util.is_none_or_empty(ssh_gen_file_path):
raise KeyError()
except KeyError:
ssh_gen_file_path = '.'
try:
ssh_hpn = conf['ssh']['hpn_server_swap']
except KeyError:
ssh_hpn = False
ssh_expiry_days = None
ssh_public_key = None
ssh_public_key_data = None
ssh_private_key = None
ssh_gen_docker_tunnel = None
ssh_gen_file_path = None
ssh_hpn = None
else:
ssh_expiry_days = _kv_read(sshconf, 'expiry_days', 30)
if ssh_expiry_days <= 0:
ssh_expiry_days = 30
ssh_public_key = _kv_read_checked(sshconf, 'ssh_public_key')
if util.is_not_empty(ssh_public_key):
ssh_public_key = pathlib.Path(ssh_public_key)
ssh_public_key_data = _kv_read_checked(sshconf, 'ssh_public_key_data')
ssh_private_key = _kv_read_checked(sshconf, 'ssh_private_key')
if util.is_not_empty(ssh_private_key):
ssh_private_key = pathlib.Path(ssh_private_key)
if (ssh_public_key is not None and
util.is_not_empty(ssh_public_key_data)):
raise ValueError(
'cannot specify both an SSH public key file and data')
if (ssh_public_key is None and
util.is_none_or_empty(ssh_public_key_data) and
ssh_private_key is not None):
raise ValueError(
'cannot specify an SSH private key with no public '
'key specified')
ssh_gen_docker_tunnel = _kv_read(
sshconf, 'generate_docker_tunnel_script', False)
ssh_gen_file_path = _kv_read_checked(
sshconf, 'generated_file_export_path', '.')
ssh_hpn = _kv_read(sshconf, 'hpn_server_swap', False)
try:
gpu_driver = conf['gpu']['nvidia_driver']['source']
if util.is_none_or_empty(gpu_driver):