Ejemplo n.º 1
0
    def install_parser(self, commands, command_all=False):
        should_install = True
        nb_actions = 0
        # first ensure the current tentacles architecture is setup correctly
        if TentacleUtil.create_missing_tentacles_arch():
            should_install = self._confirm_action(
                "Tentacles installation found on this OctoBot, this action will "
                "replace every local tentacle file and their configuration by their "
                "remote equivalent for the command's tentacles, continue ?")
        if should_install:
            # then process installations
            if command_all:

                self.tentacle_package_manager.set_max_steps(
                    self._get_package_count())
                self.tentacle_package_manager.try_action_on_tentacles_package(
                    TentacleManagerActions.INSTALL, self.default_package,
                    EVALUATOR_DEFAULT_FOLDER)
                for package in self.advanced_package_list:
                    self.tentacle_package_manager.try_action_on_tentacles_package(
                        TentacleManagerActions.INSTALL, package,
                        EVALUATOR_ADVANCED_FOLDER)

                nb_actions = self._get_package_count()
            else:
                nb_actions = len(commands)
                self.tentacle_package_manager.set_max_steps(nb_actions)
                for component in commands:

                    component = TentacleUtil.check_format(component)
                    package, _, localisation, is_url, destination, package_name = self.get_package_in_lists(
                        component)

                    if package:
                        try:
                            self.tentacle_package_manager.process_module(
                                TentacleManagerActions.INSTALL, package,
                                component, localisation, is_url, destination,
                                package_name)

                        except Exception as e:
                            self.logger.error(
                                "Installation failed for tentacle module '{0}'"
                                .format(component))
                            raise e
                    else:
                        self.logger.error(
                            "No installation found for tentacle module '{0}'".
                            format(component))
                    self.tentacle_package_manager.inc_current_step()

            TentaclePackageManager.update_evaluator_config_file()
            TentaclePackageManager.update_trading_config_file()

            return nb_actions
    def install_parser(self, commands, command_all=False, force=False):
        should_install = True
        # first ensure the current tentacles architecture is setup correctly
        if TentacleUtil.create_missing_tentacles_arch() and not force:
            should_install = self._confirm_action(
                self.TENTACLE_INSTALLATION_FOUND_MESSAGE)
        if should_install:
            # then process installations
            if command_all:

                self.tentacle_package_manager.set_max_steps(
                    self._get_package_count())
                self.tentacle_package_manager.try_action_on_tentacles_package(
                    TentacleManagerActions.INSTALL, self.default_package,
                    EVALUATOR_DEFAULT_FOLDER)
                for package in self.advanced_package_list:
                    self.tentacle_package_manager.try_action_on_tentacles_package(
                        TentacleManagerActions.INSTALL, package,
                        EVALUATOR_ADVANCED_FOLDER)

                nb_actions = self._get_package_count()
            else:
                nb_actions = len(commands)
                self.tentacle_package_manager.set_max_steps(nb_actions)
                for component in commands:

                    component = TentacleUtil.check_format(component)
                    package, _, localisation, is_url, destination, package_name = self.get_package_in_lists(
                        component)

                    if package:
                        try:
                            self.tentacle_package_manager.process_module(
                                TentacleManagerActions.INSTALL, package,
                                component, localisation, is_url, destination,
                                package_name)

                        except Exception as e:
                            self.logger.error(
                                f"Installation failed for tentacle module '{component}'"
                            )
                            raise e
                    else:
                        self.logger.error(
                            f"No installation found for tentacle module '{component}'"
                        )
                    self.tentacle_package_manager.inc_current_step()

            TentaclePackageManager.update_evaluator_config_file()
            TentaclePackageManager.update_trading_config_file()

            return nb_actions
 def install_tentacle_package(self, package_path_or_url, force=False):
     self.update_list()
     package = TentaclePackageUtil.get_package_description_with_adaptation(
         package_path_or_url)
     should_install = force
     if TentacleUtil.create_missing_tentacles_arch() and not force:
         should_install = self._confirm_action(
             self.TENTACLE_INSTALLATION_FOUND_MESSAGE)
     if should_install:
         self.tentacle_package_manager.set_max_steps(len(package) - 1)
         self.tentacle_package_manager.try_action_on_tentacles_package(
             TentacleManagerActions.INSTALL, package,
             EVALUATOR_ADVANCED_FOLDER)
Ejemplo n.º 4
0
 def install_tentacle_package(self, package_path_or_url, force=False):
     self.update_list()
     package = TentaclePackageUtil.get_package_description_with_adaptation(
         package_path_or_url)
     should_install = force
     if TentacleUtil.create_missing_tentacles_arch() and not force:
         should_install = self._confirm_action(
             "Tentacles installation found on this OctoBot, this action will "
             "replace every local tentacle file and their configuration by their "
             "remote equivalent for the command's tentacles, continue ?")
     if should_install:
         self.tentacle_package_manager.set_max_steps(len(package) - 1)
         self.tentacle_package_manager.try_action_on_tentacles_package(
             TentacleManagerActions.INSTALL, package,
             EVALUATOR_ADVANCED_FOLDER)
Ejemplo n.º 5
0
 def reset_tentacles(self):
     self.logger.info("Removing tentacles.")
     TentacleUtil.delete_tentacles_arch()
     TentacleUtil.create_missing_tentacles_arch()
     self.logger.info("Tentacles reset.")