Create default EE in seperate awx-managment cmd

Create EE at a seperate time and also attach a registry credential if
auth information provided

This command can be run multiple times on the same instance and should be
idempotent.
This commit is contained in:
Elijah DeLee
2021-06-01 10:56:45 -04:00
parent 5622bf1a0a
commit 043aff6a8c
2 changed files with 90 additions and 9 deletions

View File

@@ -2,9 +2,8 @@
# All Rights Reserved
from django.core.management.base import BaseCommand
from django.conf import settings
from crum import impersonate
from awx.main.models import User, Organization, Project, Inventory, CredentialType, Credential, Host, JobTemplate, ExecutionEnvironment
from awx.main.models import User, Organization, Project, Inventory, CredentialType, Credential, Host, JobTemplate
from awx.main.signals import disable_computed_fields
@@ -68,13 +67,6 @@ class Command(BaseCommand):
print('Demo Credential, Inventory, and Job Template added.')
changed = True
for ee in reversed(settings.DEFAULT_EXECUTION_ENVIRONMENTS):
_, created = ExecutionEnvironment.objects.update_or_create(name=ee['name'], defaults={'image': ee['image'], 'managed_by_tower': True})
if created:
changed = True
print('Default Execution Environment(s) registered.')
if changed:
print('(changed: True)')
else: