diff options
author | Andrew Butcher <abutcher@afrolegs.com> | 2016-10-21 13:07:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-21 13:07:30 -0400 |
commit | 65a478443e4c86576f99936dac3f2989c685552e (patch) | |
tree | 5215d83878a96ea82c608d9740a322af17eed21b /utils/src/ooinstall/utils.py | |
parent | 88347f4866ed41132abb7f78fe37ac264236a395 (diff) | |
parent | 1c7dd6d5cd94c92ebec0a0fda789f4bfffa23472 (diff) | |
download | openshift-65a478443e4c86576f99936dac3f2989c685552e.tar.gz openshift-65a478443e4c86576f99936dac3f2989c685552e.tar.bz2 openshift-65a478443e4c86576f99936dac3f2989c685552e.tar.xz openshift-65a478443e4c86576f99936dac3f2989c685552e.zip |
Merge pull request #2563 from smunilla/BZ1339621
a-o-i: Separate install and scaleup workflows
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(".")) |