summaryrefslogtreecommitdiff
path: root/openstackclient/identity/v3/project.py
diff options
context:
space:
mode:
authorGage Hugo <gagehugo@gmail.com>2017-07-06 16:21:03 -0500
committerDean Troyer <dtroyer@gmail.com>2018-02-23 20:26:57 +0000
commitd32664150fbc00340f3ff4304c13abf9a191299a (patch)
tree31731b192ed863514ce60ab1244d04d6edf910af /openstackclient/identity/v3/project.py
parent8c5f7555698491c3a0b44fe6c3fee50d0189f2d6 (diff)
downloadpython-openstackclient-d32664150fbc00340f3ff4304c13abf9a191299a.tar.gz
Add project tags functionality
This change adds tags functionality for projects in keystone. A user can add a single tag with "--tag", chain "--tag" to add multiple tags, or clear tags with "--no-tag". Change-Id: I31cfef3e76dcefe299dacb00c11bb1a10a252628 Partially-Implements: bp project-tags
Diffstat (limited to 'openstackclient/identity/v3/project.py')
-rw-r--r--openstackclient/identity/v3/project.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/openstackclient/identity/v3/project.py b/openstackclient/identity/v3/project.py
index 60efbac4..e819a0a8 100644
--- a/openstackclient/identity/v3/project.py
+++ b/openstackclient/identity/v3/project.py
@@ -26,7 +26,7 @@ import six
from openstackclient.i18n import _
from openstackclient.identity import common
-
+from openstackclient.identity.v3 import tag
LOG = logging.getLogger(__name__)
@@ -79,6 +79,7 @@ class CreateProject(command.ShowOne):
action='store_true',
help=_('Return existing project'),
)
+ tag.add_tag_option_to_parser_for_create(parser, _('project'))
return parser
def take_action(self, parsed_args):
@@ -102,6 +103,7 @@ class CreateProject(command.ShowOne):
kwargs = {}
if parsed_args.property:
kwargs = parsed_args.property.copy()
+ kwargs['tags'] = list(set(parsed_args.tags))
try:
project = identity_client.projects.create(
@@ -207,6 +209,7 @@ class ListProject(command.Lister):
'(default: asc), repeat this option to specify multiple '
'keys and directions.'),
)
+ tag.add_tag_filtering_option_to_parser(parser, _('projects'))
return parser
def take_action(self, parsed_args):
@@ -234,6 +237,8 @@ class ListProject(command.Lister):
kwargs['user'] = user_id
+ tag.get_tag_filtering_args(parsed_args, kwargs)
+
if parsed_args.my_projects:
# NOTE(adriant): my-projects supersedes all the other filters.
kwargs = {'user': self.app.client_manager.auth_ref.user_id}
@@ -303,6 +308,7 @@ class SetProject(command.Command):
help=_('Set a property on <project> '
'(repeat option to set multiple properties)'),
)
+ tag.add_tag_option_to_parser_for_set(parser, _('project'))
return parser
def take_action(self, parsed_args):
@@ -323,6 +329,7 @@ class SetProject(command.Command):
kwargs['enabled'] = False
if parsed_args.property:
kwargs.update(parsed_args.property)
+ tag.update_tags_in_args(parsed_args, project, kwargs)
identity_client.projects.update(project.id, **kwargs)