diff options
author | Cao ShuFeng <caosf.fnst@cn.fujitsu.com> | 2016-02-28 14:51:51 +0800 |
---|---|---|
committer | Cao ShuFeng <caosf.fnst@cn.fujitsu.com> | 2016-02-28 14:51:51 +0800 |
commit | 5c1acb91f71308b44f0005cbbad0edf4f34c00ce (patch) | |
tree | 1c1abb1eb80b1c56a7e82a93d21eac746ff55662 | |
parent | 4e2761d6b9a31228780a6bef898cfb0684ed39f8 (diff) | |
download | python-novaclient-5c1acb91f71308b44f0005cbbad0edf4f34c00ce.tar.gz |
Use isinstance instead of type
With the patch sets of request_ids, the *Manager classes return
'DictWithMeta' or 'ListWithMeta' rather than 'dict' or 'list'.
This change adjust conditional statements to use isinstance when
comparing variables. Isinstance supports inheritance type checking
better than type.
The effected subcommands are:
evacuate
interface-list
interface-attach
interface-detach
Change-Id: I0c1291110c1386d2ff027cb149a5aff20019e6f7
Closes-Bug: 1550870
-rw-r--r-- | novaclient/v2/shell.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py index 95b892d8..9a84979a 100644 --- a/novaclient/v2/shell.py +++ b/novaclient/v2/shell.py @@ -4698,7 +4698,7 @@ def do_evacuate(cs, args): server = _find_server(cs, args.server) on_shared_storage = getattr(args, 'on_shared_storage', None) res = server.evacuate(args.host, on_shared_storage, args.password)[1] - if type(res) is dict: + if isinstance(res, dict): utils.print_dict(res) @@ -4723,7 +4723,7 @@ def do_interface_list(cs, args): server = _find_server(cs, args.server) res = server.interface_list() - if type(res) is list: + if isinstance(res, list): _print_interfaces(res) @@ -4748,7 +4748,7 @@ def do_interface_attach(cs, args): server = _find_server(cs, args.server) res = server.interface_attach(args.port_id, args.net_id, args.fixed_ip) - if type(res) is dict: + if isinstance(res, dict): utils.print_dict(res) @@ -4759,7 +4759,7 @@ def do_interface_detach(cs, args): server = _find_server(cs, args.server) res = server.interface_detach(args.port_id) - if type(res) is dict: + if isinstance(res, dict): utils.print_dict(res) |