python-blazarclient 4.0.1__py3-none-any.whl → 4.2.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.
@@ -28,7 +28,7 @@ FIRST_LEASE = 'd1e43d6d-8f6f-4c2e-b0a9-2982b39dc698'
28
28
  SECOND_LEASE = '424d21c3-45a2-448a-81ad-32eddc888375'
29
29
 
30
30
 
31
- @mock.patch('blazarclient.v1.shell_commands.leases._utc_now', mock_time)
31
+ @mock.patch('oslo_utils.timeutils.utcnow', mock_time)
32
32
  class CreateLeaseTestCase(tests.TestCase):
33
33
 
34
34
  def setUp(self):
blazarclient/utils.py CHANGED
@@ -22,7 +22,7 @@ from oslo_serialization import jsonutils as json
22
22
  from blazarclient import exception
23
23
  from blazarclient.i18n import _
24
24
 
25
- ELAPSED_TIME_REGEX = '^(\d+)([s|m|h|d])$' # noqa W605
25
+ ELAPSED_TIME_REGEX = r'^(\d+)([s|m|h|d])$'
26
26
 
27
27
  LEASE_DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%f'
28
28
  API_DATE_FORMAT = '%Y-%m-%d %H:%M'
@@ -30,5 +30,5 @@ class AllocationClientManager(base.BaseClientManager):
30
30
  resp, body = self.request_manager.get('/%s/allocations' % resource)
31
31
  allocations = body['allocations']
32
32
  if sort_by:
33
- allocations = sorted(allocations, key=lambda l: l[sort_by])
33
+ allocations = sorted(allocations, key=lambda alloc: alloc[sort_by])
34
34
  return allocations
@@ -43,5 +43,5 @@ class FloatingIPClientManager(base.BaseClientManager):
43
43
  resp, body = self.request_manager.get('/floatingips')
44
44
  floatingips = body['floatingips']
45
45
  if sort_by:
46
- floatingips = sorted(floatingips, key=lambda l: l[sort_by])
46
+ floatingips = sorted(floatingips, key=lambda fip: fip[sort_by])
47
47
  return floatingips
blazarclient/v1/hosts.py CHANGED
@@ -51,7 +51,7 @@ class ComputeHostClientManager(base.BaseClientManager):
51
51
  resp, body = self.request_manager.get('/os-hosts')
52
52
  hosts = body['hosts']
53
53
  if sort_by:
54
- hosts = sorted(hosts, key=lambda l: l[sort_by])
54
+ hosts = sorted(hosts, key=lambda host: host[sort_by])
55
55
  return hosts
56
56
 
57
57
  def list_properties(self, detail=False, all=False, sort_by=None):
@@ -76,7 +76,7 @@ class ComputeHostClientManager(base.BaseClientManager):
76
76
 
77
77
  if sort_by:
78
78
  resource_properties = sorted(resource_properties,
79
- key=lambda l: l[sort_by])
79
+ key=lambda rp: rp[sort_by])
80
80
  return resource_properties
81
81
 
82
82
  def get_property(self, property_name):
blazarclient/v1/leases.py CHANGED
@@ -91,7 +91,7 @@ class LeaseClientManager(base.BaseClientManager):
91
91
  resp, body = self.request_manager.get('/leases')
92
92
  leases = body['leases']
93
93
  if sort_by:
94
- leases = sorted(leases, key=lambda l: l[sort_by])
94
+ leases = sorted(leases, key=lambda lease: lease[sort_by])
95
95
  return leases
96
96
 
97
97
  def _add_lease_date(self, values, lease, key, delta_date, positive_delta):
@@ -20,6 +20,7 @@ import re
20
20
 
21
21
  from oslo_serialization import jsonutils
22
22
  from oslo_utils import strutils
23
+ from oslo_utils import timeutils
23
24
 
24
25
  from blazarclient import command
25
26
  from blazarclient import exception
@@ -52,22 +53,18 @@ CREATE_RESERVATION_KEYS = {
52
53
  "resource_properties": "",
53
54
  "resource_type": 'virtual:instance'
54
55
  },
56
+ "flavor:instance": {
57
+ "flavor_id": "",
58
+ "amount": "",
59
+ "affinity": "None",
60
+ "resource_type": 'flavor:instance'
61
+ },
55
62
  "others": {
56
63
  ".*": None
57
64
  }
58
65
  }
59
66
 
60
67
 
61
- def _utc_now():
62
- """Wrap datetime.datetime.utcnow so it can be mocked in unit tests.
63
-
64
- This is required because some of the tests require understanding the
65
- 'current time'; simply mocking utcnow() is made very difficult by
66
- the many different ways the datetime package is used in this module.
67
- """
68
- return datetime.datetime.utcnow()
69
-
70
-
71
68
  class ListLeases(command.ListCommand):
72
69
  """Print a list of leases."""
73
70
  resource = 'lease'
@@ -107,7 +104,7 @@ class CreateLeaseBase(command.CreateCommand):
107
104
  json_indent = 4
108
105
  log = logging.getLogger(__name__ + '.CreateLease')
109
106
  default_start = 'now'
110
- default_end = _utc_now() + datetime.timedelta(days=1)
107
+ default_end = timeutils.utcnow() + datetime.timedelta(days=1)
111
108
 
112
109
  def get_parser(self, prog_name):
113
110
  parser = super(CreateLeaseBase, self).get_parser(prog_name)
@@ -183,7 +180,7 @@ class CreateLeaseBase(command.CreateCommand):
183
180
  raise exception.IncorrectLease
184
181
 
185
182
  if parsed_args.start == 'now':
186
- start = _utc_now()
183
+ start = timeutils.utcnow()
187
184
  else:
188
185
  start = parsed_args.start
189
186
 
@@ -226,6 +223,8 @@ class CreateLeaseBase(command.CreateCommand):
226
223
  defaults = CREATE_RESERVATION_KEYS['virtual:instance']
227
224
  elif "virtual:floatingip" in res_str:
228
225
  defaults = CREATE_RESERVATION_KEYS['virtual:floatingip']
226
+ elif "flavor:instance" in res_str:
227
+ defaults = CREATE_RESERVATION_KEYS['flavor:instance']
229
228
  else:
230
229
  defaults = CREATE_RESERVATION_KEYS['others']
231
230
 
@@ -15,6 +15,7 @@ Hiroki Ito <ito.hiroki@lab.ntt.co.jp>
15
15
  Jason Anderson <jasonanderson@uchicago.edu>
16
16
  Jay Lau <liugya@cn.ibm.com>
17
17
  Jeremy Stanley <fungi@yuggoth.org>
18
+ John Garbutt <john.garbutt@stackhpc.com>
18
19
  Mark Powers <markpowers@uchicago.edu>
19
20
  Martin Kopec <mkopec@redhat.com>
20
21
  Masahito Muroi <muroi.masahito@lab.ntt.co.jp>
@@ -38,8 +39,10 @@ Sergey Lukjanov <slukjanov@mirantis.com>
38
39
  ShangXiao <shangxiaobj@inspur.com>
39
40
  Steve Martinelli <s.martinelli@gmail.com>
40
41
  Sylvain Bauza <sylvain.bauza@bull.net>
42
+ Takashi Natsume <takanattie@gmail.com>
41
43
  Tetsuro Nakamura <nakamura.tetsuro@lab.ntt.co.jp>
42
44
  Tetsuro Nakamura <tetsuro.nakamura.bc@hco.ntt.co.jp>
45
+ Thomas Goirand <zigo@debian.org>
43
46
  Tony Breeds <tony@bakeyournoodle.com>
44
47
  Vieri <15050873171@163.com>
45
48
  ZhijunWei <wzj334965317@outlook.com>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-blazarclient
3
- Version: 4.0.1
3
+ Version: 4.2.0
4
4
  Summary: Client for OpenStack Reservation Service
5
5
  Home-page: https://launchpad.net/blazar
6
6
  Author: OpenStack
@@ -29,7 +29,7 @@ Requires-Dist: keystoneauth1 (>=3.4.0)
29
29
  Requires-Dist: osc-lib (>=1.3.0)
30
30
  Requires-Dist: oslo.i18n (>=3.15.3)
31
31
  Requires-Dist: oslo.log (>=3.36.0)
32
- Requires-Dist: oslo.utils (>=3.33.0)
32
+ Requires-Dist: oslo.utils (>=7.0.0)
33
33
  Requires-Dist: pbr (!=2.1.0,>=2.0.0)
34
34
 
35
35
  ========================
@@ -5,7 +5,7 @@ blazarclient/command.py,sha256=m-Tek-l_1Xy3YZND5_f-9Ia8HiT3uCYxKIaCzHG1WOA,12448
5
5
  blazarclient/exception.py,sha256=nccQagxyp1wkgFSAxacbWXl6vdqvy0Q92jeW4TVL4mQ,3080
6
6
  blazarclient/i18n.py,sha256=xH89lr9tMpr9WQelTfqbjJJldqcxvDOLOgEJj6AjkFg,857
7
7
  blazarclient/shell.py,sha256=hD6db_wwQnz6cxNSmOv2E0SfehnQy9_LscBpyY7uoRo,13986
8
- blazarclient/utils.py,sha256=PHqygiKPlXW1eSvIbr5ASP1egfdyHfBZ9wYxpQD3oSg,5999
8
+ blazarclient/utils.py,sha256=HOjSVBFIV6ytewIUSWeS3OMxnC1czbIO5REijh563vM,5988
9
9
  blazarclient/version.py,sha256=r2fTZKJSyMU6-NtpZpGXVk3ZXkeNGtxQp06S-ajsgV0,682
10
10
  blazarclient/osc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  blazarclient/osc/plugin.py,sha256=1DcRdrjsEg5xata7iFanLFR8c2GTbnP5H1AgKv4pKNc,2120
@@ -19,23 +19,23 @@ blazarclient/tests/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
19
19
  blazarclient/tests/v1/shell_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  blazarclient/tests/v1/shell_commands/test_floatingips.py,sha256=7YRS34Q0FFuOvj18igKeimF6tuM96YO1hDDcR0ZkNlw,4920
21
21
  blazarclient/tests/v1/shell_commands/test_hosts.py,sha256=ChUgCTSwj_YjddIx9uZSPRVm0lQxTrA-KtnqllZUzgA,8026
22
- blazarclient/tests/v1/shell_commands/test_leases.py,sha256=3bLxmcJKi_phsln9fwiugll_3XufUTiTbu_g93OnzXc,13166
22
+ blazarclient/tests/v1/shell_commands/test_leases.py,sha256=0GbULeNp0tVRCYz7fa0IQwvGi_ZkQaD6Kn-4JAeVP54,13147
23
23
  blazarclient/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
- blazarclient/v1/allocations.py,sha256=YuNh-F8mlbK0MEvvG-yr98jfiQQk763NHRBVlM78NLw,1331
24
+ blazarclient/v1/allocations.py,sha256=NtA3zv-J9EgS6OrcG2XoqiJC5pVJZ1WI45CH3wsuHNI,1339
25
25
  blazarclient/v1/client.py,sha256=xTdnTA5hXT_3da6_ZYtC2HY4bHfUTY_1mBvQAHFfF_0,2719
26
- blazarclient/v1/floatingips.py,sha256=frat8gAi_YB9bQYc6kNVwQE6SMfPlroq3na9lbc8Ui4,1779
27
- blazarclient/v1/hosts.py,sha256=hyjd7rc-GMiK2i1G2fWrexX4cP699-n3bzOHvXRALhc,3335
28
- blazarclient/v1/leases.py,sha256=5g0Uio19bpfYUGiNzyDXodgLNwNlTuiajYJ2Fn2lys8,4044
26
+ blazarclient/v1/floatingips.py,sha256=hpr7RKWfRjIXhPuZfUN9wcVy2ZWNc0Nx6Zw7shQDZWo,1783
27
+ blazarclient/v1/hosts.py,sha256=1eplsonm-unFKcuuUGGW8Bztjd6GARiKfhPFHEcrF14,3343
28
+ blazarclient/v1/leases.py,sha256=_OYy7mgMV5JnNLoSZVQvZpYHEkwr_1fnZj6z8V2azBI,4052
29
29
  blazarclient/v1/shell_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
30
  blazarclient/v1/shell_commands/allocations.py,sha256=r92zczR04SFe5Dr-hxBwpajpVXP6pP-7cUk9yIDTmME,5222
31
31
  blazarclient/v1/shell_commands/floatingips.py,sha256=x9Ygy_-oysFntIk3Qb9bG3U236S_JPFMjb5I3CwDlIU,2905
32
32
  blazarclient/v1/shell_commands/hosts.py,sha256=Mg7ZmnaFla8mLFTf5LVr_BuSTva-O6vnXLF8c3awQKU,6533
33
- blazarclient/v1/shell_commands/leases.py,sha256=gKI0RrooeqxBgrWv7tv9oyyXG6NQ06QhZaz_DTDqTpQ,18799
34
- python_blazarclient-4.0.1.dist-info/AUTHORS,sha256=Vb9LFgCErhb6wS_MXgOusQebjJBZuhVSqoN1W86ZKZw,2379
35
- python_blazarclient-4.0.1.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
36
- python_blazarclient-4.0.1.dist-info/METADATA,sha256=L9dj4CAZvq-QQXf1vQTam0vYW8-LTd9W2x3EUGb4GCg,2341
37
- python_blazarclient-4.0.1.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
38
- python_blazarclient-4.0.1.dist-info/entry_points.txt,sha256=GeegiiG8GncGF7f6jonugjHhqNEYVaWe6TbYLhyhPWk,1687
39
- python_blazarclient-4.0.1.dist-info/pbr.json,sha256=ZwMsUXin22TlJiDEZnXyJBIw2Oh_5v9hDV86TIBC9lU,46
40
- python_blazarclient-4.0.1.dist-info/top_level.txt,sha256=yQx5ICRTYACa8B3aVm1rnJI6miXR0odH3BkwmoKD-0E,13
41
- python_blazarclient-4.0.1.dist-info/RECORD,,
33
+ blazarclient/v1/shell_commands/leases.py,sha256=P0KTucuTJibGbl14W9eU7IdtIFotfJM9wVL8bWNp88w,18762
34
+ python_blazarclient-4.2.0.dist-info/AUTHORS,sha256=DntWJBcJ5OK-o_id5Bhla7dS8TxnqilXkDB9veGr-44,2492
35
+ python_blazarclient-4.2.0.dist-info/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
36
+ python_blazarclient-4.2.0.dist-info/METADATA,sha256=bHFCDvuuQJc2n6kdon2OTTqTOK3_OBIxt6vMGOnh9_4,2340
37
+ python_blazarclient-4.2.0.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
38
+ python_blazarclient-4.2.0.dist-info/entry_points.txt,sha256=GeegiiG8GncGF7f6jonugjHhqNEYVaWe6TbYLhyhPWk,1687
39
+ python_blazarclient-4.2.0.dist-info/pbr.json,sha256=LUclCjnbsj4BzZtiu6GiFpsQ1wTZMqdPMSuS04wESZA,46
40
+ python_blazarclient-4.2.0.dist-info/top_level.txt,sha256=yQx5ICRTYACa8B3aVm1rnJI6miXR0odH3BkwmoKD-0E,13
41
+ python_blazarclient-4.2.0.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "20c3119", "is_release": true}
@@ -1 +0,0 @@
1
- {"git_version": "8eabd1e", "is_release": true}