From 57fe38efcd787443b6ee8a0a7e6d9c06d9b3e740 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Thu, 2 Jun 2011 21:45:24 -0400 Subject: [PATCH] add check hostname during installation --- python/lib/cloudutils/syscfg.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/lib/cloudutils/syscfg.py b/python/lib/cloudutils/syscfg.py index 74607f0f106..f8e07ea28f6 100644 --- a/python/lib/cloudutils/syscfg.py +++ b/python/lib/cloudutils/syscfg.py @@ -72,8 +72,12 @@ class sysConfigAgent(sysConfig): return True if os.geteuid() != 0: - raise CloudInternalException("Need to execute with root permission") + raise CloudInternalException("Need to execute with root permission\n") + hostname = bash("hostname -f") + if not hostname.isSuccess(): + raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n") + kvmEnabled = self.svo.isKVMEnabled() if not kvmEnabled: raise CloudInternalException("Checking KVM...[Failed]\nPlease enable KVM on this machine\n") @@ -125,7 +129,7 @@ class sysConfigServer(sysConfig): raise CloudInternalException("Need to execute with root permission") hostname = bash("hostname -f") if not hostname.isSuccess(): - raise CloudInternalException("Checking hostname ... [Failed]\nNeed to have a Fully Qualified Domain Name as your hostname") + raise CloudInternalException("Checking hostname ... [Failed]\nPlease edit /etc/hosts, add a Fully Qualified Domain Name as your hostname\n") return True class sysConfigServerRedhat(sysConfigServer):