1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Merge pull request #4610 from ryanpetrello/cli-cleanup-injectors-language

fix a few minor CLI bugs

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-08-29 14:15:48 +00:00 committed by GitHub
commit 33f2b0bf1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 18 deletions

View File

@ -0,0 +1,29 @@
# Generated by Django 2.2.4 on 2019-08-27 21:50
import awx.main.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0086_v360_workflow_approval'),
]
operations = [
migrations.AlterField(
model_name='credential',
name='inputs',
field=awx.main.fields.CredentialInputField(blank=True, default=dict, help_text='Enter inputs using either JSON or YAML syntax. Refer to the Ansible Tower documentation for example syntax.'),
),
migrations.AlterField(
model_name='credentialtype',
name='injectors',
field=awx.main.fields.CredentialTypeInjectorField(blank=True, default=dict, help_text='Enter injectors using either JSON or YAML syntax. Refer to the Ansible Tower documentation for example syntax.'),
),
migrations.AlterField(
model_name='credentialtype',
name='inputs',
field=awx.main.fields.CredentialTypeInputField(blank=True, default=dict, help_text='Enter inputs using either JSON or YAML syntax. Refer to the Ansible Tower documentation for example syntax.'),
),
]

View File

@ -106,9 +106,8 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
inputs = CredentialInputField(
blank=True,
default=dict,
help_text=_('Enter inputs using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
help_text=_('Enter inputs using either JSON or YAML syntax. '
'Refer to the Ansible Tower documentation for example syntax.')
)
admin_role = ImplicitRoleField(
parent_role=[
@ -344,16 +343,14 @@ class CredentialType(CommonModelNameNotUnique):
inputs = CredentialTypeInputField(
blank=True,
default=dict,
help_text=_('Enter inputs using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
help_text=_('Enter inputs using either JSON or YAML syntax. '
'Refer to the Ansible Tower documentation for example syntax.')
)
injectors = CredentialTypeInjectorField(
blank=True,
default=dict,
help_text=_('Enter injectors using either JSON or YAML syntax. Use the '
'radio button to toggle between the two. Refer to the '
'Ansible Tower documentation for example syntax.')
help_text=_('Enter injectors using either JSON or YAML syntax. '
'Refer to the Ansible Tower documentation for example syntax.')
)
@classmethod

View File

@ -59,15 +59,6 @@ class ResourceOptionsParser(object):
def build_query_arguments(self, method, http_method):
required_group = None
if filter(
lambda param: param.get('required', False) is True,
self.options.get(http_method, {}).values()
):
if method in self.parser.choices:
required_group = self.parser.choices[method].add_argument_group('required arguments')
# put the required group first (before the optional args group)
self.parser.choices[method]._action_groups.reverse()
for k, param in self.options.get(http_method, {}).items():
required = (
method == 'create' and
@ -154,6 +145,10 @@ class ResourceOptionsParser(object):
kwargs['type'] = jsonstr
if required:
if required_group is None:
required_group = self.parser.choices[method].add_argument_group('required arguments')
# put the required group first (before the optional args group)
self.parser.choices[method]._action_groups.reverse()
required_group.add_argument(
'--{}'.format(k),
**kwargs