def sendCommand(self, jbossHome, controller, user, password, domain, cluster, host, instance, offset):
        self.fillParameters(jbossHome, controller, user, password)
        startCommand =  "/host="+host+"/server-config="+instance+":add(group="+cluster+",socket-binding-port-offset="+offset+",auto-start=false)"

        print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand)

        subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd,startCommand])
        pm = PropertyManager("Domains/"+domain+".properties")
        oldInstances = pm.getValue("cluster."+cluster+".instances")
        if(oldInstances == None):
            newInstances = instance
        else:
            newInstances = ValueUtils.addToValues(instance, oldInstances, ',')
        pm.updateValue("Domains/"+domain+".properties", "cluster."+cluster+".instances", newInstances)

        oldHostInstances = pm.getValue("cluster."+cluster+"."+host+".instances")
        if(oldHostInstances == None):
            newHostInstances = instance
        else:
            newHostInstances = ValueUtils.addToValues(instance, oldHostInstances, ',')
        pm.updateValue("Domains/"+domain+".properties", "cluster."+cluster+"."+host+".instances", newHostInstances)
Exemplo n.º 2
0
    def sendCommand(self, jbossHome, controller, user, password, cluster, domain, profile):
        self.fillParameters(jbossHome, controller, user, password)
        startCommand =  "/server-group="+cluster+":add(profile="+profile+",socket-binding-group=full-ha-sockets)"

        print("eseguo: "+self._complPath+" "+self._cliconn+" "+self._complContr+" "+self._complUser+" "+self._complPwd+" "+startCommand)

        subprocess.check_call([self._complPath,self._cliconn,self._complContr,self._complUser,self._complPwd, startCommand])
        pm = PropertyManager("Domains/"+domain+".properties")
        old_clusters = pm.getValue("clusters")
        if(old_clusters == None):
            new_clusters = cluster
        else:
            new_clusters = ValueUtils.addToValues(cluster, old_clusters, ',')
        pm.updateValue("Domains/"+domain+".properties", "clusters", new_clusters)
Exemplo n.º 3
0
if(domain == ""):
    print("USAGE createDomain -domain=<domain name>")

destination = base_dir+"/domain/configuration/"

domainFile = getDomainFile(domain)
profiles = domainFile.find('{urn:jboss:domain:1.4}profiles')
for profile in profiles.iter('{urn:jboss:domain:1.4}profile'):
    name = profile.get('name')
    if(name == 'full-ha'):
        copyProfile = deepcopy(profile)
        copyProfile.set('name',profileName)
        profiles.append(copyProfile)

domainFile.write("domain.xml")

if(os.path.isfile(destination+"domain.xml")):
    shutil.move(destination+"domain.xml", destination+"domain.xml.ORIG")

if(os.path.isfile("domain.xml")):
    shutil.copy("domain.xml", destination+"domain.xml")
    shutil.move("domain.xml","domain.xml."+domain+".template")
if(not(os.path.isfile("Domains/"+domain+".properties"))):
    pm.create("Domains/"+domain+".properties")

old_domains = pm.getValue("domains")
if(old_domains.find(domain) == -1):
    new_domains = ValueUtils.addToValues(domain, old_domains, ',')
    pm.updateValue("""Domains/domains.properties""", "domains", new_domains)

print("RIAVVIARE IL DOMAIN CONTROLLER! \nCAMBIARE UTENTE E PASSWORD NELLA SEZIONE MESSAGING PRIMA DI AVVIARE")