mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #9338 from szkkentaro/gce_inventory/add_pretty_option
Add --pretty option for gce inventory plugin
This commit is contained in:
commit
13da039563
1 changed files with 6 additions and 2 deletions
|
@ -103,11 +103,13 @@ class GceInventory(object):
|
||||||
# Just display data for specific host
|
# Just display data for specific host
|
||||||
if self.args.host:
|
if self.args.host:
|
||||||
print self.json_format_dict(self.node_to_dict(
|
print self.json_format_dict(self.node_to_dict(
|
||||||
self.get_instance(self.args.host)))
|
self.get_instance(self.args.host)),
|
||||||
|
pretty=self.args.pretty)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Otherwise, assume user wants all instances grouped
|
# Otherwise, assume user wants all instances grouped
|
||||||
print(self.json_format_dict(self.group_instances()))
|
print(self.json_format_dict(self.group_instances(),
|
||||||
|
pretty=self.args.pretty))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def get_gce_driver(self):
|
def get_gce_driver(self):
|
||||||
|
@ -187,6 +189,8 @@ class GceInventory(object):
|
||||||
help='List instances (default: True)')
|
help='List instances (default: True)')
|
||||||
parser.add_argument('--host', action='store',
|
parser.add_argument('--host', action='store',
|
||||||
help='Get all information about an instance')
|
help='Get all information about an instance')
|
||||||
|
parser.add_argument('--pretty', action='store_true', default=False,
|
||||||
|
help='Pretty format (default: False)')
|
||||||
self.args = parser.parse_args()
|
self.args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue