mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
changed the field name from 'container_options' to simply 'pull'
This commit is contained in:
parent
b0265b060b
commit
4b40cb3abb
@ -1365,7 +1365,7 @@ class ExecutionEnvironmentSerializer(BaseSerializer):
|
||||
|
||||
class Meta:
|
||||
model = ExecutionEnvironment
|
||||
fields = ('*', 'organization', 'image', 'managed_by_tower', 'credential', 'container_options')
|
||||
fields = ('*', 'organization', 'image', 'managed_by_tower', 'credential', 'pull')
|
||||
|
||||
def get_related(self, obj):
|
||||
res = super(ExecutionEnvironmentSerializer, self).get_related(obj)
|
||||
|
||||
@ -12,7 +12,7 @@ class Migration(migrations.Migration):
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='executionenvironment',
|
||||
name='container_options',
|
||||
field=models.CharField(choices=[('always', 'Always pull container before running.'), ('missing', 'No pull option has been selected'), ('never', 'Never pull container before running')], default='missing', help_text='Pull image before running?', max_length=1024),
|
||||
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='missing', help_text='Pull image before running?', max_length=1024),
|
||||
),
|
||||
]
|
||||
|
||||
@ -14,8 +14,8 @@ class ExecutionEnvironment(CommonModel):
|
||||
|
||||
PULL_CHOICES = [
|
||||
('always', _("Always pull container before running.")),
|
||||
('missing', _("No pull option has been selected")),
|
||||
('never', _("Never pull container before running"))
|
||||
('missing', _("No pull option has been selected.")),
|
||||
('never', _("Never pull container before running."))
|
||||
]
|
||||
|
||||
organization = models.ForeignKey(
|
||||
@ -41,7 +41,7 @@ class ExecutionEnvironment(CommonModel):
|
||||
default=None,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
container_options = models.CharField(
|
||||
pull = models.CharField(
|
||||
max_length=1024,
|
||||
choices=PULL_CHOICES,
|
||||
default='missing',
|
||||
|
||||
@ -21,14 +21,14 @@ const executionEnvironmentData = {
|
||||
credential: 4,
|
||||
description: 'A simple EE',
|
||||
image: 'https://registry.com/image/container',
|
||||
container_options: 'one',
|
||||
pull: 'one',
|
||||
};
|
||||
|
||||
const mockOptions = {
|
||||
data: {
|
||||
actions: {
|
||||
POST: {
|
||||
container_options: {
|
||||
pull: {
|
||||
choices: [
|
||||
['one', 'One'],
|
||||
['two', 'Two'],
|
||||
|
||||
@ -18,13 +18,7 @@ import { ExecutionEnvironmentsAPI } from '../../../api';
|
||||
|
||||
function ExecutionEnvironmentDetails({ executionEnvironment, i18n }) {
|
||||
const history = useHistory();
|
||||
const {
|
||||
id,
|
||||
name,
|
||||
image,
|
||||
description,
|
||||
container_options,
|
||||
} = executionEnvironment;
|
||||
const { id, name, image, description, pull } = executionEnvironment;
|
||||
|
||||
const {
|
||||
request: deleteExecutionEnvironment,
|
||||
@ -54,12 +48,8 @@ function ExecutionEnvironmentDetails({ executionEnvironment, i18n }) {
|
||||
/>
|
||||
<Detail label={i18n._(t`Description`)} value={description} />
|
||||
<Detail
|
||||
label={i18n._(t`Container Options`)}
|
||||
value={
|
||||
container_options === ''
|
||||
? i18n._(t`Missing`)
|
||||
: toTitleCase(container_options)
|
||||
}
|
||||
label={i18n._(t`Pull`)}
|
||||
value={pull === '' ? i18n._(t`Missing`) : toTitleCase(pull)}
|
||||
/>
|
||||
{executionEnvironment.summary_fields.credential && (
|
||||
<Detail
|
||||
|
||||
@ -19,7 +19,7 @@ const executionEnvironmentData = {
|
||||
credential: { id: 4 },
|
||||
description: 'A simple EE',
|
||||
image: 'https://registry.com/image/container',
|
||||
container_options: 'one',
|
||||
pull: 'one',
|
||||
name: 'Test EE',
|
||||
};
|
||||
|
||||
@ -32,7 +32,7 @@ const mockOptions = {
|
||||
data: {
|
||||
actions: {
|
||||
POST: {
|
||||
container_options: {
|
||||
pull: {
|
||||
choices: [
|
||||
['one', 'One'],
|
||||
['two', 'Two'],
|
||||
|
||||
@ -52,10 +52,10 @@ function ExecutionEnvironmentFormFields({
|
||||
containerOptionsMeta,
|
||||
containerOptionsHelpers,
|
||||
] = useField({
|
||||
name: 'container_options',
|
||||
name: 'pull',
|
||||
});
|
||||
|
||||
const containerPullChoices = options?.actions?.POST?.container_options?.choices.map(
|
||||
const containerPullChoices = options?.actions?.POST?.pull?.choices.map(
|
||||
([value, label]) => ({ value, label, key: value })
|
||||
);
|
||||
|
||||
@ -168,7 +168,7 @@ function ExecutionEnvironmentForm({
|
||||
const initialValues = {
|
||||
name: executionEnvironment.name || '',
|
||||
image: executionEnvironment.image || '',
|
||||
container_options: executionEnvironment?.container_options || '',
|
||||
pull: executionEnvironment?.pull || '',
|
||||
description: executionEnvironment.description || '',
|
||||
credential: executionEnvironment.summary_fields?.credential || null,
|
||||
organization: executionEnvironment.summary_fields?.organization || null,
|
||||
|
||||
@ -19,7 +19,7 @@ const executionEnvironment = {
|
||||
id: 16,
|
||||
name: 'Test EE',
|
||||
type: 'execution_environment',
|
||||
container_options: 'one',
|
||||
pull: 'one',
|
||||
url: '/api/v2/execution_environments/16/',
|
||||
related: {
|
||||
created_by: '/api/v2/users/1/',
|
||||
@ -48,7 +48,7 @@ const mockOptions = {
|
||||
data: {
|
||||
actions: {
|
||||
POST: {
|
||||
container_options: {
|
||||
pull: {
|
||||
choices: [
|
||||
['one', 'One'],
|
||||
['two', 'Two'],
|
||||
|
||||
@ -50,6 +50,12 @@ options:
|
||||
choices: ["present", "absent"]
|
||||
default: "present"
|
||||
type: str
|
||||
pull:
|
||||
description:
|
||||
- determine image pull behavior
|
||||
choices: ["always", "missing", "never"]
|
||||
default: "missing"
|
||||
type: str
|
||||
extends_documentation_fragment: awx.awx.auth
|
||||
'''
|
||||
|
||||
@ -75,6 +81,7 @@ def main():
|
||||
organization=dict(),
|
||||
credential=dict(default=''),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
pull=dict(choices=['always', 'missing', 'never'], default='missing')
|
||||
)
|
||||
|
||||
# Create a module for ourselves
|
||||
@ -85,6 +92,7 @@ def main():
|
||||
image = module.params.get('image')
|
||||
description = module.params.get('description')
|
||||
state = module.params.get('state')
|
||||
pull = module.params.get('pull')
|
||||
|
||||
existing_item = module.get_one('execution_environments', name_or_id=name)
|
||||
|
||||
@ -98,6 +106,9 @@ def main():
|
||||
if description:
|
||||
new_fields['description'] = description
|
||||
|
||||
if pull:
|
||||
new_fields['pull'] = pull
|
||||
|
||||
# Attempt to look up the related items the user specified (these will fail the module if not found)
|
||||
organization = module.params.get('organization')
|
||||
if organization:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user