Merge "Replace "openstack metric metric..." commands"
This commit is contained in:
commit
0bb384ce1b
|
@ -12,6 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
import json
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from cliff import command
|
||||
|
@ -21,6 +22,9 @@ from cliff import show
|
|||
from gnocchiclient import utils
|
||||
|
||||
|
||||
LOG_DEP = logging.getLogger('deprecated')
|
||||
|
||||
|
||||
class CliMetricWithResourceID(command.Command):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliMetricWithResourceID, self).get_parser(prog_name)
|
||||
|
@ -56,6 +60,15 @@ class CliMetricList(lister.Lister):
|
|||
return utils.list2cols(self.COLS, metrics)
|
||||
|
||||
|
||||
class DeprecatedCliMetricList(CliMetricList):
|
||||
"""Deprecated: List metrics"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
LOG_DEP.warning('This command has been deprecated. '
|
||||
'Please use "metric list" instead.')
|
||||
return super(DeprecatedCliMetricList, self).take_action(parsed_args)
|
||||
|
||||
|
||||
class CliMetricShow(CliMetricWithResourceID, show.ShowOne):
|
||||
"""Show a metric"""
|
||||
|
||||
|
@ -75,6 +88,15 @@ class CliMetricShow(CliMetricWithResourceID, show.ShowOne):
|
|||
return self.dict2columns(metric)
|
||||
|
||||
|
||||
class DeprecatedCliMetricShow(CliMetricShow):
|
||||
"""Deprecated: Show a metric"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
LOG_DEP.warning('This command has been deprecated. '
|
||||
'Please use "metric show" instead.')
|
||||
return super(DeprecatedCliMetricShow, self).take_action(parsed_args)
|
||||
|
||||
|
||||
class CliMetricCreateBase(show.ShowOne, CliMetricWithResourceID):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(CliMetricCreateBase, self).get_parser(prog_name)
|
||||
|
@ -114,6 +136,15 @@ class CliMetricCreate(CliMetricCreateBase):
|
|||
return self.dict2columns(metric)
|
||||
|
||||
|
||||
class DeprecatedCliMetricCreate(CliMetricCreate):
|
||||
"""Deprecated: Create a metric"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
LOG_DEP.warning('This command has been deprecated. '
|
||||
'Please use "metric create" instead.')
|
||||
return super(DeprecatedCliMetricCreate, self).take_action(parsed_args)
|
||||
|
||||
|
||||
class CliMetricDelete(CliMetricWithResourceID):
|
||||
"""Delete a metric"""
|
||||
|
||||
|
@ -129,6 +160,15 @@ class CliMetricDelete(CliMetricWithResourceID):
|
|||
metric=metric, resource_id=parsed_args.resource_id)
|
||||
|
||||
|
||||
class DeprecatedCliMetricDelete(CliMetricDelete):
|
||||
"""Deprecated: Delete a metric"""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
LOG_DEP.warning('This command has been deprecated. '
|
||||
'Please use "metric delete" instead.')
|
||||
return super(DeprecatedCliMetricDelete, self).take_action(parsed_args)
|
||||
|
||||
|
||||
class CliMeasuresShow(CliMetricWithResourceID, lister.Lister):
|
||||
"""Get measurements of a metric"""
|
||||
|
||||
|
|
14
setup.cfg
14
setup.cfg
|
@ -57,11 +57,15 @@ openstack.metric.v1 =
|
|||
metric_archive-policy-rule_show = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleShow
|
||||
metric_archive-policy-rule_create = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleCreate
|
||||
metric_archive-policy-rule_delete = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleDelete
|
||||
# FIXME(sileht): "openstack metric metric list" is not really sexy
|
||||
metric_metric_list = gnocchiclient.v1.metric_cli:CliMetricList
|
||||
metric_metric_show = gnocchiclient.v1.metric_cli:CliMetricShow
|
||||
metric_metric_create = gnocchiclient.v1.metric_cli:CliMetricCreate
|
||||
metric_metric_delete = gnocchiclient.v1.metric_cli:CliMetricDelete
|
||||
# FIXME(rabel): Deprecate metric_metric entry points
|
||||
metric_metric_list = gnocchiclient.v1.metric_cli:DeprecatedCliMetricList
|
||||
metric_metric_show = gnocchiclient.v1.metric_cli:DeprecatedCliMetricShow
|
||||
metric_metric_create = gnocchiclient.v1.metric_cli:DeprecatedCliMetricCreate
|
||||
metric_metric_delete = gnocchiclient.v1.metric_cli:DeprecatedCliMetricDelete
|
||||
metric_list = gnocchiclient.v1.metric_cli:CliMetricList
|
||||
metric_show = gnocchiclient.v1.metric_cli:CliMetricShow
|
||||
metric_create = gnocchiclient.v1.metric_cli:CliMetricCreate
|
||||
metric_delete = gnocchiclient.v1.metric_cli:CliMetricDelete
|
||||
metric_measures_show = gnocchiclient.v1.metric_cli:CliMeasuresShow
|
||||
metric_measures_add = gnocchiclient.v1.metric_cli:CliMeasuresAdd
|
||||
metric_measures_batch-metrics = gnocchiclient.v1.metric_cli:CliMetricsMeasuresBatch
|
||||
|
|
Loading…
Reference in New Issue