コード例 #1
0
ファイル: shell.py プロジェクト: glucas1/python-troveclient
def do_datastore_version_show(cs, args):
    """Shows details of a datastore version."""
    if args.datastore:
        datastore_version = cs.datastore_versions.get(args.datastore,
                                                      args.datastore_version)
    elif utils.is_uuid_like(args.datastore_version):
        datastore_version = cs.datastore_versions.get_by_uuid(
            args.datastore_version)
    else:
        raise exceptions.NoUniqueMatch('The datastore name or id is required'
                                       ' to retrieve a datastore version'
                                       ' by name.')
    _print_instance(datastore_version)
コード例 #2
0
def do_configuration_parameter_list(cs, args):
    """Lists available parameters for a configuration group."""
    if args.datastore:
        params = cs.configuration_parameters.parameters(
            args.datastore, args.datastore_version)
    elif utils.is_uuid_like(args.datastore_version):
        params = cs.configuration_parameters.parameters_by_version(
            args.datastore_version)
    else:
        raise exceptions.NoUniqueMatch('The datastore name or id is required'
                                       ' to retrieve the parameters for the'
                                       ' configuration group by name.')
    utils.print_list(params,
                     ['name', 'type', 'min', 'max', 'restart_required'])
コード例 #3
0
 def take_action(self, parsed_args):
     datastore_version_client =\
         self.app.client_manager.database.datastore_versions
     if parsed_args.datastore:
         datastore_version = datastore_version_client.\
             get(parsed_args.datastore, parsed_args.datastore_version)
     elif tc_utils.is_uuid_like(parsed_args.datastore_version):
         datastore_version = datastore_version_client.\
             get_by_uuid(parsed_args.datastore_version)
     else:
         raise exceptions.NoUniqueMatch(_('The datastore name or id is'
                                          ' required to retrieve a'
                                          ' datastore version by name.'))
     if datastore_version._info.get('links'):
         del (datastore_version._info['links'])
     return zip(*sorted(datastore_version._info.items()))
コード例 #4
0
    def take_action(self, parsed_args):
        db_configuration_parameters = self.app.client_manager.database. \
            configuration_parameters

        if uuidutils.is_uuid_like(parsed_args.datastore_version):
            param = db_configuration_parameters.get_parameter_by_version(
                parsed_args.datastore_version, parsed_args.parameter)
        elif parsed_args.datastore:
            param = db_configuration_parameters.get_parameter(
                parsed_args.datastore, parsed_args.datastore_version,
                parsed_args.parameter)
        else:
            raise exceptions.NoUniqueMatch(
                _('Either datastore version ID or '
                  'datastore name needs to be '
                  'specified.'))

        return zip(*sorted(param._info.items()))
コード例 #5
0
 def take_action(self, parsed_args):
     db_configuration_parameters = self.app.client_manager.database.\
         configuration_parameters
     if parsed_args.datastore:
         param = db_configuration_parameters.get_parameter(
             parsed_args.datastore, parsed_args.datastore_version,
             parsed_args.parameter)
     elif utils.is_uuid_like(parsed_args.datastore_version):
         param = db_configuration_parameters.get_parameter_by_version(
             parsed_args.datastore_version, parsed_args.parameter)
     else:
         raise exceptions.NoUniqueMatch(
             _('The datastore name or id is'
               ' required to retrieve the'
               ' parameter for the'
               ' configuration group'
               ' by name.'))
     return zip(*sorted(six.iteritems(param._info)))
コード例 #6
0
    def take_action(self, parsed_args):
        db_configuration_parameters = self.app.client_manager.\
            database.configuration_parameters

        if uuidutils.is_uuid_like(parsed_args.datastore_version):
            params = db_configuration_parameters.parameters_by_version(
                parsed_args.datastore_version)
        elif parsed_args.datastore:
            params = db_configuration_parameters.parameters(
                parsed_args.datastore, parsed_args.datastore_version)
        else:
            raise exceptions.NoUniqueMatch(
                _('Either datastore version ID or '
                  'datastore name needs to be '
                  'specified.'))

        for param in params:
            setattr(param, 'min_size', getattr(param, 'min', '-'))
            setattr(param, 'max_size', getattr(param, 'max', '-'))
        params = [
            osc_utils.get_item_properties(p, self.columns) for p in params
        ]
        return self.columns, params
コード例 #7
0
 def take_action(self, parsed_args):
     db_configuration_parameters = self.app.client_manager.\
         database.configuration_parameters
     if parsed_args.datastore:
         params = db_configuration_parameters.\
             parameters(parsed_args.datastore,
                        parsed_args.datastore_version)
     elif utils.is_uuid_like(parsed_args.datastore_version):
         params = db_configuration_parameters.\
             parameters_by_version(parsed_args.datastore_version)
     else:
         raise exceptions.NoUniqueMatch(
             _('The datastore name or id is'
               ' required to retrieve the'
               ' parameters for the'
               ' configuration group'
               ' by name.'))
     for param in params:
         setattr(param, 'min_size', getattr(param, 'min', '-'))
         setattr(param, 'max_size', getattr(param, 'max', '-'))
     params = [
         osc_utils.get_item_properties(p, self.columns) for p in params
     ]
     return self.columns, params