コード例 #1
0
ファイル: install_remove.py プロジェクト: ponnadarahul/csm
    def _install_remove(self, device, kwargs):
        """
        Performs install remove operation
        """
        SMU_RE = r'CSC\D\D\d\d\d'
        FP_RE = r'fp\d+'
        SP_RE = r'sp\d+'
        tobe_deactivated = []
        pkg_list = kwargs.get('pkg_file', None)
        deact_pkg = pkgutils.NewPackage(pkg_list)
        for pk2 in deact_pkg.pkg_list:
            pk2.partition="disk0"
            if re.match(SMU_RE, pk2.pkg) or re.match(FP_RE, pk2.pkg) or \
                  re.match(SP_RE, pk2.pkg):
                if pk2.arch:
                    pkg = "%s:%s-%s-%s.%s-%s" % (
                      pk2.partition, pk2.platform, pk2.arch,
                      pk2.version, pk2.pkg, pk2.format
                    )
                else:
                    pkg = "%s:%s-%s.%s-%s" % (
                      pk2.partition, pk2.platform,
                      pk2.version, pk2.pkg, pk2.format
                    )

            else:
                if pk2.arch:
                    pkg = "%s:%s-%s-%s-%s" % (
                      pk2.partition, pk2.platform, pk2.pkg, pk2.arch,
                      pk2.version
                    )
                else:
                    pkg = "%s:%s-%s-%s" % (
                      pk2.partition, pk2.platform, pk2.pkg, 
                      pk2.version
                    )

            tobe_deactivated.append(pkg)
        to_deactivate=" ".join( tobe_deactivated)
        deact_list = to_deactivate

        op_success = "The install operation will continue asynchronously"

        cmd = 'admin install remove {} prompt-level none async'.format(
            deact_list)
        success, output = device.execute_command(cmd)
        if success and op_success in output:
            op_id = re.search('Install operation (\d+) \'', output).group(1)
            self._watch_operation(device, op_id)
            get_package(device)
            return True
        else:
            self.error('{} \n {}'.format(cmd, output))
コード例 #2
0
    def install_commit(self, device, kwargs):
        """
        It performs commit operation 
        """
        cmd = "admin install commit"
        success, output = device.execute_command(cmd)
        if success:
            op_id = re.search('Install operation (\d+) \'', output).group(1)
            self.watch_operation(device, op_id)
        else:
            self.error("Command :%s \n%s" % (cmd, output))

        get_package(device)
        return True
コード例 #3
0
ファイル: device_connect.py プロジェクト: ommaurya/csm
    def start(self, device, *args, **kwargs):
        """
        """
        success = None
        try:
            success = device.connect()
        except DeviceError:
            print("Device Error: {}".format(device.error_code))

        if success:
            self.log("Device {} connected successfully.".format(device.name))
            get_package(device)
            return True

        self.error("Can not connect to device {}".format(device.name))
コード例 #4
0
ファイル: install_add.py プロジェクト: ponnadarahul/csm
    def install_add(self, device, kwargs):
        """
        It performs add operation of the pies listed in given file
        """
        file_list = ""
        error_str = "Error:  "
        input_has_tar = False


        repo_str = kwargs.get('repository', None)
        if not repo_str:
            self.error("ERROR:repository not provided")

        pkg_name_list = kwargs.get('pkg_file',None)
        if kwargs.get('turbo_boot',None) and not pkg_name_list :
            # It's okay to have package list empty in case of TB as just vm is used for TB
            # This is not treated as  failure 
            return True

        if not pkg_name_list :
            self.error("Empty packages list ..")
            return False
      
        # skip vm image that's used only in TB
        for pkg in pkg_name_list :
            if pkg.find('.vm-') >= 0:
                pkg_name_list.remove(pkg)
            if pkg.find('.tar') >=0:
                input_has_tar = True
            else :
              if pkg.find('.pie') ==-1:
                 pkg_name_list.remove(pkg)

        packages = " ".join(pkg_name_list) 
        cmd = "admin install add source %s %s async" % (repo_str, packages)
        success, output = device.execute_command(cmd,timeout=4800)
        if success and error_str not in output:
            op_id = re.search('Install operation (\d+) \'', output).group(1)
            self.watch_operation(device,op_id)
            self.update_csm_context(op_id, device, input_has_tar)
        else :
            self.error("Command :%s \n%s"%(cmd,output))
            
        get_package(device)
        return True
コード例 #5
0
ファイル: device_connect.py プロジェクト: ommaurya/csm
    def start(self, device, *args, **kwargs):
        """
        """
        success = None
        try:
            success = device.connect()
        except DeviceError:
            print("Device Error: {}".format(device.error_code))

        if success:
            self.log(
                "Device {} connected successfully.".format(device.name)
            )
            get_package(device)
            return True

        self.error(
            "Can not connect to device {}".format(device.name)
        )
コード例 #6
0
    def _install_act(self, device, kwargs):
        """
        Performs install activate operation
        """
        op_success = "The install operation will continue asynchronously"

        tobe_activated = self._get_tobe_activated_pkglist(device, kwargs)
        if not tobe_activated:
            self.log(
                'The packages are already active, nothing to be activated.')
            return True

        cmd = 'admin install activate {} prompt-level none async'.format(
            tobe_activated)
        success, output = device.execute_command(cmd)
        if success and op_success in output:
            op_id = re.search('Install operation (\d+) \'', output).group(1)
            self._watch_operation(device, op_id)
            get_package(device)
            return True
        else:
            self.error('{} \n {}'.format(cmd, output))
コード例 #7
0
    def install_add(self, device, kwargs):
        """
        It performs add operation of the pies listed in given file
        """
        file_list = ""
        error_str = "Error:  "

        repo_str = kwargs.get('repository', None)
        if not repo_str:
            self.error("ERROR:repository not provided")

        pkg_name_list = kwargs.get('pkg_file', None)
        if kwargs.get('turbo_boot', None) and not pkg_name_list:
            # It's okay to have package list empty in case of TB as just vm is used for TB
            # This is not treated as  failure
            return True

        if not pkg_name_list:
            self.error("Empty packages list ..")
            return False

        # skip vm image that's used only in TB
        for pkg in pkg_name_list:
            if pkg.find('.vm-') >= 0:
                pkg_name_list.remove(pkg)
        packages = " ".join(pkg_name_list)
        cmd = "admin install add source %s %s async" % (repo_str, packages)
        success, output = device.execute_command(cmd)
        if success and error_str not in output:
            op_id = re.search('Install operation (\d+) \'', output).group(1)
            self.watch_operation(device, op_id)
        else:
            self.error("Command :%s \n%s" % (cmd, output))

        get_package(device)
        return True
コード例 #8
0
ファイル: device_pkg_poll.py プロジェクト: ommaurya/csm
 def start(self, device, *args, **kwargs):
     """
     """
     success = None
     get_package(device)
     return True
コード例 #9
0
ファイル: device_pkg_poll.py プロジェクト: ommaurya/csm
 def start(self, device, *args, **kwargs):
     """
     """
     success = None
     get_package(device)
     return True