diff options
author | Andrey Pavlov <apavlov@mirantis.com> | 2015-10-01 17:49:14 +0300 |
---|---|---|
committer | Andrey Pavlov <apavlov@mirantis.com> | 2015-10-19 12:53:50 +0300 |
commit | 778d8b30b648f638f1999a0eeea14fc6d4c67f1d (patch) | |
tree | 3bfd9bded66ade7b9bba3229623ce4b0da992169 /saharaclient/osc/v1 | |
parent | 8c8b650cca6c8f24a951447f736109a67799ec6d (diff) | |
download | python-saharaclient-778d8b30b648f638f1999a0eeea14fc6d4c67f1d.tar.gz |
Changing public/protected options handling
Partially implements: blueprint cli-as-openstackclient-plugin
Change-Id: I7f0dbec47f8c670c942a5244be96dde215a59f35
Diffstat (limited to 'saharaclient/osc/v1')
-rw-r--r-- | saharaclient/osc/v1/data_sources.py | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/saharaclient/osc/v1/data_sources.py b/saharaclient/osc/v1/data_sources.py index b5532e5..8ae3b95 100644 --- a/saharaclient/osc/v1/data_sources.py +++ b/saharaclient/osc/v1/data_sources.py @@ -246,13 +246,13 @@ class UpdateDataSource(show.ShowOne): public.add_argument( '--public', action='store_true', - default=None, + dest='is_public', help='Make the data source public (Visible from other tenants)', ) public.add_argument( '--private', - action='store_true', - default=None, + action='store_false', + dest='is_public', help='Make the data source private (Visible only from this ' 'tenant)', ) @@ -260,41 +260,30 @@ class UpdateDataSource(show.ShowOne): protected.add_argument( '--protected', action='store_true', - default=None, + dest='is_protected', help='Make the data source protected', ) protected.add_argument( '--unprotected', - action='store_true', - default=None, + action='store_false', + dest='is_protected', help='Make the data source unprotected', ) + parser.set_defaults(is_public=None, is_protected=None) return parser def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) client = self.app.client_manager.data_processing - is_public = None - if parsed_args.public: - is_public = True - elif parsed_args.private: - is_public = False - - is_protected = None - if parsed_args.protected: - is_protected = True - elif parsed_args.unprotected: - is_protected = False - update_fields = utils.create_dict_from_kwargs( name=parsed_args.name, description=parsed_args.description, data_source_type=parsed_args.type, url=parsed_args.url, credential_user=parsed_args.username, credential_pass=parsed_args.password, - is_public=is_public, - is_protected=is_protected) + is_public=parsed_args.is_public, + is_protected=parsed_args.is_protected) ds_id = utils.get_resource( client.data_sources, parsed_args.data_source).id |