From 9168373b3d7502f0ebe7bca9097ee474bb8d6c5b Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Wed, 18 Nov 2015 10:50:34 +0100 Subject: Consistency of the --all argument for snapshots This change is inspired by the volume.py. It allow the user to use openstack snapshot list --all. Closes-Bug: #1517386 Change-Id: I72a53fcd0c5c5af539cd88b37e71b4331fa67473 --- openstackclient/volume/v1/snapshot.py | 13 ++++++++++++- openstackclient/volume/v2/snapshot.py | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'openstackclient/volume') diff --git a/openstackclient/volume/v1/snapshot.py b/openstackclient/volume/v1/snapshot.py index de7bb5b9..93e17eb8 100644 --- a/openstackclient/volume/v1/snapshot.py +++ b/openstackclient/volume/v1/snapshot.py @@ -110,6 +110,12 @@ class ListSnapshot(lister.Lister): def get_parser(self, prog_name): parser = super(ListSnapshot, self).get_parser(prog_name) + parser.add_argument( + '--all-projects', + action='store_true', + default=False, + help='Include all projects (admin only)', + ) parser.add_argument( '--long', action='store_true', @@ -157,7 +163,12 @@ class ListSnapshot(lister.Lister): # Just forget it if there's any trouble pass - data = self.app.client_manager.volume.volume_snapshots.list() + search_opts = { + 'all_tenants': parsed_args.all_projects, + } + + data = self.app.client_manager.volume.volume_snapshots.list( + search_opts=search_opts) return (column_headers, (utils.get_item_properties( s, columns, diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py index bbc92c48..aa7630ae 100644 --- a/openstackclient/volume/v2/snapshot.py +++ b/openstackclient/volume/v2/snapshot.py @@ -107,6 +107,12 @@ class ListSnapshot(lister.Lister): def get_parser(self, prog_name): parser = super(ListSnapshot, self).get_parser(prog_name) + parser.add_argument( + '--all-projects', + action='store_true', + default=False, + help='Include all projects (admin only)', + ) parser.add_argument( '--long', action='store_true', @@ -149,7 +155,12 @@ class ListSnapshot(lister.Lister): # Just forget it if there's any trouble pass - data = self.app.client_manager.volume.volume_snapshots.list() + search_opts = { + 'all_tenants': parsed_args.all_projects, + } + + data = self.app.client_manager.volume.volume_snapshots.list( + search_opts=search_opts) return (column_headers, (utils.get_item_properties( s, columns, -- cgit v1.2.1