Skip to content

Commit 0746019

Browse files
Merge branch 'master' of github.com:softlayer/softlayer-python into issues771
2 parents 324ee26 + f40fffa commit 0746019

File tree

7 files changed

+41
-18
lines changed

7 files changed

+41
-18
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
# Change Log
22

33

4+
## [5.8.2] - 2019-11-15
5+
- https://github.com/softlayer/softlayer-python/compare/v5.8.1...v5.8.2
6+
7+
8+
+ #1186 Fixed a unit test that could fail if the test took too long to run.
9+
+ #1183 Added a check to ensure subnet and vlan options are properly added to the order for virtual servers.
10+
+ #1184 Fixed a readme misspelling.
11+
+ #1182 Fixed vs reboot unable to resolve vs names.
12+
+ #1095 Handle missing Fixtures better for unit tests.
13+
414
## [5.8.1] - 2019-10-11
515
- https://github.com/softlayer/softlayer-python/compare/v5.8.0...v5.8.1
616

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ System Requirements
129129
* A connection to SoftLayer's private network is required to use
130130
our private network API endpoints.
131131

132-
Pyhton 2.7 Support
132+
Python 2.7 Support
133133
------------------
134134
As of version 5.8.0 SoftLayer-Python will no longer support python2.7, which is `End Of Life as of 2020 <https://www.python.org/dev/peps/pep-0373/>`_ .
135135
If you cannot install python 3.6+ for some reason, you will need to use a version of softlayer-python <= 5.7.2
@@ -147,6 +147,6 @@ Python Packages
147147

148148
Copyright
149149
---------
150-
This software is Copyright (c) 2016-2018 SoftLayer Technologies, Inc.
150+
This software is Copyright (c) 2016-2019 SoftLayer Technologies, Inc.
151151

152152
See the bundled LICENSE file for more information.

SoftLayer/consts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
VERSION = 'v5.8.1'
8+
VERSION = 'v5.8.2'
99
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/'
1010
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/'
1111
API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/'

SoftLayer/managers/cdn.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class CDNManager(utils.IdentifierMixin, object):
2121

2222
def __init__(self, client):
2323
self.client = client
24+
self._start_date = None
25+
self._end_date = None
2426
self.cdn_configuration = self.client['Network_CdnMarketplace_Configuration_Mapping']
2527
self.cdn_path = self.client['SoftLayer_Network_CdnMarketplace_Configuration_Mapping_Path']
2628
self.cdn_metrics = self.client['Network_CdnMarketplace_Metrics']
@@ -151,10 +153,20 @@ def get_usage_metrics(self, unique_id, history=30, frequency="aggregate"):
151153
_start = utils.days_to_datetime(history)
152154
_end = utils.days_to_datetime(0)
153155

154-
_start_date = utils.timestamp(_start)
155-
_end_date = utils.timestamp(_end)
156+
self._start_date = utils.timestamp(_start)
157+
self._end_date = utils.timestamp(_end)
156158

157-
usage = self.cdn_metrics.getMappingUsageMetrics(unique_id, _start_date, _end_date, frequency)
159+
usage = self.cdn_metrics.getMappingUsageMetrics(unique_id, self._start_date, self._end_date, frequency)
158160

159161
# The method getMappingUsageMetrics() returns an array but there is only 1 object
160162
return usage[0]
163+
164+
@property
165+
def start_data(self):
166+
"""Retrieve the cdn usage metric start date."""
167+
return self._start_date
168+
169+
@property
170+
def end_date(self):
171+
"""Retrieve the cdn usage metric end date."""
172+
return self._end_date

SoftLayer/managers/vs.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ def _generate_create_dict(
429429
def _create_network_components(
430430
self, public_vlan=None, private_vlan=None,
431431
private_subnet=None, public_subnet=None):
432-
433432
parameters = {}
434433
if private_vlan:
435434
parameters['primaryBackendNetworkComponent'] = {"networkVlan": {"id": int(private_vlan)}}
@@ -532,7 +531,16 @@ def verify_create_instance(self, **kwargs):
532531
"""
533532
kwargs.pop('tags', None)
534533
create_options = self._generate_create_dict(**kwargs)
535-
return self.guest.generateOrderTemplate(create_options)
534+
template = self.guest.generateOrderTemplate(create_options)
535+
if 'private_subnet' in kwargs or 'public_subnet' in kwargs:
536+
vsi = template['virtualGuests'][0]
537+
network_components = self._create_network_components(kwargs.get('public_vlan', None),
538+
kwargs.get('private_vlan', None),
539+
kwargs.get('private_subnet', None),
540+
kwargs.get('public_subnet', None))
541+
vsi.update(network_components)
542+
543+
return template
536544

537545
def create_instance(self, **kwargs):
538546
"""Creates a new virtual server instance.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setup(
1616
name='SoftLayer',
17-
version='5.8.1',
17+
version='5.8.2',
1818
description=DESCRIPTION,
1919
long_description=LONG_DESCRIPTION,
2020
author='SoftLayer Technologies, Inc.',

tests/managers/cdn_tests.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from SoftLayer.managers import cdn
99
from SoftLayer import testing
10-
from SoftLayer import utils
1110

1211

1312
class CDNTests(testing.TestCase):
@@ -31,15 +30,9 @@ def test_detail_cdn(self):
3130
def test_detail_usage_metric(self):
3231
self.cdn_client.get_usage_metrics(12345, history=30, frequency="aggregate")
3332

34-
_start = utils.days_to_datetime(30)
35-
_end = utils.days_to_datetime(0)
36-
37-
_start_date = utils.timestamp(_start)
38-
_end_date = utils.timestamp(_end)
39-
4033
args = (12345,
41-
_start_date,
42-
_end_date,
34+
self.cdn_client.start_data,
35+
self.cdn_client.end_date,
4336
"aggregate")
4437
self.assert_called_with('SoftLayer_Network_CdnMarketplace_Metrics',
4538
'getMappingUsageMetrics',

0 commit comments

Comments
 (0)