From 3307d32323aadd263b656b4ac9ae604a04f85e3f Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Fri, 18 Mar 2016 11:47:24 -0500 Subject: [PATCH 1/6] Fixes iscsi listings with resources that have no datacenter --- SoftLayer/CLI/iscsi/list.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SoftLayer/CLI/iscsi/list.py b/SoftLayer/CLI/iscsi/list.py index 4dcb1508e..e36a04bfb 100644 --- a/SoftLayer/CLI/iscsi/list.py +++ b/SoftLayer/CLI/iscsi/list.py @@ -28,8 +28,10 @@ def cli(env): for iscsi in iscsi_list: table.add_row([ iscsi['id'], - iscsi['serviceResource']['datacenter'].get('name', - formatting.blank()), + utils.lookup(iscsi, + 'serviceResource', + 'datacenter', + 'name') or formatting.blank(), formatting.FormattedItem(iscsi.get('capacityGb', formatting.blank()), "%dGB" % iscsi.get('capacityGb', 0)), From 4b7d016a25efafb0223155578675f757b3542a60 Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Fri, 18 Mar 2016 19:37:59 -0500 Subject: [PATCH 2/6] Version bump to 5.0.0 --- CHANGELOG | 16 ++++++++++++++++ SoftLayer/consts.py | 2 +- docs/conf.py | 4 ++-- setup.py | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1d4f172ab..506bdf148 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,19 @@ +5.0.0 + + * Adds a shell (accessable with `slcli shell`) which provides autocomplete for slcli commands and options + + * Move modifying nic speed to `slcli virtual edit` and `slcli hardware edit` instead of having its own command + + * How filters work with `slcli call-api` has changed significantly. Instead of accepting JSON, it now accepts an easier-to-use format. See `slcli call-api -h` for examples + + * Adds manager for object storage + + * 'virtual' and 'hardware' are preferred over 'vs' and 'server' in the CLI + + * Improved REST transport support + + * Many bug fixes + 4.1.1 * Fixes to work with Click v5 diff --git a/SoftLayer/consts.py b/SoftLayer/consts.py index 4de750cb7..9b03ce82b 100644 --- a/SoftLayer/consts.py +++ b/SoftLayer/consts.py @@ -5,7 +5,7 @@ :license: MIT, see LICENSE for more details. """ -VERSION = 'v4.1.1' +VERSION = 'v5.0.0' API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/' API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/' API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/' diff --git a/docs/conf.py b/docs/conf.py index fd2fb1c81..df1612209 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,9 +55,9 @@ # built documents. # # The short X.Y version. -version = '4.1.1' +version = '5.0.0' # The full version, including alpha/beta/rc tags. -release = '4.1.1' +release = '5.0.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index bc53898f5..ea0e41113 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='SoftLayer', - version='4.1.1', + version='5.0.0', description=DESCRIPTION, long_description=LONG_DESCRIPTION, author='SoftLayer Technologies, Inc.', From 0a8395cf1485478966813b429b41bb7e0852be2d Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Sun, 20 Mar 2016 10:00:11 -0500 Subject: [PATCH 3/6] Updates CDN manager to use new purge method --- .../fixtures/SoftLayer_Network_ContentDelivery_Account.py | 2 ++ SoftLayer/managers/cdn.py | 4 ++-- tests/managers/cdn_tests.py | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SoftLayer/fixtures/SoftLayer_Network_ContentDelivery_Account.py b/SoftLayer/fixtures/SoftLayer_Network_ContentDelivery_Account.py index 9581d5b72..28e043bc8 100644 --- a/SoftLayer/fixtures/SoftLayer_Network_ContentDelivery_Account.py +++ b/SoftLayer/fixtures/SoftLayer_Network_ContentDelivery_Account.py @@ -33,3 +33,5 @@ loadContent = True purgeContent = True + +purgeCache = True diff --git a/SoftLayer/managers/cdn.py b/SoftLayer/managers/cdn.py index a805ed396..d93f148ad 100644 --- a/SoftLayer/managers/cdn.py +++ b/SoftLayer/managers/cdn.py @@ -131,8 +131,8 @@ def purge_content(self, account_id, urls): urls = [urls] for i in range(0, len(urls), MAX_URLS_PER_PURGE): - result = self.account.purgeContent(urls[i:i + MAX_URLS_PER_PURGE], - id=account_id) + result = self.account.purgeCache(urls[i:i + MAX_URLS_PER_PURGE], + id=account_id) if not result: return result diff --git a/tests/managers/cdn_tests.py b/tests/managers/cdn_tests.py index e4c20f52d..6f4387760 100644 --- a/tests/managers/cdn_tests.py +++ b/tests/managers/cdn_tests.py @@ -105,7 +105,7 @@ def test_purge_content(self): self.cdn_client.purge_content(12345, urls) calls = self.calls('SoftLayer_Network_ContentDelivery_Account', - 'purgeContent') + 'purgeCache') self.assertEqual(len(calls), math.ceil(len(urls) / float(cdn.MAX_URLS_PER_PURGE))) @@ -115,12 +115,12 @@ def test_purge_content_failure(self): 'http://x/img/0x001.png'] mock = self.set_mock('SoftLayer_Network_ContentDelivery_Account', - 'purgeContent') + 'purgeCache') mock.return_value = False self.cdn_client.purge_content(12345, urls) calls = self.calls('SoftLayer_Network_ContentDelivery_Account', - 'purgeContent') + 'purgeCache') self.assertEqual(len(calls), math.ceil(len(urls) / float(cdn.MAX_URLS_PER_PURGE))) @@ -129,6 +129,6 @@ def test_purge_content_single(self): self.cdn_client.purge_content(12345, url) self.assert_called_with('SoftLayer_Network_ContentDelivery_Account', - 'purgeContent', + 'purgeCache', args=([url],), identifier=12345) From 5988719926b800041b94fa1f4e85c2578ec5d68d Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Mon, 21 Mar 2016 10:39:48 -0500 Subject: [PATCH 4/6] Automatically convert integer image ID to GUID on virtual create command --- SoftLayer/CLI/virt/create.py | 8 +++++++- tests/CLI/modules/vs_tests.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/SoftLayer/CLI/virt/create.py b/SoftLayer/CLI/virt/create.py index 189eb53fd..d764cfb09 100644 --- a/SoftLayer/CLI/virt/create.py +++ b/SoftLayer/CLI/virt/create.py @@ -81,7 +81,13 @@ def _parse_create_args(client, args): data['os_code'] = args['os'] if args.get('image'): - data['image_id'] = args['image'] + if args.get('image').isdigit(): + image_mgr = SoftLayer.ImageManager(client) + image_details = image_mgr.get_image(args.get('image'), + mask="id,globalIdentifier") + data['image_id'] = image_details['globalIdentifier'] + else: + data['image_id'] = args['image'] if args.get('datacenter'): data['datacenter'] = args['datacenter'] diff --git a/tests/CLI/modules/vs_tests.py b/tests/CLI/modules/vs_tests.py index 5b5ff810d..573de5fe8 100644 --- a/tests/CLI/modules/vs_tests.py +++ b/tests/CLI/modules/vs_tests.py @@ -134,6 +134,41 @@ def test_create(self, confirm_mock): self.assert_called_with('SoftLayer_Virtual_Guest', 'createObject', args=args) + @mock.patch('SoftLayer.CLI.formatting.confirm') + def test_create_with_integer_image_id(self, confirm_mock): + confirm_mock.return_value = True + result = self.run_command(['vs', 'create', + '--cpu=2', + '--domain=example.com', + '--hostname=host', + '--image=12345', + '--memory=1', + '--network=100', + '--billing=hourly', + '--datacenter=dal05']) + + self.assertEqual(result.exit_code, 0) + self.assertEqual(json.loads(result.output), + {'guid': '1a2b3c-1701', + 'id': 100, + 'created': '2013-08-01 15:23:45'}) + + args = ({ + 'datacenter': {'name': 'dal05'}, + 'domain': 'example.com', + 'hourlyBillingFlag': True, + 'localDiskFlag': True, + 'maxMemory': 1024, + 'hostname': 'host', + 'startCpus': 2, + 'blockDeviceTemplateGroup': { + 'globalIdentifier': '0B5DEAF4-643D-46CA-A695-CECBE8832C9D', + }, + 'networkComponents': [{'maxSpeed': '100'}] + },) + self.assert_called_with('SoftLayer_Virtual_Guest', 'createObject', + args=args) + @mock.patch('SoftLayer.CLI.formatting.confirm') def test_dns_sync_both(self, confirm_mock): confirm_mock.return_value = True From 98a294de4ce4c471a3a409a5e93133b5ad342763 Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Wed, 30 Mar 2016 15:42:50 -0500 Subject: [PATCH 5/6] Adds pygments as a depdendendy since prompt_toolkit removed it --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index ea0e41113..cb8cd071b 100644 --- a/setup.py +++ b/setup.py @@ -36,6 +36,7 @@ 'click >= 5', 'requests >= 2.7.0', 'prompt_toolkit >= 0.53', + 'pygments >= 2.0.0', ], keywords=['softlayer', 'cloud'], classifiers=[ From b5cb4a6e0c898d269faca8bc28832a629cded05e Mon Sep 17 00:00:00 2001 From: Kevin McDonald Date: Wed, 30 Mar 2016 15:56:37 -0500 Subject: [PATCH 6/6] Version bump (5.0.1) --- CHANGELOG | 8 ++++++++ SoftLayer/consts.py | 2 +- docs/conf.py | 4 ++-- setup.py | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 506bdf148..39c1ee470 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +5.0.1 + + * Adds missing depdendency that was previously pulled in by prompt_toolkit + + * Fix a bug by updating the CDN manager to use the new purge method + + * Fixes bug that occured when iscsi listings with resources have no datacenter + 5.0.0 * Adds a shell (accessable with `slcli shell`) which provides autocomplete for slcli commands and options diff --git a/SoftLayer/consts.py b/SoftLayer/consts.py index 9b03ce82b..abcd90c7e 100644 --- a/SoftLayer/consts.py +++ b/SoftLayer/consts.py @@ -5,7 +5,7 @@ :license: MIT, see LICENSE for more details. """ -VERSION = 'v5.0.0' +VERSION = 'v5.0.1' API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3.1/' API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3.1/' API_PUBLIC_ENDPOINT_REST = 'https://api.softlayer.com/rest/v3.1/' diff --git a/docs/conf.py b/docs/conf.py index df1612209..cb63c4dad 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -55,9 +55,9 @@ # built documents. # # The short X.Y version. -version = '5.0.0' +version = '5.0.1' # The full version, including alpha/beta/rc tags. -release = '5.0.0' +release = '5.0.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/setup.py b/setup.py index ea0e41113..58bccfe54 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='SoftLayer', - version='5.0.0', + version='5.0.1', description=DESCRIPTION, long_description=LONG_DESCRIPTION, author='SoftLayer Technologies, Inc.', @@ -49,8 +49,8 @@ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', ],