diff options
author | Wayne Witzel III <wayne@riotousliving.com> | 2018-08-09 16:11:37 +0200 |
---|---|---|
committer | Wayne Witzel III <wayne@riotousliving.com> | 2018-08-09 16:11:37 +0200 |
commit | 89642a449fd256ef63c325acb583d045f752b4a1 (patch) | |
tree | db07e333286cc896028dc5d1fb5aa30b71f8fdb6 | |
parent | Merge pull request #2740 from jakemcdermott/fix-2241 (diff) | |
download | awx-89642a449fd256ef63c325acb583d045f752b4a1.tar.xz awx-89642a449fd256ef63c325acb583d045f752b4a1.zip |
disable computed for create preload data mgmt cmd
-rw-r--r-- | awx/main/management/commands/create_preload_data.py | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/awx/main/management/commands/create_preload_data.py b/awx/main/management/commands/create_preload_data.py index 842816cabe..d171f20544 100644 --- a/awx/main/management/commands/create_preload_data.py +++ b/awx/main/management/commands/create_preload_data.py @@ -4,6 +4,7 @@ from django.core.management.base import BaseCommand from crum import impersonate from awx.main.models import User, Organization, Project, Inventory, CredentialType, Credential, Host, JobTemplate +from awx.main.signals import disable_computed_fields class Command(BaseCommand): @@ -22,33 +23,34 @@ class Command(BaseCommand): except IndexError: superuser = None with impersonate(superuser): - o = Organization.objects.create(name='Default') - p = Project(name='Demo Project', - scm_type='git', - scm_url='https://github.com/ansible/ansible-tower-samples', - scm_update_on_launch=True, - scm_update_cache_timeout=0, - organization=o) - p.save(skip_update=True) - ssh_type = CredentialType.from_v1_kind('ssh') - c = Credential.objects.create(credential_type=ssh_type, - name='Demo Credential', - inputs={ - 'username': superuser.username - }, - created_by=superuser) - c.admin_role.members.add(superuser) - i = Inventory.objects.create(name='Demo Inventory', - organization=o, - created_by=superuser) - Host.objects.create(name='localhost', - inventory=i, - variables="ansible_connection: local", - created_by=superuser) - jt = JobTemplate.objects.create(name='Demo Job Template', - playbook='hello_world.yml', - project=p, - inventory=i) - jt.credentials.add(c) + with disable_computed_fields(): + o = Organization.objects.create(name='Default') + p = Project(name='Demo Project', + scm_type='git', + scm_url='https://github.com/ansible/ansible-tower-samples', + scm_update_on_launch=True, + scm_update_cache_timeout=0, + organization=o) + p.save(skip_update=True) + ssh_type = CredentialType.from_v1_kind('ssh') + c = Credential.objects.create(credential_type=ssh_type, + name='Demo Credential', + inputs={ + 'username': superuser.username + }, + created_by=superuser) + c.admin_role.members.add(superuser) + i = Inventory.objects.create(name='Demo Inventory', + organization=o, + created_by=superuser) + Host.objects.create(name='localhost', + inventory=i, + variables="ansible_connection: local", + created_by=superuser) + jt = JobTemplate.objects.create(name='Demo Job Template', + playbook='hello_world.yml', + project=p, + inventory=i) + jt.credentials.add(c) print('Default organization added.') print('Demo Credential, Inventory, and Job Template added.') |