Skip to content

Commit a655a3f

Browse files
authored
standardizing how host gets validated (ansible#16003)
* removing the requirement for re and changing to startswith which the other AAP collections use * telling sonarqube to ignore this line * fixing lint error
1 parent 9520c83 commit a655a3f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

awx_collection/plugins/module_utils/controller_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from base64 import b64encode
1616
from socket import getaddrinfo, IPPROTO_TCP
1717
import time
18-
import re
1918
from json import loads, dumps
2019
from os.path import isfile, expanduser, split, join, exists, isdir
2120
from os import access, R_OK, getcwd, environ, getenv
@@ -106,7 +105,7 @@ def __init__(self, argument_spec=None, direct_params=None, error_callback=None,
106105
setattr(self, short_param, direct_value)
107106

108107
# Perform some basic validation
109-
if not re.match('^https{0,1}://', self.host):
108+
if not self.host.startswith(("https://", "http://")): # NOSONAR
110109
self.host = "https://{0}".format(self.host)
111110

112111
# Try to parse the hostname as a url

0 commit comments

Comments
 (0)