Skip to content
Snippets Groups Projects
Commit 49747c50 authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Add variable to disable VM creation

Both AWX_VM_CREATION_ENABLED and AWX_JOB_ENABLED shall be set to True
to enable VM creation.
An extra variable is used because the core services can be updated from
csentry-test but VM creation shouldn't (for now)
parent 58bab5d0
No related branches found
No related tags found
No related merge requests found
......@@ -68,11 +68,13 @@ MAC_OUI = '02:42:42'
DOCUMENTATION_URL = 'http://ics-infrastructure.pages.esss.lu.se/csentry/index.html'
# AWX job templates
AWX_JOB_ENABLED = False
AWX_CORE_SERVICES_UPDATE = 'ics-ans-core @ DHCP test'
AWX_CREATE_VM = 'ics-ans-deploy-proxmox-vm'
AWX_CREATE_VIOC = 'ics-ans-deploy-vioc'
AWX_JOB_ENABLED = False
AWX_VM_CREATION_ENABLED = False
VM_CORES_CHOICES = [1, 2, 4, 6, 8, 24]
VM_MEMORY_CHOICES = [2, 4, 8, 16, 32, 128]
VM_DEFAULT_DNS = '172.16.6.21'
......
......@@ -72,6 +72,10 @@ def trigger_core_services_update():
def launch_job_template(job_template, monitor=True, **kwargs):
if (job_template in (current_app.config['AWX_CREATE_VIOC'], current_app.config['AWX_CREATE_VM']) and
not current_app.config.get('AWX_VM_CREATION_ENABLED', False)):
current_app.logger.info('AWX VM creation is disabled. Not sending any request.')
return 'AWX VM creation not triggered'
if not current_app.config.get('AWX_JOB_ENABLED', False):
current_app.logger.info('AWX job is disabled. Not sending any request.')
return 'AWX job not triggered'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment