CLOUDSTACK-7213: fixed continuing cloud-setup-database if there is no selinux


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

Branch: refs/heads/master
Commit: 79fcbd4a599f3ca39acb137f65b24b90ee3ddea1
Parents: 3d6c64d
Author: Jayapal <[email protected]>
Authored: Wed Jul 16 10:45:03 2014 +0530
Committer: Jayapal <[email protected]>
Committed: Fri Aug 1 15:54:17 2014 +0530

----------------------------------------------------------------------
 python/lib/cloud_utils.py             |  1 +
 setup/bindir/cloud-setup-databases.in | 11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79fcbd4a/python/lib/cloud_utils.py
----------------------------------------------------------------------
diff --git a/python/lib/cloud_utils.py b/python/lib/cloud_utils.py
index 39a4458..243bb40 100644
--- a/python/lib/cloud_utils.py
+++ b/python/lib/cloud_utils.py
@@ -314,6 +314,7 @@ def check_cgroups():
 def check_selinux():
        if distro not in [Fedora,CentOS,RHEL6]: return # no selinux outside of 
those
        enforcing = False
+       config_enforcing = False
        try:
                output = getenforce().stdout.strip()
                if "nforcing" in output:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/79fcbd4a/setup/bindir/cloud-setup-databases.in
----------------------------------------------------------------------
diff --git a/setup/bindir/cloud-setup-databases.in 
b/setup/bindir/cloud-setup-databases.in
index 272ff81..be54ff7 100755
--- a/setup/bindir/cloud-setup-databases.in
+++ b/setup/bindir/cloud-setup-databases.in
@@ -167,6 +167,10 @@ Sql parameters:
             '''%(table, e.__str__(), kwargs)
             self.errorAndExit(err)
 
+    def errorAndContinue(self, msg):
+        sys.stderr.write(msg)
+        sys.stderr.flush()
+
     def errorAndExit(self, msg):
         self.postRun()
         err = '''\n\nWe apologize for below error:
@@ -389,10 +393,13 @@ for example:
             try:
                 check_selinux()
             except CheckFailed, e:
-                self.errorAndExit(e.__str__())
+                self.info("checkSelinux failed with error continuing...", None)
+                self.errorAndContinue(e.__str__())
             except OSError, e:
                 if e.errno == 2: pass
-                else: self.errorAndExit(e.__str__())
+                else:
+                    self.info("checkSelinux failed with error continuing...", 
None)
+                    self.errorAndContinue(e.__str__())
             self.info(None, True)
 
         checkCloudDbFiles()

Reply via email to