diff options
author | Matthew Flusche <mflusche@redhat.com> | 2017-02-14 17:00:02 +0000 |
---|---|---|
committer | Matthew Flusche <mflusche@redhat.com> | 2017-02-14 17:39:35 +0000 |
commit | bae2d113938b9bb22d4c291ae312d2299187f72b (patch) | |
tree | 7b570aaf11dfef9fcb333899082d06b39c9ce552 | |
parent | 596c1674b77a3833704dfc482961677e117d3380 (diff) |
FQDN validation
Adds optional validation to ensure FQDN set by Nova matches /etc/hosts
as created by overcloud heat configuration.
Consistent FQDN requires the nova parameter [Default]/dhcp_domain to
match the CloudDomain tht parameter.
This validation is disabled by default.
Change-Id: Ib5689acae66baf63ecccbc3b1c0b96684781b863
-rw-r--r-- | all-nodes-validation.yaml | 6 | ||||
-rw-r--r-- | validation-scripts/all-nodes.sh | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/all-nodes-validation.yaml b/all-nodes-validation.yaml index 65d01d0f..eea3e40a 100644 --- a/all-nodes-validation.yaml +++ b/all-nodes-validation.yaml @@ -10,6 +10,10 @@ parameters: default: '' description: A string containing a space separated list of IP addresses used to ping test each available network interface. type: string + ValidateFqdn: + default: false + description: Optional validation to ensure FQDN as set by Nova matches the name set in /etc/hosts. + type: boolean resources: AllNodesValidationsImpl: @@ -19,6 +23,8 @@ resources: inputs: - name: ping_test_ips default: {get_param: PingTestIps} + - name: validate_fqdn + default: {get_param: ValidateFqdn} config: {get_file: ./validation-scripts/all-nodes.sh} outputs: diff --git a/validation-scripts/all-nodes.sh b/validation-scripts/all-nodes.sh index 0b8b3523..f1f4cc11 100644 --- a/validation-scripts/all-nodes.sh +++ b/validation-scripts/all-nodes.sh @@ -67,5 +67,23 @@ function ping_default_gateways() { echo "SUCCESS" } +# Verify the FQDN from the nova/ironic deployment matches +# FQDN in the heat templates. +function fqdn_check() { + HOSTNAME=$(hostname) + SHORT_NAME=$(hostname -s) + FQDN_FROM_HOSTS=$(awk '$3 == "'${SHORT_NAME}'"{print $2}' /etc/hosts) + echo -n "Checking hostname vs /etc/hosts entry..." + if [[ $HOSTNAME != $FQDN_FROM_HOSTS ]]; then + echo "FAILURE" + echo -e "System hostname: ${HOSTNAME}\nEntry from /etc/hosts: ${FQDN_FROM_HOSTS}\n" + exit 1 + fi + echo "SUCCESS" +} + ping_controller_ips "$ping_test_ips" ping_default_gateways +if [[ $validate_fqdn == "True" ]];then + fqdn_check +fi |