incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [47/51] git commit: Improved handling of unknown OS, Distribution
Date Mon, 14 Jan 2013 18:00:34 GMT
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>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/127867cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/127867cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/127867cc

Branch: refs/heads/ui-quick-view-v2
Commit: 127867cc999a7c772cdf5108b3e7432f91178cfe
Parents: 5442df2
Author: Noa Resare <noa@spotify.com>
Authored: Sat Jan 12 19:07:32 2013 +0000
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun Jan 13 15:08:04 2013 +0530

----------------------------------------------------------------------
 client/bindir/cloud-setup-management.in |   10 ++++++++--
 python/lib/cloudutils/utilities.py      |    6 +++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/127867cc/client/bindir/cloud-setup-management.in
----------------------------------------------------------------------
diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in
index 469c961..ca1327a 100755
--- a/client/bindir/cloud-setup-management.in
+++ b/client/bindir/cloud-setup-management.in
@@ -16,8 +16,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import sys
 from cloudutils.syscfg import sysConfigFactory
-from cloudutils.utilities import initLoging
+from cloudutils.utilities import initLoging, UnknownSystemException
 from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
 from cloudutils.globalEnv import globalEnv
 from cloudutils.serviceConfigServer import cloudManagementConfig
@@ -35,7 +36,12 @@ if __name__ == '__main__':
     glbEnv.mode = "Server"
     
     print "Starting to configure CloudStack Management Server:"
-    syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
+    try:
+        syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
+    except UnknownSystemException:
+        print >>sys.stderr, ("Error: CloudStack failed to detect your "
+                "operating system. Exiting.")
+        sys.exit(1)
     try:
     	syscfg.registerService(cloudManagementConfig)
         syscfg.config()

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/127867cc/python/lib/cloudutils/utilities.py
----------------------------------------------------------------------
diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py
index adf81fc..3f5f2a9 100755
--- a/python/lib/cloudutils/utilities.py
+++ b/python/lib/cloudutils/utilities.py
@@ -96,6 +96,10 @@ def writeProgressBar(msg, result):
         output = "[%-6s]\n"%"Failed"
     sys.stdout.write(output)
     sys.stdout.flush()
+
+class UnknownSystemException(Exception):
+    "This Excption is raised if the current operating enviornment is unknown"
+    pass
  
 class Distribution:
     def __init__(self):
@@ -120,7 +124,7 @@ class Distribution:
             self.arch = bash("uname -m").getStdout()
             
         else: 
-            self.distro = "Unknown" 
+            raise UnknownSystemException
 
     def getVersion(self):
         return self.distro 


Mime
View raw message