def shutdown(self, context):
        """Sends a graceful shutdown to the device.

        :param ResourceCommandContext context: The context object
         for the command with resource and reservation info
        """
        logger = get_logger_with_thread_id(context)
        logger.info("Shutdown command started")

        with ErrorHandlingContext(logger):
            resource_config = create_firewall_resource_from_context(
                self.SHELL_NAME, self.SUPPORTED_OS, context
            )
            cs_api = get_api(context)

            cli_handler = F5CliHandler(self._cli, resource_config, logger, cs_api)

            state_operations = StateRunner(
                logger=logger,
                api=cs_api,
                resource_config=resource_config,
                cli_handler=cli_handler,
            )

            response = state_operations.shutdown()
            logger.info("Shutdown command completed with response: {}".format(response))

            return response
Exemple #2
0
    def shutdown(self, context):
        logger = get_logger_with_thread_id(context)
        api = get_api(context)

        resource_config = create_networking_resource_from_context(shell_name=self.SHELL_NAME,
                                                                  supported_os=self.SUPPORTED_OS,
                                                                  context=context)
        cli_handler = JuniperCliHandler(self._cli, resource_config, logger, api)

        state_operations = StateRunner(logger, api, resource_config, cli_handler)
        return state_operations.shutdown()
    def shutdown(self, context):
        """Sends a graceful shutdown to the device

        :param ResourceCommandContext context: The context object for the command with resource and
            reservation info
        """

        logger = get_logger_with_thread_id(context)
        api = get_api(context)

        resource_config = create_resource_from_context(self.SHELL_NAME, self.SUPPORTED_OS, context)
        cli_handler = CliHandler(self._cli, resource_config, logger, api)

        state_operations = StateRunner(logger, api, resource_config, cli_handler)
        return state_operations.shutdown()
    def shutdown(self, context):
        """ Shutdown device

        :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside
        :return:
        """

        logger = get_logger_with_thread_id(context)
        api = get_api(context)

        resource_config = create_networking_resource_from_context(shell_name=self.SHELL_NAME,
                                                                  supported_os=self.SUPPORTED_OS,
                                                                  context=context)

        cli_handler = CliHandler(self._cli, resource_config, logger, api)
        state_operations = StateRunner(logger=logger, api=api, resource_config=resource_config, cli_handler=cli_handler)

        return state_operations.shutdown()
    def shutdown(self, context):
        """ Shutdown device

        :param ResourceCommandContext context: ResourceCommandContext object with all Resource
            Attributes inside
        :return:
        """

        logger = get_logger_with_thread_id(context)
        api = get_api(context)

        resource_config = create_networking_resource_from_context(
            self.SHELL_NAME, self.SUPPORTED_OS, context)
        cli_handler = CliHandler(self._cli, resource_config, logger, api)

        state_operations = StateRunner(logger, api, resource_config,
                                       cli_handler)
        return state_operations.shutdown()