cosmetic change
change from double quote to single quote Change-Id: Id0b3f6c88b4338e5c86577bd584594fefc8413ae
This commit is contained in:
parent
45819a0ec1
commit
13c8e61dd9
@ -25,9 +25,9 @@ class ClientException(Exception):
|
|||||||
self.method = method
|
self.method = method
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
formatted_string = "%s (HTTP %s)" % (self.message, self.code)
|
formatted_string = '%s (HTTP %s)' % (self.message, self.code)
|
||||||
if self.request_id:
|
if self.request_id:
|
||||||
formatted_string += " (Request-ID: %s)" % self.request_id
|
formatted_string += ' (Request-ID: %s)' % self.request_id
|
||||||
|
|
||||||
return formatted_string
|
return formatted_string
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class VitrageNoAuthLoader(loading.BaseLoader):
|
|||||||
options.extend([
|
options.extend([
|
||||||
VitrageOpt('user-id', help='User ID', required=True),
|
VitrageOpt('user-id', help='User ID', required=True),
|
||||||
VitrageOpt('project-id', help='Project ID', required=True),
|
VitrageOpt('project-id', help='Project ID', required=True),
|
||||||
VitrageOpt('roles', help='Roles', default="admin"),
|
VitrageOpt('roles', help='Roles', default='admin'),
|
||||||
VitrageOpt('vitrage-endpoint', help='Vitrage endpoint',
|
VitrageOpt('vitrage-endpoint', help='Vitrage endpoint',
|
||||||
dest="endpoint", required=True),
|
dest="endpoint", required=True),
|
||||||
])
|
])
|
||||||
|
@ -38,11 +38,11 @@ from vitrageclient import __version__
|
|||||||
|
|
||||||
class VitrageCommandManager(commandmanager.CommandManager):
|
class VitrageCommandManager(commandmanager.CommandManager):
|
||||||
COMMANDS = {
|
COMMANDS = {
|
||||||
"topology show": topology.TopologyShow,
|
'topology show': topology.TopologyShow,
|
||||||
"resource show": resource.ResourceShow,
|
'resource show': resource.ResourceShow,
|
||||||
"resource list": resource.ResourceList,
|
'resource list': resource.ResourceList,
|
||||||
"alarms list": alarms.AlarmsList,
|
'alarms list': alarms.AlarmsList,
|
||||||
"rca show": rca.RcaShow,
|
'rca show': rca.RcaShow,
|
||||||
}
|
}
|
||||||
|
|
||||||
def load_commands(self, namespace):
|
def load_commands(self, namespace):
|
||||||
@ -100,7 +100,7 @@ class VitrageShell(app.App):
|
|||||||
help='Defaults to env[VITRAGE_API_VERSION] or 1.')
|
help='Defaults to env[VITRAGE_API_VERSION] or 1.')
|
||||||
loading.register_session_argparse_arguments(parser=parser)
|
loading.register_session_argparse_arguments(parser=parser)
|
||||||
plugin = loading.register_auth_argparse_arguments(
|
plugin = loading.register_auth_argparse_arguments(
|
||||||
parser=parser, argv=sys.argv, default="password")
|
parser=parser, argv=sys.argv, default='password')
|
||||||
|
|
||||||
if not isinstance(plugin, noauth.VitrageNoAuthLoader):
|
if not isinstance(plugin, noauth.VitrageNoAuthLoader):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -115,7 +115,7 @@ class VitrageShell(app.App):
|
|||||||
@property
|
@property
|
||||||
def client(self):
|
def client(self):
|
||||||
if self._client is None:
|
if self._client is None:
|
||||||
if hasattr(self.options, "endpoint"):
|
if hasattr(self.options, 'endpoint'):
|
||||||
endpoint_override = self.options.endpoint
|
endpoint_override = self.options.endpoint
|
||||||
else:
|
else:
|
||||||
endpoint_override = None
|
endpoint_override = None
|
||||||
@ -177,10 +177,10 @@ class VitrageShell(app.App):
|
|||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
|
|
||||||
def _hide_useless_logging_messages(self):
|
def _hide_useless_logging_messages(self):
|
||||||
requests_log = logging.getLogger("requests")
|
requests_log = logging.getLogger('requests')
|
||||||
cliff_log = logging.getLogger('cliff')
|
cliff_log = logging.getLogger('cliff')
|
||||||
stevedore_log = logging.getLogger('stevedore')
|
stevedore_log = logging.getLogger('stevedore')
|
||||||
iso8601_log = logging.getLogger("iso8601")
|
iso8601_log = logging.getLogger('iso8601')
|
||||||
cliff_log.setLevel(logging.ERROR)
|
cliff_log.setLevel(logging.ERROR)
|
||||||
stevedore_log.setLevel(logging.ERROR)
|
stevedore_log.setLevel(logging.ERROR)
|
||||||
iso8601_log.setLevel(logging.ERROR)
|
iso8601_log.setLevel(logging.ERROR)
|
||||||
@ -196,12 +196,12 @@ def main(args=None):
|
|||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
return VitrageShell().run(args)
|
return VitrageShell().run(args)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("... terminating vitrage client", file=sys.stderr)
|
print('... terminating vitrage client', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class Alarm(object):
|
class Alarm(object):
|
||||||
url = "v1/alarms/"
|
url = 'v1/alarms/'
|
||||||
|
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
self.api = api
|
self.api = api
|
||||||
|
@ -20,11 +20,11 @@ class AlarmsList(lister.Lister):
|
|||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(AlarmsList, self).get_parser(prog_name)
|
parser = super(AlarmsList, self).get_parser(prog_name)
|
||||||
parser.add_argument("id",
|
parser.add_argument('id',
|
||||||
default='all',
|
default='all',
|
||||||
nargs='?',
|
nargs='?',
|
||||||
metavar="<vitrage id>",
|
metavar='<vitrage id>',
|
||||||
help="Vitrage id of the affected resource")
|
help='Vitrage id of the affected resource')
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ class RcaShow(show.ShowOne):
|
|||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(RcaShow, self).get_parser(prog_name)
|
parser = super(RcaShow, self).get_parser(prog_name)
|
||||||
parser.add_argument("alarm_id", help="ID of an alarm")
|
parser.add_argument('alarm_id', help='ID of an alarm')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
@ -20,7 +20,7 @@ class ResourceShow(show.ShowOne):
|
|||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(ResourceShow, self).get_parser(prog_name)
|
parser = super(ResourceShow, self).get_parser(prog_name)
|
||||||
parser.add_argument("resource_id", help="ID of a resource")
|
parser.add_argument('resource_id', help='ID of a resource')
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -34,9 +34,9 @@ class ResourceList(lister.Lister):
|
|||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(ResourceList, self).get_parser(prog_name)
|
parser = super(ResourceList, self).get_parser(prog_name)
|
||||||
parser.add_argument("--type", dest='resource_type',
|
parser.add_argument('--type', dest='resource_type',
|
||||||
metavar="<resource type>",
|
metavar='<resource type>',
|
||||||
help="Type of resource")
|
help='Type of resource')
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -19,15 +19,15 @@ class TopologyShow(show.ShowOne):
|
|||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(TopologyShow, self).get_parser(prog_name)
|
parser = super(TopologyShow, self).get_parser(prog_name)
|
||||||
parser.add_argument("--filter",
|
parser.add_argument('--filter',
|
||||||
metavar="<query>",
|
metavar='<query>',
|
||||||
help="query for the graph)")
|
help='query for the graph)')
|
||||||
|
|
||||||
parser.add_argument("--limit", type=int,
|
parser.add_argument('--limit', type=int,
|
||||||
metavar="<depth>",
|
metavar='<depth>',
|
||||||
help="the depth of the topology graph")
|
help='the depth of the topology graph')
|
||||||
|
|
||||||
parser.add_argument("--root", help="the root of the topology graph")
|
parser.add_argument('--root', help='the root of the topology graph')
|
||||||
|
|
||||||
parser.add_argument('--graph-type', choices=['tree', 'graph'],
|
parser.add_argument('--graph-type', choices=['tree', 'graph'],
|
||||||
default='graph', dest='type',
|
default='graph', dest='type',
|
||||||
@ -37,7 +37,7 @@ class TopologyShow(show.ShowOne):
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
def formatter_default(self):
|
def formatter_default(self):
|
||||||
return "json"
|
return 'json'
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
topology = self.app.client.topology.get(limit=parsed_args.limit,
|
topology = self.app.client.topology.get(limit=parsed_args.limit,
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class Rca(object):
|
class Rca(object):
|
||||||
url = "v1/rca/"
|
url = 'v1/rca/'
|
||||||
|
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
self.api = api
|
self.api = api
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class Resource(object):
|
class Resource(object):
|
||||||
url = "v1/resources/"
|
url = 'v1/resources/'
|
||||||
|
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
self.api = api
|
self.api = api
|
||||||
|
@ -13,7 +13,7 @@ import json
|
|||||||
|
|
||||||
|
|
||||||
class Topology(object):
|
class Topology(object):
|
||||||
URL = "v1/topology/"
|
URL = 'v1/topology/'
|
||||||
|
|
||||||
def __init__(self, api):
|
def __init__(self, api):
|
||||||
self.api = api
|
self.api = api
|
||||||
|
Loading…
Reference in New Issue
Block a user