From 825c187c07d592838aac20c41848b336835ef3b5 Mon Sep 17 00:00:00 2001 From: Michael Gugino Date: Tue, 15 Aug 2017 21:00:48 -0400 Subject: Add hostname/nodename length check OpenShift will not allow nodes to register if the nodename is > 63 chars. This commit verifies that nodename is not set to a potential hostname that is greater than 63 characters. This commit also updates logic to check `openshift_hostname` to check for > 63 chars. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1467790 --- roles/openshift_common/tasks/main.yml | 4 ++-- roles/openshift_facts/library/openshift_facts.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'roles') diff --git a/roles/openshift_common/tasks/main.yml b/roles/openshift_common/tasks/main.yml index 51313a258..a0bd6c860 100644 --- a/roles/openshift_common/tasks/main.yml +++ b/roles/openshift_common/tasks/main.yml @@ -40,8 +40,8 @@ when: openshift_use_calico | default(false) | bool and openshift_use_contiv | default(false) | bool - fail: - msg: openshift_hostname must be 64 characters or less - when: openshift_hostname is defined and openshift_hostname | length > 64 + msg: openshift_hostname must be 63 characters or less + when: openshift_hostname is defined and openshift_hostname | length > 63 - name: Set common Cluster facts openshift_facts: diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index 844d77255..251d1dfb4 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -193,7 +193,9 @@ def hostname_valid(hostname): """ if (not hostname or hostname.startswith('localhost') or - hostname.endswith('localdomain')): + hostname.endswith('localdomain') or + # OpenShift will not allow a node with more than 63 chars in name. + len(hostname) > 63): return False return True -- cgit v1.2.3