diff --git a/shade/cmd/inventory.py b/shade/cmd/inventory.py index c4d396f46..4f9538fff 100755 --- a/shade/cmd/inventory.py +++ b/shade/cmd/inventory.py @@ -38,6 +38,8 @@ def parse_args(): group.add_argument('--list', action='store_true', help='List active servers') group.add_argument('--host', help='List details about the specific host') + parser.add_argument('--private', action='store_true', default=False, + help='Use private IPs for interface_ip') parser.add_argument('--yaml', action='store_true', default=False, help='Output data in nicely readable yaml') parser.add_argument('--debug', action='store_true', default=False, @@ -50,7 +52,7 @@ def main(): try: shade.simple_logging(debug=args.debug) inventory = shade.inventory.OpenStackInventory( - refresh=args.refresh) + refresh=args.refresh, private=args.private) if args.list: output = inventory.list_hosts() elif args.host: diff --git a/shade/inventory.py b/shade/inventory.py index d66808a84..2c15d7fc5 100644 --- a/shade/inventory.py +++ b/shade/inventory.py @@ -21,7 +21,7 @@ from shade import _utils class OpenStackInventory(object): def __init__( - self, config_files=[], refresh=False): + self, config_files=[], refresh=False, private=False): config = os_client_config.config.OpenStackConfig( config_files=os_client_config.config.CONFIG_FILES + config_files) @@ -34,6 +34,9 @@ class OpenStackInventory(object): **f.config) for f in config.get_all_clouds() ] + if private: + for cloud in self.clouds: + cloud.private = True # Handle manual invalidation of entire persistent cache if refresh: