Example #1
0
    def start(self):
        if not cfg.CONF[self.name].account_id:
            raise exceptions.ConfigurationError('Account ID not configured.')

        # NOTE: Get the underlying provider driver
        cls = provider.get_provider(cfg.CONF[self.name].driver)
        self.client = cls.get_client(cfg.CONF[self.name].api_url)
Example #2
0
    def extend_parser(self, name, parser):
        """
        Extend the parser for the Command from the Provider

        :param name: Name of the command
        :param parser: The Parser object
        """
        provider = get_provider(self.provider)
        provider.extend_parser(name, parser)
Example #3
0
    def execute(self, name, parsed_args, command):
        """
        Execute the command by name from a Provider

        :param name: Name of the command
        :param parsed_args: Parsed arguments
        :param command: The command name to run

        :return: The results of the Provider's command.
        """
        provider = get_provider(self.provider)
        api = provider.get_api(parsed_args, command)

        try:
            command_func = getattr(api, name)
        except AttributeError:
            raise CommandNotSupported('Command is not supported by provider')
        return command_func(parsed_args, command)