From 50782b94654ff0fe80566c9805680661bf4c0ba2 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:46:28 -0400 Subject: [PATCH 1/6] add required fields for RHSatellite6 credentials see: https://github.com/ansible/ansible-tower/issues/7467 --- awx/main/models/credential.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 4906d7d14e..037c71b39c 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -861,7 +861,8 @@ def satellite6(cls): 'label': 'Password', 'type': 'string', 'secret': True, - }] + }], + 'required': ['host', 'username', 'password'], } ) From 90b5d98e5ccbda1ae6f643bc6076f1e97198c407 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:48:57 -0400 Subject: [PATCH 2/6] add required fields for network credentials see: https://github.com/ansible/ansible-tower/issues/7466 --- awx/main/models/credential.py | 3 ++- awx/main/tests/functional/api/test_credential.py | 1 + awx/main/tests/functional/test_credential.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 037c71b39c..d2a69918ca 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -735,7 +735,8 @@ def net(cls): 'dependencies': { 'ssh_key_unlock': ['ssh_key_data'], 'authorize_password': ['authorize'], - } + }, + 'required': ['username'], } ) diff --git a/awx/main/tests/functional/api/test_credential.py b/awx/main/tests/functional/api/test_credential.py index ac9c1be960..fbd8889a06 100644 --- a/awx/main/tests/functional/api/test_credential.py +++ b/awx/main/tests/functional/api/test_credential.py @@ -748,6 +748,7 @@ def test_falsey_field_data(get, post, organization, admin, field_value): 'credential_type': net.pk, 'organization': organization.id, 'inputs': { + 'username': 'joe-user', # username is required 'authorize': field_value } } diff --git a/awx/main/tests/functional/test_credential.py b/awx/main/tests/functional/test_credential.py index cdb54c2265..4a51565d04 100644 --- a/awx/main/tests/functional/test_credential.py +++ b/awx/main/tests/functional/test_credential.py @@ -226,7 +226,7 @@ def test_credential_creation_validation_failure(organization_factory, inputs): [EXAMPLE_PRIVATE_KEY.replace('=', '\u003d'), None, True], # automatically fix JSON-encoded GCE keys ]) def test_ssh_key_data_validation(organization, kind, ssh_key_data, ssh_key_unlock, valid): - inputs = {} + inputs = {'username': 'joe-user'} if ssh_key_data: inputs['ssh_key_data'] = ssh_key_data if ssh_key_unlock: From 5ba76f28ce608deca4f0b869002b25ed7150bfd8 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:50:00 -0400 Subject: [PATCH 3/6] add required fields for azure credentials see: https://github.com/ansible/ansible-tower/issues/7465 --- awx/main/models/credential.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index d2a69918ca..799b421aee 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -994,7 +994,8 @@ def azure_rm(cls): 'id': 'tenant', 'label': 'Tenant ID', 'type': 'string' - }] + }], + 'required': ['subscription'], } ) From fc73bdcc187572c645ba10a09be40653d93a48ff Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:51:07 -0400 Subject: [PATCH 4/6] add required fields for azure classic credentials https://github.com/ansible/ansible-tower/issues/7464 --- awx/main/models/credential.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 799b421aee..9f66965651 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -954,7 +954,8 @@ def azure(cls): 'help_text': ('Paste the contents of the PEM file that corresponds ' 'to the certificate you uploaded in the Microsoft ' 'Azure console.') - }] + }], + 'required': ['username', 'ssh_key_data'], } ) From bcd8e13c2422968991f2ff4d77937778e7d34220 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:51:58 -0400 Subject: [PATCH 5/6] add required fields for gce credentials see: https://github.com/ansible/ansible-tower/issues/7463 --- awx/main/models/credential.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 9f66965651..7a18c1bf52 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -926,7 +926,8 @@ def gce(cls): 'multiline': True, 'help_text': ('Paste the contents of the PEM file associated ' 'with the service account email.') - }] + }], + 'required': ['username', 'ssh_key_data'], } ) From b0a1988c29a05641c18dbe9c57d95059b8b2a9b8 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Fri, 18 Aug 2017 15:53:38 -0400 Subject: [PATCH 6/6] add required fields for cloudforms credentials see: https://github.com/ansible/ansible-tower/issues/7462 --- awx/main/models/credential.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/credential.py b/awx/main/models/credential.py index 7a18c1bf52..7c1c60c47a 100644 --- a/awx/main/models/credential.py +++ b/awx/main/models/credential.py @@ -891,7 +891,8 @@ def cloudforms(cls): 'label': 'Password', 'type': 'string', 'secret': True, - }] + }], + 'required': ['host', 'username', 'password'], } )