Ejemplo n.º 1
0
    def start(manager, device, *args, **kwargs):
        """
        Performs install remove operation
        """
        try:
            packages = manager.csm.software_packages
        except AttributeError:
            manager.error("No package list provided")
            return

        deact_pkgs = package_lib.NewPackage(packages)
        installed_inact = device.send("admin show install inactive summary")
        inactive_pkgs = package_lib.OnboxPackage(installed_inact, "Inactive Packages")

        packages_to_remove = package_lib.package_intersection(deact_pkgs.pkg_list, inactive_pkgs.pkg_list)
        if not packages_to_remove:
            manager.warning("Packages already removed. Nothing to be removed")
            get_package(device, manager)
            return

        to_remove = " ".join(packages_to_remove)

        cmd = 'admin install remove {} prompt-level none async'.format(to_remove)

        manager.log("Remove Package(s) Pending")
        install_add_remove(manager, device, cmd)
        manager.log("Package(s) Removed Successfully")
Ejemplo n.º 2
0
    def start(manager, device, *args, **kwargs):
        """
        Performs install remove operation
        """
        try:
            packages = manager.csm.software_packages
        except AttributeError:
            manager.error("No package list provided")
            return

        deact_pkgs = package_lib.NewPackage(packages)
        installed_inact = device.send("admin show install inactive summary")
        inactive_pkgs = package_lib.OnboxPackage(installed_inact,
                                                 "Inactive Packages")

        packages_to_remove = package_lib.package_intersection(
            deact_pkgs.pkg_list, inactive_pkgs.pkg_list)
        if not packages_to_remove:
            manager.warning("Packages already removed. Nothing to be removed")
            get_package(device, manager)
            return

        to_remove = " ".join(packages_to_remove)

        cmd = 'admin install remove {} prompt-level none async'.format(
            to_remove)

        manager.log("Remove Package(s) Pending")
        install_add_remove(manager, device, cmd)
        manager.log("Package(s) Removed Successfully")
Ejemplo n.º 3
0
    def start(manager, device, *args, **kwargs):
        """
        It performs commit operation 
        """

        failed_oper = r'Install operation (\d+) failed'
        completed_with_failure = 'Install operation (\d+) completed with failure'
        success_oper = r'Install operation (\d+) completed successfully'

        cmd = "admin install commit"
        output = device.send(cmd)
        result = re.search('Install operation (\d+) \'', output)
        if result:
            op_id = result.group(1)
            watch_operation(manager, device, op_id)
        else:
            manager.log_install_errors(output)
            manager.error("Operation ID not found.")

        cmd = "admin show install log {} detail".format(op_id)
        output = device.send(cmd)

        if re.search(failed_oper, output):
            manager.log_install_errors(output)
            manager.error("Install operation failed.")

        if re.search(completed_with_failure, output):
            manager.log_install_errors(output)
            manager.log("Completed with failure but failure was after Point of No Return.")

        elif re.search(success_oper, output):
            manager.log("Operation {} finished successfully.".format(op_id))

        get_package(device, manager)
Ejemplo n.º 4
0
    def start(manager, device, *args, **kwargs):
        """
        It performs commit operation 
        """

        failed_oper = r'Install operation (\d+) failed'
        completed_with_failure = 'Install operation (\d+) completed with failure'
        success_oper = r'Install operation (\d+) completed successfully'

        cmd = "admin install commit"
        output = device.send(cmd)
        result = re.search('Install operation (\d+) \'', output)
        if result:
            op_id = result.group(1)
            watch_operation(manager, device, op_id)
        else:
            manager.log_install_errors(output)
            manager.error("Operation ID not found.")

        cmd = "admin show install log {} detail".format(op_id)
        output = device.send(cmd)

        if re.search(failed_oper, output):
            manager.log_install_errors(output)
            manager.error("Install operation failed.")

        if re.search(completed_with_failure, output):
            manager.log_install_errors(output)
            manager.log(
                "Completed with failure but failure was after Point of No Return."
            )

        elif re.search(success_oper, output):
            manager.log("Operation {} finished successfully.".format(op_id))

        get_package(device, manager)