Use 'archive policy' instead of 'archivepolicy'
This commit is contained in:
@@ -54,8 +54,8 @@ def gen_ref(ver, title, names):
|
||||
"signs": "=" * len(name),
|
||||
"pkg": pkg, "name": name})
|
||||
|
||||
gen_ref("v1", "Version 1 API", ["client", "resource", "archivepolicy",
|
||||
"archivepolicyrule"])
|
||||
gen_ref("v1", "Version 1 API", ["client", "resource", "archive_policy",
|
||||
"archive_policy_rule"])
|
||||
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
|
||||
@@ -17,21 +17,21 @@ class ArchivePolicyClientTest(base.ClientTestBase):
|
||||
def test_archive_policy_scenario(self):
|
||||
# CREATE
|
||||
result = self.gnocchi(
|
||||
u'archivepolicy', params=u"create low"
|
||||
u" --back-window 0"
|
||||
u" -d granularity:1s,points:86400")
|
||||
u'archive policy', params=u"create low"
|
||||
u" --back-window 0"
|
||||
u" -d granularity:1s,points:86400")
|
||||
policy = self.details_multiple(result)[0]
|
||||
self.assertEqual('low', policy["name"])
|
||||
|
||||
# GET
|
||||
result = self.gnocchi(
|
||||
'archivepolicy', params="show low")
|
||||
'archive policy', params="show low")
|
||||
policy = self.details_multiple(result)[0]
|
||||
self.assertEqual("low", policy["name"])
|
||||
|
||||
# LIST
|
||||
result = self.gnocchi(
|
||||
'archivepolicy', params="list")
|
||||
'archive policy', params="list")
|
||||
policies = self.parser.listing(result)
|
||||
policy_from_list = [p for p in policies
|
||||
if p['name'] == 'low'][0]
|
||||
@@ -39,19 +39,19 @@ class ArchivePolicyClientTest(base.ClientTestBase):
|
||||
self.assertEqual(policy[field], policy_from_list[field])
|
||||
|
||||
# DELETE
|
||||
result = self.gnocchi('archivepolicy',
|
||||
result = self.gnocchi('archive policy',
|
||||
params="delete low")
|
||||
self.assertEqual("", result)
|
||||
|
||||
# GET FAIL
|
||||
result = self.gnocchi('archivepolicy',
|
||||
result = self.gnocchi('archive policy',
|
||||
params="show low",
|
||||
fail_ok=True, merge_stderr=True)
|
||||
self.assertFirstLineStartsWith(result.split('\n'),
|
||||
"Not Found (HTTP 404)")
|
||||
|
||||
# DELETE FAIL
|
||||
result = self.gnocchi('archivepolicy',
|
||||
result = self.gnocchi('archive policy',
|
||||
params="delete low",
|
||||
fail_ok=True, merge_stderr=True)
|
||||
self.assertFirstLineStartsWith(result.split('\n'),
|
||||
|
||||
@@ -17,20 +17,20 @@ class ArchivePolicyRuleClientTest(base.ClientTestBase):
|
||||
def test_archive_policy_rule_scenario(self):
|
||||
# CREATE
|
||||
result = self.gnocchi(
|
||||
u'archivepolicyrule', params=u"create test"
|
||||
u" --archive-policy high"
|
||||
u" --metric-pattern 'disk.io.*'")
|
||||
u'archive policy rule', params=u"create test"
|
||||
u" --archive-policy high"
|
||||
u" --metric-pattern 'disk.io.*'")
|
||||
policy_rule = self.details_multiple(result)[0]
|
||||
self.assertEqual('test', policy_rule["name"])
|
||||
|
||||
# GET
|
||||
result = self.gnocchi(
|
||||
'archivepolicyrule', params="show test")
|
||||
'archive policy rule', params="show test")
|
||||
policy_rule = self.details_multiple(result)[0]
|
||||
self.assertEqual("test", policy_rule["name"])
|
||||
|
||||
# LIST
|
||||
result = self.gnocchi('archivepolicyrule', params="list")
|
||||
result = self.gnocchi('archive policy rule', params="list")
|
||||
rules = self.parser.listing(result)
|
||||
rule_from_list = [p for p in rules
|
||||
if p['name'] == 'test'][0]
|
||||
@@ -38,19 +38,19 @@ class ArchivePolicyRuleClientTest(base.ClientTestBase):
|
||||
self.assertEqual(policy_rule[field], rule_from_list[field])
|
||||
|
||||
# DELETE
|
||||
result = self.gnocchi('archivepolicyrule',
|
||||
result = self.gnocchi('archive policy rule',
|
||||
params="delete test")
|
||||
self.assertEqual("", result)
|
||||
|
||||
# GET FAIL
|
||||
result = self.gnocchi('archivepolicyrule',
|
||||
result = self.gnocchi('archive policy rule',
|
||||
params="show test",
|
||||
fail_ok=True, merge_stderr=True)
|
||||
self.assertFirstLineStartsWith(result.split('\n'),
|
||||
"Not Found (HTTP 404)")
|
||||
|
||||
# DELETE FAIL
|
||||
result = self.gnocchi('archivepolicyrule',
|
||||
result = self.gnocchi('archive policy rule',
|
||||
params="delete test",
|
||||
fail_ok=True, merge_stderr=True)
|
||||
self.assertFirstLineStartsWith(result.split('\n'),
|
||||
|
||||
@@ -23,7 +23,7 @@ class CliArchivePolicyList(lister.Lister):
|
||||
'back_window', 'definition', 'aggregation_methods')
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
policies = self.app.client.archivepolicy.list()
|
||||
policies = self.app.client.archive_policy.list()
|
||||
for ap in policies:
|
||||
utils.format_dict_list(ap, "definition")
|
||||
utils.format_string_list(ap, "aggregation_methods")
|
||||
@@ -38,7 +38,7 @@ class CliArchivePolicyShow(show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
ap = self.app.client.archivepolicy.get(
|
||||
ap = self.app.client.archive_policy.get(
|
||||
name=parsed_args.name)
|
||||
utils.format_dict_list(ap, "definition")
|
||||
utils.format_string_list(ap, "aggregation_methods")
|
||||
@@ -83,7 +83,7 @@ class CliArchivePolicyCreate(show.ShowOne):
|
||||
archive_policy = utils.dict_from_parsed_args(
|
||||
parsed_args, ['name', 'back_window', 'aggregation_methods',
|
||||
'definition'])
|
||||
policy = self.app.client.archivepolicy.create(
|
||||
policy = self.app.client.archive_policy.create(
|
||||
archive_policy=archive_policy)
|
||||
return self.dict2columns(policy)
|
||||
|
||||
@@ -96,4 +96,4 @@ class CliArchivePolicyDelete(command.Command):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.client.archivepolicy.delete(name=parsed_args.name)
|
||||
self.app.client.archive_policy.delete(name=parsed_args.name)
|
||||
@@ -22,7 +22,7 @@ class CliArchivePolicyRuleList(lister.Lister):
|
||||
COLS = ('name', 'archive_policy_name', 'metric_pattern')
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
ap_rules = self.app.client.archivepolicyrule.list()
|
||||
ap_rules = self.app.client.archive_policy_rule.list()
|
||||
return utils.list2cols(self.COLS, ap_rules)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class CliArchivePolicyRuleShow(show.ShowOne):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
ap_rule = self.app.client.archivepolicyrule.get(
|
||||
ap_rule = self.app.client.archive_policy_rule.get(
|
||||
name=parsed_args.name)
|
||||
return self.dict2columns(ap_rule)
|
||||
|
||||
@@ -56,7 +56,7 @@ class CliArchivePolicyRuleCreate(show.ShowOne):
|
||||
def take_action(self, parsed_args):
|
||||
rule = utils.dict_from_parsed_args(
|
||||
parsed_args, ["name", "metric_pattern", "archive_policy_name"])
|
||||
policy = self.app.client.archivepolicyrule.create(rule)
|
||||
policy = self.app.client.archive_policy_rule.create(rule)
|
||||
return self.dict2columns(policy)
|
||||
|
||||
|
||||
@@ -68,4 +68,4 @@ class CliArchivePolicyRuleDelete(command.Command):
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.client.archivepolicyrule.delete(parsed_args.name)
|
||||
self.app.client.archive_policy_rule.delete(parsed_args.name)
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
from keystoneclient import session as keystoneclient_session
|
||||
|
||||
from gnocchiclient.v1 import archivepolicy
|
||||
from gnocchiclient.v1 import archivepolicyrule
|
||||
from gnocchiclient.v1 import archive_policy
|
||||
from gnocchiclient.v1 import archive_policy_rule
|
||||
from gnocchiclient.v1 import resource
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ class Client(object):
|
||||
"""Initialize a new client for the Gnocchi v1 API."""
|
||||
self.api = keystoneclient_session.Session(auth, **kwargs)
|
||||
self.resource = resource.ResourceManager(self)
|
||||
self.archivepolicy = archivepolicy.ArchivePolicyManager(self)
|
||||
self.archivepolicyrule = archivepolicyrule.ArchivePolicyRuleManager(
|
||||
self)
|
||||
self.archive_policy = archive_policy.ArchivePolicyManager(self)
|
||||
self.archive_policy_rule = (
|
||||
archive_policy_rule.ArchivePolicyRuleManager(self))
|
||||
self.interface = interface
|
||||
self.region_name = region_name
|
||||
self._endpoint = endpoint
|
||||
|
||||
30
setup.cfg
30
setup.cfg
@@ -28,21 +28,21 @@ console_scripts =
|
||||
gnocchi = gnocchiclient.shell:main
|
||||
|
||||
gnocchi.cli.v1 =
|
||||
resource_list = gnocchiclient.v1.resourcecli:CliResourceList
|
||||
resource_show = gnocchiclient.v1.resourcecli:CliResourceShow
|
||||
resource_history = gnocchiclient.v1.resourcecli:CliResourceHistory
|
||||
resource_search = gnocchiclient.v1.resourcecli:CliResourceSearch
|
||||
resource_create = gnocchiclient.v1.resourcecli:CliResourceCreate
|
||||
resource_update = gnocchiclient.v1.resourcecli:CliResourceUpdate
|
||||
resource_delete = gnocchiclient.v1.resourcecli:CliResourceDelete
|
||||
archivepolicy_list = gnocchiclient.v1.archivepolicycli:CliArchivePolicyList
|
||||
archivepolicy_show = gnocchiclient.v1.archivepolicycli:CliArchivePolicyShow
|
||||
archivepolicy_create = gnocchiclient.v1.archivepolicycli:CliArchivePolicyCreate
|
||||
archivepolicy_delete = gnocchiclient.v1.archivepolicycli:CliArchivePolicyDelete
|
||||
archivepolicyrule_list = gnocchiclient.v1.archivepolicyrulecli:CliArchivePolicyRuleList
|
||||
archivepolicyrule_show = gnocchiclient.v1.archivepolicyrulecli:CliArchivePolicyRuleShow
|
||||
archivepolicyrule_create = gnocchiclient.v1.archivepolicyrulecli:CliArchivePolicyRuleCreate
|
||||
archivepolicyrule_delete = gnocchiclient.v1.archivepolicyrulecli:CliArchivePolicyRuleDelete
|
||||
resource_list = gnocchiclient.v1.resource_cli:CliResourceList
|
||||
resource_show = gnocchiclient.v1.resource_cli:CliResourceShow
|
||||
resource_history = gnocchiclient.v1.resource_cli:CliResourceHistory
|
||||
resource_search = gnocchiclient.v1.resource_cli:CliResourceSearch
|
||||
resource_create = gnocchiclient.v1.resource_cli:CliResourceCreate
|
||||
resource_update = gnocchiclient.v1.resource_cli:CliResourceUpdate
|
||||
resource_delete = gnocchiclient.v1.resource_cli:CliResourceDelete
|
||||
archive_policy_list = gnocchiclient.v1.archive_policy_cli:CliArchivePolicyList
|
||||
archive_policy_show = gnocchiclient.v1.archive_policy_cli:CliArchivePolicyShow
|
||||
archive_policy_create = gnocchiclient.v1.archive_policy_cli:CliArchivePolicyCreate
|
||||
archive_policy_delete = gnocchiclient.v1.archive_policy_cli:CliArchivePolicyDelete
|
||||
archive_policy_rule_list = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleList
|
||||
archive_policy_rule_show = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleShow
|
||||
archive_policy_rule_create = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleCreate
|
||||
archive_policy_rule_delete = gnocchiclient.v1.archive_policy_rule_cli:CliArchivePolicyRuleDelete
|
||||
|
||||
keystoneclient.auth.plugin =
|
||||
gnocchi-noauth = gnocchiclient.noauth:GnocchiNoAuthPlugin
|
||||
|
||||
Reference in New Issue
Block a user