diff --git a/CHANGELOG b/CHANGELOG index 1d4f172ab..39c1ee470 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,27 @@ +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 + + * 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/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)), 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/SoftLayer/consts.py b/SoftLayer/consts.py index 4de750cb7..abcd90c7e 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.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/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/docs/conf.py b/docs/conf.py index fd2fb1c81..cb63c4dad 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.1' # The full version, including alpha/beta/rc tags. -release = '4.1.1' +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 bc53898f5..cce102aab 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='SoftLayer', - version='4.1.1', + version='5.0.1', description=DESCRIPTION, long_description=LONG_DESCRIPTION, author='SoftLayer Technologies, Inc.', @@ -36,6 +36,7 @@ 'click >= 5', 'requests >= 2.7.0', 'prompt_toolkit >= 0.53', + 'pygments >= 2.0.0', ], keywords=['softlayer', 'cloud'], classifiers=[ @@ -49,8 +50,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', ], 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 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)