mirror of
https://github.com/trailofbits/algo.git
synced 2025-09-10 05:53:27 +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)
|
display.display(taskmsg)
|
||||||
|
|
||||||
host = inventory.groups['vpn-host'].hosts[0].name
|
if 'vpn-host' not in inventory.groups:
|
||||||
host_vars = variable_manager.get_vars()['hostvars'][host]
|
raise ValueError('no_vpn_host')
|
||||||
return {
|
else:
|
||||||
'CA_password': host_vars.get('CA_password'),
|
host = inventory.groups['vpn-host'].hosts[0].name
|
||||||
'p12_export_password': host_vars.get('p12_export_password'),
|
host_vars = variable_manager.get_vars()['hostvars'][host]
|
||||||
'algo_server_name': host_vars.get('server_name'),
|
return {
|
||||||
'ipv6_support': host_vars.get('ipv6_support'),
|
'CA_password': host_vars.get('CA_password'),
|
||||||
'local_service_ip': host_vars.get('ansible_lo') and
|
'p12_export_password': host_vars.get('p12_export_password'),
|
||||||
host_vars.get('ansible_lo').get('ipv4_secondaries') and
|
'algo_server_name': host_vars.get('server_name'),
|
||||||
host_vars.get('ansible_lo').get('ipv4_secondaries')[0]['address'],
|
'ipv6_support': host_vars.get('ipv6_support'),
|
||||||
'ansible_ssh_host': host,
|
'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})
|
return web.json_response({'status': None})
|
||||||
|
|
||||||
if task_future.done():
|
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():
|
elif task_future.cancelled():
|
||||||
return web.json_response({'status': 'cancelled', 'program': task_program})
|
return web.json_response({'status': 'cancelled', 'program': task_program})
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -20,7 +20,9 @@
|
||||||
v-bind:disabled="ui_loading_check || ui_token_from_env"
|
v-bind:disabled="ui_loading_check || ui_token_from_env"
|
||||||
v-model="scaleway_token"
|
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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
v-bind:disabled="ui_loading_check"
|
v-bind:disabled="ui_loading_check"
|
||||||
v-model="vultr_config"
|
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>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
@ -47,6 +50,7 @@ module.exports = {
|
||||||
vultr_config: null,
|
vultr_config: null,
|
||||||
region: null,
|
region: null,
|
||||||
// helper variables
|
// helper variables
|
||||||
|
ui_token_from_env: false,
|
||||||
ui_loading_check: false,
|
ui_loading_check: false,
|
||||||
ui_loading_regions: false,
|
ui_loading_regions: false,
|
||||||
ui_region_options: []
|
ui_region_options: []
|
||||||
|
@ -69,6 +73,7 @@ module.exports = {
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.path) {
|
if (response.path) {
|
||||||
this.vultr_config = response.path;
|
this.vultr_config = response.path;
|
||||||
|
this.ui_token_from_env = true;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue