mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
standardizing how host gets validated (#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
This commit is contained in:
@@ -15,7 +15,6 @@ from ansible.module_utils.six.moves.configparser import ConfigParser, NoOptionEr
|
|||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from socket import getaddrinfo, IPPROTO_TCP
|
from socket import getaddrinfo, IPPROTO_TCP
|
||||||
import time
|
import time
|
||||||
import re
|
|
||||||
from json import loads, dumps
|
from json import loads, dumps
|
||||||
from os.path import isfile, expanduser, split, join, exists, isdir
|
from os.path import isfile, expanduser, split, join, exists, isdir
|
||||||
from os import access, R_OK, getcwd, environ, getenv
|
from os import access, R_OK, getcwd, environ, getenv
|
||||||
@@ -106,7 +105,7 @@ class ControllerModule(AnsibleModule):
|
|||||||
setattr(self, short_param, direct_value)
|
setattr(self, short_param, direct_value)
|
||||||
|
|
||||||
# Perform some basic validation
|
# Perform some basic validation
|
||||||
if not re.match('^https{0,1}://', self.host):
|
if not self.host.startswith(("https://", "http://")): # NOSONAR
|
||||||
self.host = "https://{0}".format(self.host)
|
self.host = "https://{0}".format(self.host)
|
||||||
|
|
||||||
# Try to parse the hostname as a url
|
# Try to parse the hostname as a url
|
||||||
|
|||||||
Reference in New Issue
Block a user