mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	fix setup-managment script
This commit is contained in:
		
							parent
							
								
									8ed9da41d5
								
							
						
					
					
						commit
						0b6fe0523d
					
				@ -1,7 +1,9 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
from cloudutils.syscfg import sysConfigFactory
 | 
			
		||||
from cloudutils.utilities import initLoging
 | 
			
		||||
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
 | 
			
		||||
from cloudutils.globalEnv import globalEnv
 | 
			
		||||
from cloudutils.serviceConfigServer import cloudManagementConfig
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    initLoging("/var/log/cloud/setupManagement.log")
 | 
			
		||||
    glbEnv = globalEnv()
 | 
			
		||||
@ -11,6 +13,7 @@ if __name__ == '__main__':
 | 
			
		||||
    print "Starting to configure CloudStack Management Server:"
 | 
			
		||||
    syscfg = sysConfigFactory.getSysConfigFactory(glbEnv)
 | 
			
		||||
    try:
 | 
			
		||||
    	syscfg.registerService(cloudManagementConfig)
 | 
			
		||||
        syscfg.config()
 | 
			
		||||
        print "CloudStack Management Server setup is Done!"
 | 
			
		||||
    except (CloudRuntimeException, CloudInternalException), e:
 | 
			
		||||
 | 
			
		||||
@ -621,7 +621,8 @@ class sudoersConfig(serviceCfgBase):
 | 
			
		||||
class firewallConfigServer(firewallConfigBase):
 | 
			
		||||
    def __init__(self, syscfg):
 | 
			
		||||
        super(firewallConfigServer, self).__init__(syscfg)
 | 
			
		||||
        #9090 is used for cluster management server
 | 
			
		||||
        if self.syscfg.env.svrMode == "myCloud":
 | 
			
		||||
            self.ports = "443 8080 8096 8250 8443".split()
 | 
			
		||||
            self.ports = "443 8080 8096 8250 8443 9090".split()
 | 
			
		||||
        else:
 | 
			
		||||
            self.ports = "8080 8096 8250".split()
 | 
			
		||||
            self.ports = "8080 8096 8250 9090".split()
 | 
			
		||||
 | 
			
		||||
@ -67,6 +67,7 @@ class cloudManagementConfig(serviceCfgBase):
 | 
			
		||||
        except:
 | 
			
		||||
            pass
 | 
			
		||||
            
 | 
			
		||||
        self.syscfg.svo.stopService("cloud-management")
 | 
			
		||||
        if self.syscfg.svo.enableService("cloud-management"):
 | 
			
		||||
            return True
 | 
			
		||||
        else:
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ class sysConfig(object):
 | 
			
		||||
        self.services = []
 | 
			
		||||
    
 | 
			
		||||
    def registerService(self, service):
 | 
			
		||||
        self.services.append(service)
 | 
			
		||||
        self.services.append(service(self))
 | 
			
		||||
        
 | 
			
		||||
    def config(self):
 | 
			
		||||
        if not self.check():
 | 
			
		||||
@ -124,6 +124,9 @@ class sysConfigServer(sysConfig):
 | 
			
		||||
    def check(self):
 | 
			
		||||
        if os.geteuid() != 0:
 | 
			
		||||
            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")
 | 
			
		||||
        return True
 | 
			
		||||
        
 | 
			
		||||
class sysConfigServerRedhat(sysConfigServer):
 | 
			
		||||
 | 
			
		||||
@ -110,7 +110,7 @@ class serviceOpsRedhat(serviceOps):
 | 
			
		||||
    def isServiceRunning(self, servicename):
 | 
			
		||||
        try:
 | 
			
		||||
            o = bash("service " + servicename + " status")
 | 
			
		||||
            if "start/running" in o.getStdout():
 | 
			
		||||
            if "running" in o.getStdout() or "start" in o.getStdout():
 | 
			
		||||
                return True
 | 
			
		||||
            else:
 | 
			
		||||
                return False
 | 
			
		||||
@ -146,7 +146,7 @@ class serviceOpsUbuntu(serviceOps):
 | 
			
		||||
    def isServiceRunning(self, servicename):
 | 
			
		||||
        try:
 | 
			
		||||
            o = bash("service " + servicename + " status")
 | 
			
		||||
            if "start/running" in o.getStdout():
 | 
			
		||||
            if "running" in o.getStdout() or "start" in o.getStdout():
 | 
			
		||||
                return True
 | 
			
		||||
            else:
 | 
			
		||||
                return False
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user