mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02: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:
committed by
GitHub
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=('PolicyAsCode'),
|
||||||
category_slug='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)
|
||||||
|
|||||||
Reference in New Issue
Block a user