mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
default pull options for container images to None, also adding pull options to awxkit
This commit is contained in:
parent
0bd8012fd9
commit
20ee73ce73
18
awx/main/migrations/0128_set_default_pull_to_none.py
Normal file
18
awx/main/migrations/0128_set_default_pull_to_none.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.2.16 on 2021-02-16 20:38
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0127_reset_pod_spec_override'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='executionenvironment',
|
||||
name='pull',
|
||||
field=models.CharField(choices=[('always', 'Always pull container before running.'), ('missing', 'No pull option has been selected.'), ('never', 'Never pull container before running.')], default=None, help_text='Pull image before running?', max_length=1024),
|
||||
),
|
||||
]
|
||||
@ -44,7 +44,7 @@ class ExecutionEnvironment(CommonModel):
|
||||
pull = models.CharField(
|
||||
max_length=1024,
|
||||
choices=PULL_CHOICES,
|
||||
default='missing',
|
||||
default=None,
|
||||
help_text=_('Pull image before running?'),
|
||||
)
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ options:
|
||||
description:
|
||||
- determine image pull behavior
|
||||
choices: ["always", "missing", "never"]
|
||||
default: "missing"
|
||||
default: None
|
||||
type: str
|
||||
extends_documentation_fragment: awx.awx.auth
|
||||
'''
|
||||
|
||||
@ -21,9 +21,9 @@ class ExecutionEnvironment(HasCreate, base.Base):
|
||||
NATURAL_KEY = ('name',)
|
||||
|
||||
# fields are name, image, organization, managed_by_tower, credential
|
||||
def create(self, name='', image='quay.io/ansible/ansible-runner:devel', credential=None, **kwargs):
|
||||
def create(self, name='', image='quay.io/ansible/ansible-runner:devel', credential=None, pull=None, **kwargs):
|
||||
# we do not want to make a credential by default
|
||||
payload = self.create_payload(name=name, image=image, credential=credential, **kwargs)
|
||||
payload = self.create_payload(name=name, image=image, credential=credential, pull=pull, **kwargs)
|
||||
ret = self.update_identity(ExecutionEnvironments(self.connection).post(payload))
|
||||
return ret
|
||||
|
||||
@ -33,12 +33,13 @@ class ExecutionEnvironment(HasCreate, base.Base):
|
||||
payload.ds = DSAdapter(self.__class__.__name__, self._dependency_store)
|
||||
return payload
|
||||
|
||||
def payload(self, name='', image=None, organization=None, credential=None, **kwargs):
|
||||
def payload(self, name='', image=None, organization=None, credential=None, pull=None, **kwargs):
|
||||
payload = PseudoNamespace(
|
||||
name=name or "EE - {}".format(random_title()),
|
||||
image=image or random_title(10),
|
||||
organization=organization.id if organization else None,
|
||||
credential=credential.id if credential else None,
|
||||
pull=pull if pull else None,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user