Skip to content

Commit 377c0ce

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove deprecated identity commands and args"
2 parents d103b3d + f9fdc29 commit 377c0ce

13 files changed

Lines changed: 56 additions & 847 deletions

File tree

doc/source/cli/backwards-incompatible.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ Release 4.0
3131
* Removed in: 4.0
3232
* Commit: https://review.opendev.org/612781
3333

34+
3. Remove ``service create`` option ``--type``. Service type is
35+
a positional argument.
36+
37+
* Removed in: 4.0
38+
* Commit: https://review.opendev.org/612798
39+
40+
4. Remove ``role list`` options ``--project`` and ``--user``.
41+
Use ``role assignment list`` options ``--project`` and ``--user`` instead.
42+
43+
* Removed in: 4.0
44+
* Commit: https://review.opendev.org/612798
45+
46+
5. Remove ``user role list`` command.
47+
Use ``role assignment list`` options ``--project`` and ``--user`` instead.
48+
49+
* Removed in: 4.0
50+
* Commit: https://review.opendev.org/612798
51+
3452
.. 1. Change ``volume transfer request accept`` to use new option ``--auth-key``
3553
.. rather than a second positional argument.
3654

doc/source/cli/command-objects/role.rst

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -146,68 +146,12 @@ List roles
146146
.. code:: bash
147147
148148
openstack role list
149-
--domain <domain> | --project <project> [--project-domain <project-domain>]
150-
--user <user> [--user-domain <user-domain>] | --group <group> [--group-domain <group-domain>]
151-
--inherited
149+
[--domain <domain>]
152150
153151
.. option:: --domain <domain>
154152

155153
Filter roles by <domain> (name or ID)
156154

157-
(Deprecated if being used to list assignments in conjunction with the
158-
``--user <user>``, option, please use ``role assignment list`` instead)
159-
160-
.. option:: --project <project>
161-
162-
Filter roles by <project> (name or ID)
163-
164-
(Deprecated, please use ``role assignment list`` instead)
165-
166-
.. option:: --user <user>
167-
168-
Filter roles by <user> (name or ID)
169-
170-
(Deprecated, please use ``role assignment list`` instead)
171-
172-
.. option:: --group <group>
173-
174-
Filter roles by <group> (name or ID)
175-
176-
(Deprecated, please use ``role assignment list`` instead)
177-
178-
.. option:: --user-domain <user-domain>
179-
180-
Domain the user belongs to (name or ID).
181-
This can be used in case collisions between user names exist.
182-
183-
(Deprecated, please use ``role assignment list`` instead)
184-
185-
.. versionadded:: 3
186-
187-
.. option:: --group-domain <group-domain>
188-
189-
Domain the group belongs to (name or ID).
190-
This can be used in case collisions between group names exist.
191-
192-
(Deprecated, please use ``role assignment list`` instead)
193-
194-
.. versionadded:: 3
195-
196-
.. option:: --project-domain <project-domain>
197-
198-
Domain the project belongs to (name or ID).
199-
This can be used in case collisions between project names exist.
200-
201-
(Deprecated, please use ``role assignment list`` instead)
202-
203-
.. versionadded:: 3
204-
205-
.. option:: --inherited
206-
207-
Specifies if the role grant is inheritable to the sub projects.
208-
209-
(Deprecated, please use ``role assignment list`` instead)
210-
211155
.. versionadded:: 3
212156

213157
role remove

doc/source/cli/command-objects/user-role.rst

Lines changed: 0 additions & 27 deletions
This file was deleted.

openstackclient/identity/v2_0/role.py

Lines changed: 2 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -148,155 +148,11 @@ def take_action(self, parsed_args):
148148
class ListRole(command.Lister):
149149
_description = _("List roles")
150150

151-
def get_parser(self, prog_name):
152-
parser = super(ListRole, self).get_parser(prog_name)
153-
parser.add_argument(
154-
'--project',
155-
metavar='<project>',
156-
help=_('Filter roles by <project> (name or ID)'),
157-
)
158-
parser.add_argument(
159-
'--user',
160-
metavar='<user>',
161-
help=_('Filter roles by <user> (name or ID)'),
162-
)
163-
return parser
164-
165151
def take_action(self, parsed_args):
166-
167-
def _deprecated():
168-
# NOTE(henry-nash): Deprecated as of Newton, so we should remove
169-
# this in the 'P' release.
170-
self.log.warning(_('Listing assignments using role list is '
171-
'deprecated as of the Newton release. Use role '
172-
'assignment list --user <user-name> --project '
173-
'<project-name> --names instead.'))
174-
175152
identity_client = self.app.client_manager.identity
176-
auth_ref = self.app.client_manager.auth_ref
177-
178-
# No user or project specified, list all roles in the system
179-
if not parsed_args.user and not parsed_args.project:
180-
columns = ('ID', 'Name')
181-
data = identity_client.roles.list()
182-
elif parsed_args.user and parsed_args.project:
183-
user = utils.find_resource(
184-
identity_client.users,
185-
parsed_args.user,
186-
)
187-
project = utils.find_resource(
188-
identity_client.projects,
189-
parsed_args.project,
190-
)
191-
_deprecated()
192-
data = identity_client.roles.roles_for_user(user.id, project.id)
193-
194-
elif parsed_args.user:
195-
user = utils.find_resource(
196-
identity_client.users,
197-
parsed_args.user,
198-
)
199-
if self.app.client_manager.auth_ref:
200-
project = utils.find_resource(
201-
identity_client.projects,
202-
auth_ref.project_id
203-
)
204-
else:
205-
msg = _("Project must be specified")
206-
raise exceptions.CommandError(msg)
207-
_deprecated()
208-
data = identity_client.roles.roles_for_user(user.id, project.id)
209-
elif parsed_args.project:
210-
project = utils.find_resource(
211-
identity_client.projects,
212-
parsed_args.project,
213-
)
214-
if self.app.client_manager.auth_ref:
215-
user = utils.find_resource(
216-
identity_client.users,
217-
auth_ref.user_id
218-
)
219-
else:
220-
msg = _("User must be specified")
221-
raise exceptions.CommandError(msg)
222-
_deprecated()
223-
data = identity_client.roles.roles_for_user(user.id, project.id)
224-
225-
if parsed_args.user or parsed_args.project:
226-
columns = ('ID', 'Name', 'Project', 'User')
227-
for user_role in data:
228-
user_role.user = user.name
229-
user_role.project = project.name
230-
231-
return (columns,
232-
(utils.get_item_properties(
233-
s, columns,
234-
formatters={},
235-
) for s in data))
236-
237-
238-
class ListUserRole(command.Lister):
239-
_description = _("List user-role assignments")
240-
241-
def get_parser(self, prog_name):
242-
parser = super(ListUserRole, self).get_parser(prog_name)
243-
parser.add_argument(
244-
'user',
245-
metavar='<user>',
246-
nargs='?',
247-
help=_('User to list (name or ID)'),
248-
)
249-
parser.add_argument(
250-
'--project',
251-
metavar='<project>',
252-
help=_('Filter users by <project> (name or ID)'),
253-
)
254-
return parser
255-
256-
def take_action(self, parsed_args):
257-
identity_client = self.app.client_manager.identity
258-
auth_ref = self.app.client_manager.auth_ref
259-
260-
# Project and user are required, if not included in command args
261-
# default to the values used for authentication. For token-flow
262-
# authentication they must be included on the command line.
263-
if (not parsed_args.project and
264-
self.app.client_manager.auth_ref.project_id):
265-
parsed_args.project = auth_ref.project_id
266-
if not parsed_args.project:
267-
msg = _("Project must be specified")
268-
raise exceptions.CommandError(msg)
269-
270-
if (not parsed_args.user and
271-
self.app.client_manager.auth_ref.user_id):
272-
parsed_args.user = auth_ref.user_id
273-
if not parsed_args.user:
274-
msg = _("User must be specified")
275-
raise exceptions.CommandError(msg)
276-
277-
self.log.warning(_('Listing assignments using user role list is '
278-
'deprecated as of the Newton release. Use role '
279-
'assignment list --user <user-name> --project '
280-
'<project-name> --names instead.'))
281-
project = utils.find_resource(
282-
identity_client.tenants,
283-
parsed_args.project,
284-
)
285-
user = utils.find_resource(identity_client.users, parsed_args.user)
286-
287-
data = identity_client.roles.roles_for_user(user.id, project.id)
288-
289-
columns = (
290-
'ID',
291-
'Name',
292-
'Project',
293-
'User',
294-
)
295153

296-
# Add the names to the output even though they will be constant
297-
for role in data:
298-
role.user = user.name
299-
role.project = project.name
154+
columns = ('ID', 'Name')
155+
data = identity_client.roles.list()
300156

301157
return (columns,
302158
(utils.get_item_properties(

openstackclient/identity/v2_0/service.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
"""Service action implementations"""
1717

18-
import argparse
1918
import logging
2019

2120
from osc_lib.command import command
@@ -36,17 +35,11 @@ class CreateService(command.ShowOne):
3635
def get_parser(self, prog_name):
3736
parser = super(CreateService, self).get_parser(prog_name)
3837
parser.add_argument(
39-
'type_or_name',
38+
'type',
4039
metavar='<type>',
4140
help=_('New service type (compute, image, identity, volume, etc)'),
4241
)
43-
type_or_name_group = parser.add_mutually_exclusive_group()
44-
type_or_name_group.add_argument(
45-
'--type',
46-
metavar='<type>',
47-
help=argparse.SUPPRESS,
48-
)
49-
type_or_name_group.add_argument(
42+
parser.add_argument(
5043
'--name',
5144
metavar='<name>',
5245
help=_('New service name'),
@@ -61,29 +54,14 @@ def get_parser(self, prog_name):
6154
def take_action(self, parsed_args):
6255
identity_client = self.app.client_manager.identity
6356

64-
type_or_name = parsed_args.type_or_name
6557
name = parsed_args.name
6658
type = parsed_args.type
6759

68-
# If only a single positional is present, it's a <type>.
69-
# This is not currently legal so it is considered a new case.
70-
if not type and not name:
71-
type = type_or_name
72-
# If --type option is present then positional is handled as <name>;
73-
# display deprecation message.
74-
elif type:
75-
name = type_or_name
76-
LOG.warning(_('The argument --type is deprecated, use service'
77-
' create --name <service-name> type instead.'))
78-
# If --name option is present the positional is handled as <type>.
79-
# Making --type optional is new, but back-compatible
80-
elif name:
81-
type = type_or_name
82-
8360
service = identity_client.services.create(
8461
name,
8562
type,
86-
parsed_args.description)
63+
parsed_args.description,
64+
)
8765

8866
info = {}
8967
info.update(service._info)

0 commit comments

Comments
 (0)