mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-20 16:03:06 +01:00
updated logging added returns
This commit is contained in:
@@ -77,7 +77,6 @@ import time
|
|||||||
import yaml
|
import yaml
|
||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric import ed25519
|
from cryptography.hazmat.primitives.asymmetric import ed25519
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
@@ -442,11 +441,21 @@ def setup_environment(vm_name: str = 'sool9', disk_size: str = '220G', minion_id
|
|||||||
# Run highstate on the hypervisor
|
# Run highstate on the hypervisor
|
||||||
highstate_result = local.cmd(minion_id, 'state.highstate', [], timeout=1800)
|
highstate_result = local.cmd(minion_id, 'state.highstate', [], timeout=1800)
|
||||||
if highstate_result and minion_id in highstate_result:
|
if highstate_result and minion_id in highstate_result:
|
||||||
log.info("MAIN: Highstate completed on %s", minion_id)
|
log.info("MAIN: Highstate triggered on %s", minion_id)
|
||||||
else:
|
else:
|
||||||
log.error("MAIN: Highstate failed or timed out on %s", minion_id)
|
log.error("MAIN: Highstate failed or timed out on %s", minion_id)
|
||||||
|
return {
|
||||||
|
'success': False,
|
||||||
|
'error': 'Highstate failed or timed out',
|
||||||
|
'vm_result': None
|
||||||
|
}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.error("MAIN: Error running highstate on %s: %s", minion_id, str(e))
|
log.error("MAIN: Error running highstate on %s: %s", minion_id, str(e))
|
||||||
|
return {
|
||||||
|
'success': False,
|
||||||
|
'error': f'Error running highstate: {str(e)}',
|
||||||
|
'vm_result': None
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'success': success,
|
'success': success,
|
||||||
|
|||||||
Reference in New Issue
Block a user