Do not always init compute_client when doint port list

This patch ensures that compute client is initialized only when needed
(--server arg is passed) to openstack port list command. Otherwise it
leads to failures on installations without Nova.

Change-Id: I102683461daa2f7d05dd9d7a3ec72de551c65ca9
Closes-Bug: #1688194
This commit is contained in:
Vasyl Saienko 2017-05-04 10:48:11 +03:00 committed by Dean Troyer
parent 07a4363e99
commit c69304e3d3
2 changed files with 7 additions and 1 deletions

View File

@ -519,7 +519,6 @@ class ListPort(command.Lister):
def take_action(self, parsed_args):
network_client = self.app.client_manager.network
compute_client = self.app.client_manager.compute
identity_client = self.app.client_manager.identity
columns = (
@ -548,6 +547,7 @@ class ListPort(command.Lister):
ignore_missing=False)
filters['device_id'] = _router.id
if parsed_args.server:
compute_client = self.app.client_manager.compute
server = utils.find_resource(compute_client.servers,
parsed_args.server)
filters['device_id'] = server.id

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fix issue in ``port list`` command when no Compute endpoint is in the
Service Catalog.
[Bug `1688194 <https://bugs.launchpad.net/bugs/1688194>`_]