We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ecac079 commit f3c211aCopy full SHA for f3c211a
1 file changed
build-rpm.py
@@ -66,6 +66,15 @@
66
src_rpm = []
67
logfile = output_dir + '/' + 'test.' + time.strftime("%m-%d-%Y-%H-%M-%S") + '.log'
68
69
+def is_valid_hostname(hostname):
70
+ if hostname[-1] == ".":
71
+ hostname = hostname[:-1] # strip exactly one dot from the right, if present
72
+ if len(hostname) > 255:
73
+ return False
74
+ if re.match(r"[a-f0-9]{12}", hostname.split(".")[0]):
75
+ print("container hostname does not pass naming policy [{}]".format(hostname))
76
77
+
78
79
def print_log(message):
80
try:
@@ -520,6 +529,8 @@ def cleanup_all():
520
529
521
530
if __name__ == '__main__':
522
531
cleanup_all()
532
+ if is_valid_hostname(socket.gethostname()) is False:
533
+ sys.exit(1)
523
534
if rerun_tests == 'true':
524
535
relaunch_tests()
525
536
else:
0 commit comments