diff options
author | Samuel Munilla <smunilla@redhat.com> | 2016-10-06 13:28:15 -0400 |
---|---|---|
committer | Samuel Munilla <smunilla@redhat.com> | 2016-10-20 14:35:04 -0400 |
commit | 1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472 (patch) | |
tree | 2aa9c54e371e3875fe006448058b5ae6e3716775 /utils/src/ooinstall/utils.py | |
parent | 4a5b2dd0510ac092da44a09730a734fe9ef7e112 (diff) | |
download | openshift-1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472.tar.gz openshift-1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472.tar.bz2 openshift-1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472.tar.xz openshift-1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472.zip |
a-o-i: Separate install and scaleup workflows
In order to simplify the quick installer logic, this moves
the scaleup workflow into its own subcommand.
Fixes: Bug 1339621
Diffstat (limited to 'utils/src/ooinstall/utils.py')
-rw-r--r-- | utils/src/ooinstall/utils.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/src/ooinstall/utils.py b/utils/src/ooinstall/utils.py index eb27a57e4..85a77c75e 100644 --- a/utils/src/ooinstall/utils.py +++ b/utils/src/ooinstall/utils.py @@ -1,4 +1,6 @@ import logging +import re + installer_log = logging.getLogger('installer') @@ -8,3 +10,12 @@ def debug_env(env): if k.startswith("OPENSHIFT") or k.startswith("ANSIBLE") or k.startswith("OO"): installer_log.debug("{key}: {value}".format( key=k, value=env[k])) + + +def is_valid_hostname(hostname): + if not hostname or len(hostname) > 255: + return False + if hostname[-1] == ".": + hostname = hostname[:-1] # strip exactly one dot from the right, if present + allowed = re.compile(r"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE) + return all(allowed.match(x) for x in hostname.split(".")) |