Exemplo n.º 1
0
    def _update_code(self, config, nodes):
        for serviceNode in nodes:
            # Push the current code version via GIT if necessary
            if config.codeVersions[config.currentCodeVersion].type == 'git':
                _, err = git.git_push(git.DEFAULT_CODE_REPO, serviceNode.ip)
                if err:
                    self.logger.debug('git-push to %s: %s' %
                                      (serviceNode.ip, err))

            try:
                if serviceNode.isRunningBackend:  ## UPLOAD TOMCAT CODE TO TOMCAT
                    client.updateTomcatCode(
                        serviceNode.ip, 5555, config.currentCodeVersion,
                        config.codeVersions[config.currentCodeVersion].type,
                        os.path.join(self.code_repo,
                                     config.currentCodeVersion))
                if serviceNode.isRunningProxy or serviceNode.isRunningWeb:
                    client.updatePHPCode(
                        serviceNode.ip, 5555, config.currentCodeVersion,
                        config.codeVersions[config.currentCodeVersion].type,
                        os.path.join(self.code_repo,
                                     config.currentCodeVersion))
            except client.AgentException:
                self.logger.exception('Failed to update code at node %s' %
                                      str(serviceNode))
                self._state_set(self.S_ERROR,
                                msg='Failed to update code at node %s' %
                                str(serviceNode))
                return
Exemplo n.º 2
0
    def _update_code(self, config, nodes):
        for serviceNode in nodes:
            # Push the current code version via GIT if necessary
            if config.codeVersions[config.currentCodeVersion].type == 'git':
                filepath = config.codeVersions[config.currentCodeVersion].filename
                _, err = git.git_push(git.DEFAULT_CODE_REPO, serviceNode.ip)
                if err:
                    self.logger.debug('git-push to %s: %s' % (serviceNode.ip, err))
            else:
                filepath = os.path.join(self.code_repo, config.currentCodeVersion)

            try:
                # UPLOAD TOMCAT CODE TO TOMCAT
                if serviceNode.isRunningBackend:
                    client.updateTomcatCode(
                        serviceNode.ip, 5555, config.currentCodeVersion,
                        config.codeVersions[config.currentCodeVersion].type,
                        filepath)
                if serviceNode.isRunningProxy or serviceNode.isRunningWeb:
                    client.updatePHPCode(
                        serviceNode.ip, 5555, config.currentCodeVersion,
                        config.codeVersions[config.currentCodeVersion].type,
                        filepath)
            except client.AgentException:
                self.logger.exception('Failed to update code at node %s' % str(serviceNode))
                self.state_set(self.S_ERROR, msg='Failed to update code at node %s' % str(serviceNode))
                return
Exemplo n.º 3
0
Arquivo: php.py Projeto: dzeno/conpaas
 def _update_code(self, config, nodes):
   for serviceNode in nodes:
     # Push the current code version via GIT if necessary
     if config.codeVersions[config.currentCodeVersion].type == 'git':
       _, err = git.git_push(git.DEFAULT_CODE_REPO, serviceNode.ip)
       if err:
         self.logger.debug('git-push to %s: %s' % (serviceNode.ip, err))
     
     try:
       client.updatePHPCode(serviceNode.ip, 5555, config.currentCodeVersion, config.codeVersions[config.currentCodeVersion].type, os.path.join(self.code_repo, config.currentCodeVersion))
     except client.AgentException:
       self.logger.exception('Failed to update code at node %s' % str(serviceNode))
       self._state_set(self.S_ERROR, msg='Failed to update code at node %s' % str(serviceNode))
       raise