python-openstackclient 7.2.0__py3-none-any.whl → 7.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/common/clientmanager.py +6 -1
- openstackclient/common/limits.py +1 -1
- openstackclient/common/quota.py +7 -2
- openstackclient/compute/v2/server.py +38 -22
- openstackclient/compute/v2/usage.py +2 -2
- openstackclient/identity/common.py +22 -34
- openstackclient/identity/v3/credential.py +45 -28
- openstackclient/identity/v3/limit.py +15 -0
- openstackclient/identity/v3/region.py +23 -22
- openstackclient/identity/v3/registered_limit.py +18 -0
- openstackclient/identity/v3/role.py +287 -117
- openstackclient/identity/v3/role_assignment.py +1 -1
- openstackclient/identity/v3/service_provider.py +95 -45
- openstackclient/identity/v3/trust.py +114 -75
- openstackclient/image/v2/image.py +3 -0
- openstackclient/network/v2/network.py +33 -0
- openstackclient/network/v2/network_flavor_profile.py +1 -17
- openstackclient/network/v2/port.py +73 -19
- openstackclient/tests/functional/compute/v2/test_server.py +87 -1
- openstackclient/tests/functional/identity/v3/common.py +1 -1
- openstackclient/tests/functional/identity/v3/test_application_credential.py +2 -1
- openstackclient/tests/functional/identity/v3/test_role.py +24 -0
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +8 -0
- openstackclient/tests/functional/identity/v3/test_service_provider.py +1 -5
- openstackclient/tests/functional/network/v2/test_port.py +28 -1
- openstackclient/tests/unit/compute/v2/fakes.py +0 -304
- openstackclient/tests/unit/compute/v2/test_aggregate.py +40 -31
- openstackclient/tests/unit/compute/v2/test_console.py +7 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +60 -53
- openstackclient/tests/unit/compute/v2/test_keypair.py +57 -69
- openstackclient/tests/unit/compute/v2/test_server.py +63 -5
- openstackclient/tests/unit/compute/v2/test_server_group.py +99 -105
- openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -5
- openstackclient/tests/unit/compute/v2/test_service.py +83 -37
- openstackclient/tests/unit/compute/v2/test_usage.py +12 -7
- openstackclient/tests/unit/identity/v2_0/test_catalog.py +3 -6
- openstackclient/tests/unit/identity/v2_0/test_role.py +1 -2
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +2 -1
- openstackclient/tests/unit/identity/v2_0/test_token.py +6 -20
- openstackclient/tests/unit/identity/v3/test_catalog.py +2 -5
- openstackclient/tests/unit/identity/v3/test_credential.py +74 -63
- openstackclient/tests/unit/identity/v3/test_project.py +1 -3
- openstackclient/tests/unit/identity/v3/test_region.py +74 -96
- openstackclient/tests/unit/identity/v3/test_role.py +679 -603
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +263 -1
- openstackclient/tests/unit/identity/v3/test_service_provider.py +159 -209
- openstackclient/tests/unit/identity/v3/test_token.py +5 -20
- openstackclient/tests/unit/identity/v3/test_trust.py +137 -155
- openstackclient/tests/unit/image/v2/test_image.py +6 -0
- openstackclient/tests/unit/network/v2/fakes.py +3 -0
- openstackclient/tests/unit/network/v2/test_network.py +25 -0
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +0 -35
- openstackclient/tests/unit/network/v2/test_port.py +129 -16
- openstackclient/tests/unit/utils.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +31 -13
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +34 -13
- openstackclient/volume/v2/volume_backup.py +11 -2
- openstackclient/volume/v3/volume_backup.py +13 -2
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/AUTHORS +2 -0
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/METADATA +14 -16
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/RECORD +66 -66
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/entry_points.txt +0 -1
- python_openstackclient-7.3.0.dist-info/pbr.json +1 -0
- python_openstackclient-7.2.0.dist-info/pbr.json +0 -1
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.2.0.dist-info → python_openstackclient-7.3.0.dist-info}/top_level.txt +0 -0
|
@@ -129,10 +129,15 @@ class ClientManager(clientmanager.ClientManager):
|
|
|
129
129
|
# TODO(stephenfin): Drop volume_client argument in OSC 8.0 or later.
|
|
130
130
|
def is_volume_endpoint_enabled(self, volume_client=None):
|
|
131
131
|
"""Check if volume endpoint is enabled"""
|
|
132
|
+
# We check against the service type and all aliases defined by the
|
|
133
|
+
# Service Types Authority
|
|
134
|
+
# https://service-types.openstack.org/service-types.json
|
|
132
135
|
return (
|
|
133
|
-
self.is_service_available('
|
|
136
|
+
self.is_service_available('block-storage') is not False
|
|
137
|
+
or self.is_service_available('volume') is not False
|
|
134
138
|
or self.is_service_available('volumev3') is not False
|
|
135
139
|
or self.is_service_available('volumev2') is not False
|
|
140
|
+
or self.is_service_available('block-store') is not False
|
|
136
141
|
)
|
|
137
142
|
|
|
138
143
|
|
openstackclient/common/limits.py
CHANGED
|
@@ -130,7 +130,7 @@ class ShowLimits(command.Lister):
|
|
|
130
130
|
if self.app.client_manager.is_volume_endpoint_enabled():
|
|
131
131
|
volume_client = self.app.client_manager.sdk_connection.volume
|
|
132
132
|
volume_limits = volume_client.get_limits(
|
|
133
|
-
|
|
133
|
+
project=project_id,
|
|
134
134
|
)
|
|
135
135
|
|
|
136
136
|
if parsed_args.is_absolute:
|
openstackclient/common/quota.py
CHANGED
|
@@ -249,9 +249,14 @@ class ListQuota(command.Lister):
|
|
|
249
249
|
for project_id in project_ids:
|
|
250
250
|
try:
|
|
251
251
|
project_data = compute_client.get_quota_set(project_id)
|
|
252
|
+
# NOTE(stephenfin): Unfortunately, Nova raises a HTTP 400 (Bad
|
|
253
|
+
# Request) if the project ID is invalid, even though the project
|
|
254
|
+
# ID is actually the resource's identifier which would normally
|
|
255
|
+
# lead us to expect a HTTP 404 (Not Found).
|
|
252
256
|
except (
|
|
253
|
-
sdk_exceptions.
|
|
257
|
+
sdk_exceptions.BadRequestException,
|
|
254
258
|
sdk_exceptions.ForbiddenException,
|
|
259
|
+
sdk_exceptions.NotFoundException,
|
|
255
260
|
) as exc:
|
|
256
261
|
# Project not found, move on to next one
|
|
257
262
|
LOG.warning(f"Project {project_id} not found: {exc}")
|
|
@@ -312,8 +317,8 @@ class ListQuota(command.Lister):
|
|
|
312
317
|
try:
|
|
313
318
|
project_data = volume_client.get_quota_set(project_id)
|
|
314
319
|
except (
|
|
315
|
-
sdk_exceptions.NotFoundException,
|
|
316
320
|
sdk_exceptions.ForbiddenException,
|
|
321
|
+
sdk_exceptions.NotFoundException,
|
|
317
322
|
) as exc:
|
|
318
323
|
# Project not found, move on to next one
|
|
319
324
|
LOG.warning(f"Project {project_id} not found: {exc}")
|
|
@@ -714,7 +714,8 @@ class AddServerSecurityGroup(command.Command):
|
|
|
714
714
|
for security_group in security_groups:
|
|
715
715
|
try:
|
|
716
716
|
compute_client.add_security_group_to_server(
|
|
717
|
-
server,
|
|
717
|
+
server,
|
|
718
|
+
{'name': security_group},
|
|
718
719
|
)
|
|
719
720
|
except sdk_exceptions.HttpException as e:
|
|
720
721
|
errors += 1
|
|
@@ -1356,14 +1357,26 @@ class CreateServer(command.ShowOne):
|
|
|
1356
1357
|
'This option requires cloud support.'
|
|
1357
1358
|
),
|
|
1358
1359
|
)
|
|
1359
|
-
parser.
|
|
1360
|
+
secgroups = parser.add_mutually_exclusive_group()
|
|
1361
|
+
secgroups.add_argument(
|
|
1362
|
+
'--no-security-group',
|
|
1363
|
+
dest='security_groups',
|
|
1364
|
+
action='store_const',
|
|
1365
|
+
const=[],
|
|
1366
|
+
help=_(
|
|
1367
|
+
'Do not associate a security group with ports attached to '
|
|
1368
|
+
'this server. This does not affect the security groups '
|
|
1369
|
+
'associated with pre-existing ports.'
|
|
1370
|
+
),
|
|
1371
|
+
)
|
|
1372
|
+
secgroups.add_argument(
|
|
1360
1373
|
'--security-group',
|
|
1361
1374
|
metavar='<security-group>',
|
|
1362
1375
|
action='append',
|
|
1363
|
-
default=[],
|
|
1364
1376
|
dest='security_groups',
|
|
1365
1377
|
help=_(
|
|
1366
|
-
'Security group to
|
|
1378
|
+
'Security group to associate with ports attached to this '
|
|
1379
|
+
'server (name or ID) '
|
|
1367
1380
|
'(repeat option to set multiple groups)'
|
|
1368
1381
|
),
|
|
1369
1382
|
)
|
|
@@ -1980,22 +1993,24 @@ class CreateServer(command.ShowOne):
|
|
|
1980
1993
|
networks = 'auto'
|
|
1981
1994
|
|
|
1982
1995
|
# Check security group(s) exist and convert ID to name
|
|
1983
|
-
security_groups =
|
|
1984
|
-
if
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1996
|
+
security_groups = None
|
|
1997
|
+
if parsed_args.security_groups is not None:
|
|
1998
|
+
security_groups = []
|
|
1999
|
+
if self.app.client_manager.is_network_endpoint_enabled():
|
|
2000
|
+
network_client = self.app.client_manager.network
|
|
2001
|
+
for security_group in parsed_args.security_groups:
|
|
2002
|
+
sg = network_client.find_security_group(
|
|
2003
|
+
security_group, ignore_missing=False
|
|
2004
|
+
)
|
|
2005
|
+
# Use security group ID to avoid multiple security group
|
|
2006
|
+
# have same name in neutron networking backend
|
|
2007
|
+
security_groups.append({'name': sg.id})
|
|
2008
|
+
else: # nova-network
|
|
2009
|
+
for security_group in parsed_args.security_groups:
|
|
2010
|
+
sg = compute_v2.find_security_group(
|
|
2011
|
+
compute_client, security_group
|
|
2012
|
+
)
|
|
2013
|
+
security_groups.append({'name': sg['name']})
|
|
1999
2014
|
|
|
2000
2015
|
hints = {}
|
|
2001
2016
|
for key, values in parsed_args.hints.items():
|
|
@@ -2058,7 +2073,7 @@ class CreateServer(command.ShowOne):
|
|
|
2058
2073
|
if files:
|
|
2059
2074
|
kwargs['personality'] = files
|
|
2060
2075
|
|
|
2061
|
-
if security_groups:
|
|
2076
|
+
if security_groups is not None:
|
|
2062
2077
|
kwargs['security_groups'] = security_groups
|
|
2063
2078
|
|
|
2064
2079
|
if block_device_mapping_v2:
|
|
@@ -4083,7 +4098,8 @@ class RemoveServerSecurityGroup(command.Command):
|
|
|
4083
4098
|
for security_group in security_groups:
|
|
4084
4099
|
try:
|
|
4085
4100
|
compute_client.remove_security_group_from_server(
|
|
4086
|
-
server,
|
|
4101
|
+
server,
|
|
4102
|
+
{'name': security_group},
|
|
4087
4103
|
)
|
|
4088
4104
|
except sdk_exceptions.HttpException as e:
|
|
4089
4105
|
errors += 1
|
|
@@ -153,7 +153,7 @@ class ListUsage(command.Lister):
|
|
|
153
153
|
)
|
|
154
154
|
|
|
155
155
|
date_cli_format = "%Y-%m-%d"
|
|
156
|
-
now = datetime.datetime.
|
|
156
|
+
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
|
|
157
157
|
|
|
158
158
|
if parsed_args.start:
|
|
159
159
|
start = datetime.datetime.strptime(
|
|
@@ -238,7 +238,7 @@ class ShowUsage(command.ShowOne):
|
|
|
238
238
|
identity_client = self.app.client_manager.identity
|
|
239
239
|
compute_client = self.app.client_manager.sdk_connection.compute
|
|
240
240
|
date_cli_format = "%Y-%m-%d"
|
|
241
|
-
now = datetime.datetime.
|
|
241
|
+
now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
|
|
242
242
|
|
|
243
243
|
if parsed_args.start:
|
|
244
244
|
start = datetime.datetime.strptime(
|
|
@@ -184,13 +184,6 @@ def _get_token_resource(client, resource, parsed_name, parsed_domain=None):
|
|
|
184
184
|
return parsed_name
|
|
185
185
|
|
|
186
186
|
|
|
187
|
-
def _get_domain_id_if_requested(identity_client, domain_name_or_id):
|
|
188
|
-
if not domain_name_or_id:
|
|
189
|
-
return None
|
|
190
|
-
domain = find_domain(identity_client, domain_name_or_id)
|
|
191
|
-
return domain.id
|
|
192
|
-
|
|
193
|
-
|
|
194
187
|
def find_domain(identity_client, name_or_id):
|
|
195
188
|
return _find_identity_resource(
|
|
196
189
|
identity_client.domains, name_or_id, domains.Domain
|
|
@@ -198,48 +191,43 @@ def find_domain(identity_client, name_or_id):
|
|
|
198
191
|
|
|
199
192
|
|
|
200
193
|
def find_group(identity_client, name_or_id, domain_name_or_id=None):
|
|
201
|
-
|
|
202
|
-
if not domain_id:
|
|
194
|
+
if domain_name_or_id is None:
|
|
203
195
|
return _find_identity_resource(
|
|
204
196
|
identity_client.groups, name_or_id, groups.Group
|
|
205
197
|
)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
198
|
+
|
|
199
|
+
domain_id = find_domain(identity_client, domain_name_or_id).id
|
|
200
|
+
return _find_identity_resource(
|
|
201
|
+
identity_client.groups,
|
|
202
|
+
name_or_id,
|
|
203
|
+
groups.Group,
|
|
204
|
+
domain_id=domain_id,
|
|
205
|
+
)
|
|
214
206
|
|
|
215
207
|
|
|
216
208
|
def find_project(identity_client, name_or_id, domain_name_or_id=None):
|
|
217
|
-
|
|
218
|
-
if not domain_id:
|
|
209
|
+
if domain_name_or_id is None:
|
|
219
210
|
return _find_identity_resource(
|
|
220
211
|
identity_client.projects, name_or_id, projects.Project
|
|
221
212
|
)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
)
|
|
213
|
+
domain_id = find_domain(identity_client, domain_name_or_id).id
|
|
214
|
+
return _find_identity_resource(
|
|
215
|
+
identity_client.projects,
|
|
216
|
+
name_or_id,
|
|
217
|
+
projects.Project,
|
|
218
|
+
domain_id=domain_id,
|
|
219
|
+
)
|
|
230
220
|
|
|
231
221
|
|
|
232
222
|
def find_user(identity_client, name_or_id, domain_name_or_id=None):
|
|
233
|
-
|
|
234
|
-
if not domain_id:
|
|
223
|
+
if domain_name_or_id is None:
|
|
235
224
|
return _find_identity_resource(
|
|
236
225
|
identity_client.users, name_or_id, users.User
|
|
237
226
|
)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
)
|
|
227
|
+
domain_id = find_domain(identity_client, domain_name_or_id).id
|
|
228
|
+
return _find_identity_resource(
|
|
229
|
+
identity_client.users, name_or_id, users.User, domain_id=domain_id
|
|
230
|
+
)
|
|
243
231
|
|
|
244
232
|
|
|
245
233
|
def _find_identity_resource(
|
|
@@ -28,6 +28,23 @@ from openstackclient.identity import common
|
|
|
28
28
|
LOG = logging.getLogger(__name__)
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
def _format_credential(credential):
|
|
32
|
+
columns = (
|
|
33
|
+
'blob',
|
|
34
|
+
'id',
|
|
35
|
+
'project_id',
|
|
36
|
+
'type',
|
|
37
|
+
'user_id',
|
|
38
|
+
)
|
|
39
|
+
return (
|
|
40
|
+
columns,
|
|
41
|
+
utils.get_item_properties(
|
|
42
|
+
credential,
|
|
43
|
+
columns,
|
|
44
|
+
),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
31
48
|
class CreateCredential(command.ShowOne):
|
|
32
49
|
_description = _("Create new credential")
|
|
33
50
|
|
|
@@ -60,25 +77,24 @@ class CreateCredential(command.ShowOne):
|
|
|
60
77
|
return parser
|
|
61
78
|
|
|
62
79
|
def take_action(self, parsed_args):
|
|
63
|
-
identity_client = self.app.client_manager.identity
|
|
64
|
-
user_id =
|
|
65
|
-
|
|
80
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
81
|
+
user_id = identity_client.find_user(
|
|
82
|
+
parsed_args.user, ignore_missing=False
|
|
66
83
|
).id
|
|
67
84
|
if parsed_args.project:
|
|
68
|
-
project =
|
|
69
|
-
|
|
85
|
+
project = identity_client.find_project(
|
|
86
|
+
parsed_args.project, ignore_missing=False
|
|
70
87
|
).id
|
|
71
88
|
else:
|
|
72
89
|
project = None
|
|
73
|
-
credential = identity_client.
|
|
90
|
+
credential = identity_client.create_credential(
|
|
74
91
|
user=user_id,
|
|
75
92
|
type=parsed_args.type,
|
|
76
93
|
blob=parsed_args.data,
|
|
77
94
|
project=project,
|
|
78
95
|
)
|
|
79
96
|
|
|
80
|
-
credential
|
|
81
|
-
return zip(*sorted(credential._info.items()))
|
|
97
|
+
return _format_credential(credential)
|
|
82
98
|
|
|
83
99
|
|
|
84
100
|
class DeleteCredential(command.Command):
|
|
@@ -95,11 +111,11 @@ class DeleteCredential(command.Command):
|
|
|
95
111
|
return parser
|
|
96
112
|
|
|
97
113
|
def take_action(self, parsed_args):
|
|
98
|
-
identity_client = self.app.client_manager.identity
|
|
114
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
99
115
|
result = 0
|
|
100
116
|
for i in parsed_args.credential:
|
|
101
117
|
try:
|
|
102
|
-
identity_client.
|
|
118
|
+
identity_client.delete_credential(i)
|
|
103
119
|
except Exception as e:
|
|
104
120
|
result += 1
|
|
105
121
|
LOG.error(
|
|
@@ -137,14 +153,17 @@ class ListCredential(command.Lister):
|
|
|
137
153
|
return parser
|
|
138
154
|
|
|
139
155
|
def take_action(self, parsed_args):
|
|
140
|
-
identity_client = self.app.client_manager.identity
|
|
156
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
141
157
|
|
|
142
158
|
kwargs = {}
|
|
143
159
|
if parsed_args.user:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
domain_id = None
|
|
161
|
+
if parsed_args.user_domain:
|
|
162
|
+
domain_id = identity_client.find_domain(
|
|
163
|
+
parsed_args.user_domain, ignore_missing=False
|
|
164
|
+
)
|
|
165
|
+
user_id = identity_client.find_user(
|
|
166
|
+
parsed_args.user, domain_id=domain_id, ignore_missing=False
|
|
148
167
|
).id
|
|
149
168
|
kwargs["user_id"] = user_id
|
|
150
169
|
|
|
@@ -153,7 +172,8 @@ class ListCredential(command.Lister):
|
|
|
153
172
|
|
|
154
173
|
columns = ('ID', 'Type', 'User ID', 'Blob', 'Project ID')
|
|
155
174
|
column_headers = ('ID', 'Type', 'User ID', 'Data', 'Project ID')
|
|
156
|
-
data =
|
|
175
|
+
data = identity_client.credentials(**kwargs)
|
|
176
|
+
|
|
157
177
|
return (
|
|
158
178
|
column_headers,
|
|
159
179
|
(
|
|
@@ -206,20 +226,20 @@ class SetCredential(command.Command):
|
|
|
206
226
|
return parser
|
|
207
227
|
|
|
208
228
|
def take_action(self, parsed_args):
|
|
209
|
-
identity_client = self.app.client_manager.identity
|
|
229
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
210
230
|
|
|
211
|
-
user_id =
|
|
212
|
-
|
|
231
|
+
user_id = identity_client.find_user(
|
|
232
|
+
parsed_args.user, ignore_missing=False
|
|
213
233
|
).id
|
|
214
234
|
|
|
215
235
|
if parsed_args.project:
|
|
216
|
-
project =
|
|
217
|
-
|
|
236
|
+
project = identity_client.find_project(
|
|
237
|
+
parsed_args.project, ignore_missing=False
|
|
218
238
|
).id
|
|
219
239
|
else:
|
|
220
240
|
project = None
|
|
221
241
|
|
|
222
|
-
identity_client.
|
|
242
|
+
identity_client.update_credential(
|
|
223
243
|
parsed_args.credential,
|
|
224
244
|
user=user_id,
|
|
225
245
|
type=parsed_args.type,
|
|
@@ -241,10 +261,7 @@ class ShowCredential(command.ShowOne):
|
|
|
241
261
|
return parser
|
|
242
262
|
|
|
243
263
|
def take_action(self, parsed_args):
|
|
244
|
-
identity_client = self.app.client_manager.identity
|
|
245
|
-
credential =
|
|
246
|
-
identity_client.credentials, parsed_args.credential
|
|
247
|
-
)
|
|
264
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
265
|
+
credential = identity_client.get_credential(parsed_args.credential)
|
|
248
266
|
|
|
249
|
-
credential
|
|
250
|
-
return zip(*sorted(credential._info.items()))
|
|
267
|
+
return _format_credential(credential)
|
|
@@ -90,6 +90,13 @@ class CreateLimit(command.ShowOne):
|
|
|
90
90
|
region = common_utils.get_resource(
|
|
91
91
|
identity_client.regions, parsed_args.region
|
|
92
92
|
)
|
|
93
|
+
else:
|
|
94
|
+
self.log.warning(
|
|
95
|
+
_(
|
|
96
|
+
"Passing 'None' to indicate no region is deprecated. "
|
|
97
|
+
"Instead, don't pass --region."
|
|
98
|
+
)
|
|
99
|
+
)
|
|
93
100
|
|
|
94
101
|
limit = identity_client.limits.create(
|
|
95
102
|
project,
|
|
@@ -158,6 +165,14 @@ class ListLimit(command.Lister):
|
|
|
158
165
|
region = common_utils.get_resource(
|
|
159
166
|
identity_client.regions, parsed_args.region
|
|
160
167
|
)
|
|
168
|
+
else:
|
|
169
|
+
self.log.warning(
|
|
170
|
+
_(
|
|
171
|
+
"Passing 'None' to indicate no region is deprecated. "
|
|
172
|
+
"Instead, don't pass --region."
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
|
|
161
176
|
project = None
|
|
162
177
|
if parsed_args.project:
|
|
163
178
|
project = utils.find_resource(
|
|
@@ -25,6 +25,15 @@ from openstackclient.i18n import _
|
|
|
25
25
|
LOG = logging.getLogger(__name__)
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
def _format_region(region):
|
|
29
|
+
columns = ('id', 'description', 'parent_region_id')
|
|
30
|
+
column_headers = ('region', 'description', 'parent_region')
|
|
31
|
+
return (
|
|
32
|
+
column_headers,
|
|
33
|
+
utils.get_item_properties(region, columns),
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
28
37
|
class CreateRegion(command.ShowOne):
|
|
29
38
|
_description = _("Create new region")
|
|
30
39
|
|
|
@@ -50,18 +59,15 @@ class CreateRegion(command.ShowOne):
|
|
|
50
59
|
return parser
|
|
51
60
|
|
|
52
61
|
def take_action(self, parsed_args):
|
|
53
|
-
identity_client = self.app.client_manager.identity
|
|
62
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
54
63
|
|
|
55
|
-
region = identity_client.
|
|
64
|
+
region = identity_client.create_region(
|
|
56
65
|
id=parsed_args.region,
|
|
57
|
-
|
|
66
|
+
parent_region_id=parsed_args.parent_region,
|
|
58
67
|
description=parsed_args.description,
|
|
59
68
|
)
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
region._info['parent_region'] = region._info.pop('parent_region_id')
|
|
63
|
-
region._info.pop('links', None)
|
|
64
|
-
return zip(*sorted(region._info.items()))
|
|
70
|
+
return _format_region(region)
|
|
65
71
|
|
|
66
72
|
|
|
67
73
|
class DeleteRegion(command.Command):
|
|
@@ -78,11 +84,11 @@ class DeleteRegion(command.Command):
|
|
|
78
84
|
return parser
|
|
79
85
|
|
|
80
86
|
def take_action(self, parsed_args):
|
|
81
|
-
identity_client = self.app.client_manager.identity
|
|
87
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
82
88
|
result = 0
|
|
83
89
|
for i in parsed_args.region:
|
|
84
90
|
try:
|
|
85
|
-
identity_client.
|
|
91
|
+
identity_client.delete_region(i)
|
|
86
92
|
except Exception as e:
|
|
87
93
|
result += 1
|
|
88
94
|
LOG.error(
|
|
@@ -115,7 +121,7 @@ class ListRegion(command.Lister):
|
|
|
115
121
|
return parser
|
|
116
122
|
|
|
117
123
|
def take_action(self, parsed_args):
|
|
118
|
-
identity_client = self.app.client_manager.identity
|
|
124
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
119
125
|
|
|
120
126
|
kwargs = {}
|
|
121
127
|
if parsed_args.parent_region:
|
|
@@ -124,7 +130,7 @@ class ListRegion(command.Lister):
|
|
|
124
130
|
columns_headers = ('Region', 'Parent Region', 'Description')
|
|
125
131
|
columns = ('ID', 'Parent Region Id', 'Description')
|
|
126
132
|
|
|
127
|
-
data = identity_client.regions
|
|
133
|
+
data = identity_client.regions(**kwargs)
|
|
128
134
|
return (
|
|
129
135
|
columns_headers,
|
|
130
136
|
(
|
|
@@ -161,15 +167,15 @@ class SetRegion(command.Command):
|
|
|
161
167
|
return parser
|
|
162
168
|
|
|
163
169
|
def take_action(self, parsed_args):
|
|
164
|
-
identity_client = self.app.client_manager.identity
|
|
170
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
165
171
|
|
|
166
172
|
kwargs = {}
|
|
167
173
|
if parsed_args.description:
|
|
168
174
|
kwargs['description'] = parsed_args.description
|
|
169
175
|
if parsed_args.parent_region:
|
|
170
|
-
kwargs['
|
|
176
|
+
kwargs['parent_region_id'] = parsed_args.parent_region
|
|
171
177
|
|
|
172
|
-
identity_client.
|
|
178
|
+
identity_client.update_region(parsed_args.region, **kwargs)
|
|
173
179
|
|
|
174
180
|
|
|
175
181
|
class ShowRegion(command.ShowOne):
|
|
@@ -185,13 +191,8 @@ class ShowRegion(command.ShowOne):
|
|
|
185
191
|
return parser
|
|
186
192
|
|
|
187
193
|
def take_action(self, parsed_args):
|
|
188
|
-
identity_client = self.app.client_manager.identity
|
|
194
|
+
identity_client = self.app.client_manager.sdk_connection.identity
|
|
189
195
|
|
|
190
|
-
region =
|
|
191
|
-
identity_client.regions, parsed_args.region
|
|
192
|
-
)
|
|
196
|
+
region = identity_client.get_region(parsed_args.region)
|
|
193
197
|
|
|
194
|
-
|
|
195
|
-
region._info['parent_region'] = region._info.pop('parent_region_id')
|
|
196
|
-
region._info.pop('links', None)
|
|
197
|
-
return zip(*sorted(region._info.items()))
|
|
198
|
+
return _format_region(region)
|
|
@@ -81,6 +81,13 @@ class CreateRegisteredLimit(command.ShowOne):
|
|
|
81
81
|
region = common_utils.get_resource(
|
|
82
82
|
identity_client.regions, parsed_args.region
|
|
83
83
|
)
|
|
84
|
+
else:
|
|
85
|
+
self.log.warning(
|
|
86
|
+
_(
|
|
87
|
+
"Passing 'None' to indicate no region is deprecated. "
|
|
88
|
+
"Instead, don't pass --region."
|
|
89
|
+
)
|
|
90
|
+
)
|
|
84
91
|
|
|
85
92
|
registered_limit = identity_client.registered_limits.create(
|
|
86
93
|
service,
|
|
@@ -182,6 +189,13 @@ class ListRegisteredLimit(command.Lister):
|
|
|
182
189
|
region = common_utils.get_resource(
|
|
183
190
|
identity_client.regions, parsed_args.region
|
|
184
191
|
)
|
|
192
|
+
else:
|
|
193
|
+
self.log.warning(
|
|
194
|
+
_(
|
|
195
|
+
"Passing 'None' to indicate no region is deprecated. "
|
|
196
|
+
"Instead, don't pass --region."
|
|
197
|
+
)
|
|
198
|
+
)
|
|
185
199
|
|
|
186
200
|
registered_limits = identity_client.registered_limits.list(
|
|
187
201
|
service=service,
|
|
@@ -280,6 +294,10 @@ class SetRegisteredLimit(command.ShowOne):
|
|
|
280
294
|
region = common_utils.get_resource(
|
|
281
295
|
identity_client.regions, parsed_args.region
|
|
282
296
|
)
|
|
297
|
+
else:
|
|
298
|
+
self.log.warning(
|
|
299
|
+
_("Passing 'None' to indicate no region is deprecated.")
|
|
300
|
+
)
|
|
283
301
|
|
|
284
302
|
registered_limit = identity_client.registered_limits.update(
|
|
285
303
|
parsed_args.registered_limit_id,
|