diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-01-04 18:56:32 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-01-04 18:56:32 +0000 |
commit | 744d49607302a43e11ea420cf82718a4501c7e48 (patch) | |
tree | 33f27fa65d0e1c4494ae5ec8cf929cb9ac25f8d8 | |
parent | a9e139088e2754ca354cc2b2d8f3aa44b1c9b9ee (diff) | |
parent | 7ee7156254381dc5c06405105c7de42c180c779f (diff) | |
download | os-client-config-744d49607302a43e11ea420cf82718a4501c7e48.tar.gz |
Merge "Allow filtering clouds on command line"
-rw-r--r-- | os_client_config/config.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py index d490006..bda62da 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -19,6 +19,7 @@ import collections import copy import json import os +import sys import warnings import appdirs @@ -988,4 +989,15 @@ class OpenStackConfig(object): if __name__ == '__main__': config = OpenStackConfig().get_all_clouds() for cloud in config: - print(cloud.name, cloud.region, cloud.config) + print_cloud = False + if len(sys.argv) == 1: + print_cloud = True + elif len(sys.argv) == 3 and ( + sys.argv[1] == cloud.name and sys.argv[2] == cloud.region): + print_cloud = True + elif len(sys.argv) == 2 and ( + sys.argv[1] == cloud.name): + print_cloud = True + + if print_cloud: + print(cloud.name, cloud.region, cloud.config) |