mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
OPA server hostname with https or http results in connection errors (#6921)
Signed-off-by: Mauricio Magnani <magnani@redhat.com>
This commit is contained in:
parent
b7a3c6b025
commit
6bd39aea4b
@ -1117,3 +1117,11 @@ if settings.FEATURE_POLICY_AS_CODE_ENABLED: # Unable to use flag_enabled due to
|
||||
category=('PolicyAsCode'),
|
||||
category_slug='policyascode',
|
||||
)
|
||||
|
||||
def policy_as_code_validate(serializer, attrs):
|
||||
opa_host = attrs.get('OPA_HOST', '')
|
||||
if opa_host and (opa_host.startswith('http://') or opa_host.startswith('https://')):
|
||||
raise serializers.ValidationError({'OPA_HOST': _("OPA_HOST should not include 'http://' or 'https://' prefixes. Please enter only the hostname.")})
|
||||
return attrs
|
||||
|
||||
register_validate('policyascode', policy_as_code_validate)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user