From f519a9d44c6c2b1049a7751216de001b11fae718 Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Wed, 19 Aug 2020 14:13:47 +0530 Subject: [PATCH 1/2] Fix pep8 E741 errors --- gnocchiclient/utils.py | 8 ++++---- gnocchiclient/v1/resource_cli.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gnocchiclient/utils.py b/gnocchiclient/utils.py index 71ce37d..1123881 100644 --- a/gnocchiclient/utils.py +++ b/gnocchiclient/utils.py @@ -38,15 +38,15 @@ def list2cols(cols, objs): for o in objs] -def format_string_list(l): - return ", ".join(l) +def format_string_list(li): + return ", ".join(li) -def format_dict_list(l): +def format_dict_list(li): return "\n".join( "- " + ", ".join("%s: %s" % (k, v) for k, v in elem.items()) - for elem in l) + for elem in li) def format_dict_dict(value): diff --git a/gnocchiclient/v1/resource_cli.py b/gnocchiclient/v1/resource_cli.py index 5ed3c9c..380f973 100644 --- a/gnocchiclient/v1/resource_cli.py +++ b/gnocchiclient/v1/resource_cli.py @@ -198,10 +198,10 @@ def _resource_from_args(self, parsed_args, update=False): resource['metrics'][name] = value for metric in parsed_args.create_metric: name, _, value = metric.partition(":") - if value is "": - resource['metrics'][name] = {} - else: + if value: resource['metrics'][name] = {'archive_policy_name': value} + else: + resource['metrics'][name] = {} return resource From 0c8e21bb16b1ca7ac9a35170097601ff2056840d Mon Sep 17 00:00:00 2001 From: Rabi Mishra Date: Sat, 15 Aug 2020 14:58:11 +0530 Subject: [PATCH 2/2] Don't use '*/*' in accept header Pecan 1.4 uses accept header to decide the response content type. Let's not use '*/*" in accept header as it returns text/plain in case of errors. --- gnocchiclient/v1/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnocchiclient/v1/base.py b/gnocchiclient/v1/base.py index 2e863d9..398b30b 100644 --- a/gnocchiclient/v1/base.py +++ b/gnocchiclient/v1/base.py @@ -18,7 +18,7 @@ class Manager(object): DEFAULT_HEADERS = { - "Accept": "application/json, */*", + "Accept": "application/json", } def __init__(self, client):