mirror of
https://github.com/trailofbits/algo.git
synced 2025-07-14 01:32:55 +02:00
Improved error handling when vpn host not created
This commit is contained in:
parent
12e75333d6
commit
ca3230c0de
4 changed files with 27 additions and 14 deletions
|
@ -186,15 +186,18 @@ class PlaybookCLI(CLI):
|
|||
|
||||
display.display(taskmsg)
|
||||
|
||||
host = inventory.groups['vpn-host'].hosts[0].name
|
||||
host_vars = variable_manager.get_vars()['hostvars'][host]
|
||||
return {
|
||||
'CA_password': host_vars.get('CA_password'),
|
||||
'p12_export_password': host_vars.get('p12_export_password'),
|
||||
'algo_server_name': host_vars.get('server_name'),
|
||||
'ipv6_support': host_vars.get('ipv6_support'),
|
||||
'local_service_ip': host_vars.get('ansible_lo') and
|
||||
host_vars.get('ansible_lo').get('ipv4_secondaries') and
|
||||
host_vars.get('ansible_lo').get('ipv4_secondaries')[0]['address'],
|
||||
'ansible_ssh_host': host,
|
||||
}
|
||||
if 'vpn-host' not in inventory.groups:
|
||||
raise ValueError('no_vpn_host')
|
||||
else:
|
||||
host = inventory.groups['vpn-host'].hosts[0].name
|
||||
host_vars = variable_manager.get_vars()['hostvars'][host]
|
||||
return {
|
||||
'CA_password': host_vars.get('CA_password'),
|
||||
'p12_export_password': host_vars.get('p12_export_password'),
|
||||
'algo_server_name': host_vars.get('server_name'),
|
||||
'ipv6_support': host_vars.get('ipv6_support'),
|
||||
'local_service_ip': host_vars.get('ansible_lo') and
|
||||
host_vars.get('ansible_lo').get('ipv4_secondaries') and
|
||||
host_vars.get('ansible_lo').get('ipv4_secondaries')[0]['address'],
|
||||
'ansible_ssh_host': host,
|
||||
}
|
||||
|
|
|
@ -40,7 +40,10 @@ async def playbook_get_handler(request):
|
|||
return web.json_response({'status': None})
|
||||
|
||||
if task_future.done():
|
||||
return web.json_response({'status': 'done', 'program': task_program, 'result': task_future.result()})
|
||||
try:
|
||||
return web.json_response({'status': 'done', 'program': task_program, 'result': task_future.result()})
|
||||
except ValueError as e:
|
||||
return web.json_response({'status': 'error', 'program': task_program, 'result': str(e)})
|
||||
elif task_future.cancelled():
|
||||
return web.json_response({'status': 'cancelled', 'program': task_program})
|
||||
else:
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
v-bind:disabled="ui_loading_check || ui_token_from_env"
|
||||
v-model="scaleway_token"
|
||||
/>
|
||||
<p v-if="ui_token_from_env">Token was read from the environment</p>
|
||||
<div v-if="ui_token_from_env" class="form-text alert alert-success" role="alert">
|
||||
Token was read from the environment variable
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
v-bind:disabled="ui_loading_check"
|
||||
v-model="vultr_config"
|
||||
/>
|
||||
<div v-if="ui_token_from_env" class="form-text alert alert-success" role="alert">
|
||||
Configuration file was found in your system. You still can change the path to it
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -47,6 +50,7 @@ module.exports = {
|
|||
vultr_config: null,
|
||||
region: null,
|
||||
// helper variables
|
||||
ui_token_from_env: false,
|
||||
ui_loading_check: false,
|
||||
ui_loading_regions: false,
|
||||
ui_region_options: []
|
||||
|
@ -69,6 +73,7 @@ module.exports = {
|
|||
.then(response => {
|
||||
if (response.path) {
|
||||
this.vultr_config = response.path;
|
||||
this.ui_token_from_env = true;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
|
|
Loading…
Add table
Reference in a new issue