mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Improved handling of unknown OS, Distribution
Introduce UnknownSystemExcpetion to indicate that the system is is unknonwn. Catch said exception in cloud-setup-management, print an error and exit. CLOUDSTACK-966: Improve error reporting when running on unknown OS / version Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
5442df2b5e
commit
127867cc99
@ -16,8 +16,9 @@
|
|||||||
# specific language governing permissions and limitations
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import sys
|
||||||
from cloudutils.syscfg import sysConfigFactory
|
from cloudutils.syscfg import sysConfigFactory
|
||||||
from cloudutils.utilities import initLoging
|
from cloudutils.utilities import initLoging, UnknownSystemException
|
||||||
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
|
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
|
||||||
from cloudutils.globalEnv import globalEnv
|
from cloudutils.globalEnv import globalEnv
|
||||||
from cloudutils.serviceConfigServer import cloudManagementConfig
|
from cloudutils.serviceConfigServer import cloudManagementConfig
|
||||||
@ -35,7 +36,12 @@ if __name__ == '__main__':
|
|||||||
glbEnv.mode = "Server"
|
glbEnv.mode = "Server"
|
||||||
|
|
||||||
print "Starting to configure CloudStack Management Server:"
|
print "Starting to configure CloudStack Management Server:"
|
||||||
|
try:
|
||||||
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
|
syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
|
||||||
|
except UnknownSystemException:
|
||||||
|
print >>sys.stderr, ("Error: CloudStack failed to detect your "
|
||||||
|
"operating system. Exiting.")
|
||||||
|
sys.exit(1)
|
||||||
try:
|
try:
|
||||||
syscfg.registerService(cloudManagementConfig)
|
syscfg.registerService(cloudManagementConfig)
|
||||||
syscfg.config()
|
syscfg.config()
|
||||||
|
|||||||
@ -97,6 +97,10 @@ def writeProgressBar(msg, result):
|
|||||||
sys.stdout.write(output)
|
sys.stdout.write(output)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
class UnknownSystemException(Exception):
|
||||||
|
"This Excption is raised if the current operating enviornment is unknown"
|
||||||
|
pass
|
||||||
|
|
||||||
class Distribution:
|
class Distribution:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.distro = "Unknown"
|
self.distro = "Unknown"
|
||||||
@ -120,7 +124,7 @@ class Distribution:
|
|||||||
self.arch = bash("uname -m").getStdout()
|
self.arch = bash("uname -m").getStdout()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.distro = "Unknown"
|
raise UnknownSystemException
|
||||||
|
|
||||||
def getVersion(self):
|
def getVersion(self):
|
||||||
return self.distro
|
return self.distro
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user