Skip to content

Commit 93888aa

Browse files
committed
sync with master and other gorp
2 parents e73e730 + 23dab1e commit 93888aa

103 files changed

Lines changed: 5234 additions & 1060 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ matrix:
44
include:
55
- python: "2.7"
66
env: TOX_ENV=py27
7-
- python: "3.3"
8-
env: TOX_ENV=py33
9-
- python: "3.4"
10-
env: TOX_ENV=py34
117
- python: "3.5"
128
env: TOX_ENV=py35
139
- python: "3.6"

CHANGELOG.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,68 @@
11
# Change Log
22

3+
4+
## [5.4.0] - 2018-01-15
5+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.2...master
6+
7+
- Upgraded Requests and Urllib3 library to latest. This allows the library to make use of connection retries, and connection pools. This should prevent the client from crashing if the API gives a connection reset / connection timeout error
8+
- reworked wait_for_ready function for virtual, and added to hardware managers.
9+
- fixed block/file iops in the `slcli block|file detail` view
10+
- Added sub items to `hw detail --price`, removed reverse PTR entries
11+
12+
### Added to CLI
13+
- slcli order
14+
```
15+
$ ./slcli order
16+
Usage: slcli order [OPTIONS] COMMAND [ARGS]...
17+
18+
Options:
19+
-h, --help Show this message and exit.
20+
21+
Commands:
22+
category-list List the categories of a package.
23+
item-list List package items used for ordering.
24+
package-list List packages that can be ordered via the...
25+
package-locations List Datacenters a package can be ordered in.
26+
place Place or verify an order.
27+
preset-list List package presets.
28+
```
29+
30+
31+
## [5.3.2] - 2017-12-18
32+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.1...v5.3.2
33+
34+
- Expanded `@retry` useage to a few areas in the hardware manager
35+
- Added INTERVAL options to block and file replication
36+
- Fixed pricing error on `hw detail --price`
37+
- Added sub items to `hw detail --price`, removed reverse PTR entries
38+
39+
### Added to CLI
40+
- slcli dedicatedhost
41+
42+
43+
## [5.3.1] - 2017-12-07
44+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.0...v5.3.1
45+
- Added support for storage volume modifications
46+
47+
### Added to CLI
48+
- slcli block volume-modify
49+
- slcli file volume-modify
50+
51+
## [5.3.0] - 2017-12-01
52+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.2.15...v5.3.0
53+
- Added a retry decorator. currently only used in setTags for VSI creation, which should allos VSI creation to be a bit more robust.
54+
- Updated unit tests to work with pytest3.3
55+
56+
## [5.2.15] - 2017-10-30
57+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.2.14...v5.2.15
58+
- Added dedicated host info to virt detail
59+
- #885 - Fixed createObjects on the rest api endpoint
60+
- changed securityGroups to use createObject instead of createObjects
61+
- Always set the endpoint_url by defaulting to the public URL if the endpoint type cannot be determined.
62+
- resource metadata update
63+
364
## [5.2.14] - 2017-09-13
4-
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.2.13...master
65+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.2.13...v5.2.14
566
- Improved slcli vs create-options output
667
- Updated slcli vs create to support new virtual server public and dedicated host offerings
768

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ Swapnil Khanapurkar <[email protected]>
2929
The SoftLayer Developer Network <[email protected]>
3030
Tim Ariyeh <[email protected]>
3131
Wissam Elriachy <[email protected]>
32+
Anthony Monthe (ZuluPro) <[email protected]>

README.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ XML-RPC API <http://developer.softlayer.com/reference/softlayerapi>`_.
1919
A command-line interface is also included and can be used to manage various
2020
SoftLayer products and services.
2121

22-
Development on this library is done as a best-effort delivery, and some features of the SoftLayer API may not be available through the client.
2322

2423
Documentation
2524
-------------
@@ -32,6 +31,8 @@ Additional API documentation can be found on the SoftLayer Development Network:
3231
<http://developer.softlayer.com/reference/softlayerapi>`_
3332
* `Object mask information and examples
3433
<http://developer.softlayer.com/article/Object-Masks>`_
34+
* `Code Examples
35+
<https://softlayer.github.io/python/>`_
3536

3637
Installation
3738
------------
@@ -56,16 +57,31 @@ InsecurePlatformWarning Notice
5657
------------------------------
5758
This library relies on the `requests <http://docs.python-requests.org/>`_ library to make HTTP requests. On Python versions below Python 2.7.9, requests has started emitting a security warning (InsecurePlatformWarning) due to insecurities with creating SSL connections. To resolve this, upgrade to Python 2.7.9+ or follow the instructions here: http://stackoverflow.com/a/29099439.
5859

60+
Getting Help
61+
------------
62+
Bugs and feature requests about this library should have a `GitHub issue <https://github.com/softlayer/softlayer-python/issues>`_ opened about them.
63+
64+
Issues with the Softlayer API itself should be addressed by opening a ticket.
65+
5966
System Requirements
6067
-------------------
6168
* Python 2.7, 3.3, 3.4, 3.5 or 3.6.
6269
* A valid SoftLayer API username and key.
6370
* A connection to SoftLayer's private network is required to use
6471
our private network API endpoints.
6572

73+
Python Packages
74+
---------------
75+
* six >= 1.7.0
76+
* prettytable >= 0.7.0
77+
* click >= 5
78+
* requests >= 2.18.4
79+
* prompt_toolkit >= 0.53
80+
* pygments >= 2.0.0
81+
* urllib3 >= 1.22
6682

6783
Copyright
6884
---------
69-
This software is Copyright (c) 2016 SoftLayer Technologies, Inc.
85+
This software is Copyright (c) 2016-2018 SoftLayer Technologies, Inc.
7086

7187
See the bundled LICENSE file for more information.

SoftLayer/API.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8+
# pylint: disable=invalid-name
89
import warnings
910

1011
from SoftLayer import auth as slauth
1112
from SoftLayer import config
1213
from SoftLayer import consts
1314
from SoftLayer import transports
1415

15-
# pylint: disable=invalid-name
16-
17-
1816
API_PUBLIC_ENDPOINT = consts.API_PUBLIC_ENDPOINT
1917
API_PRIVATE_ENDPOINT = consts.API_PRIVATE_ENDPOINT
2018
__all__ = [

SoftLayer/CLI/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
66
:license: MIT, see LICENSE for more details.
77
"""
8-
# pylint: disable=w0401
8+
# pylint: disable=w0401, invalid-name
9+
import logging
910

1011
from SoftLayer.CLI.helpers import * # NOQA
12+
13+
logger = logging.getLogger()
14+
logger.addHandler(logging.StreamHandler())
15+
logger.setLevel(logging.INFO)

SoftLayer/CLI/block/detail.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def cli(env, volume_id):
2828
table.add_row(['Capacity (GB)', "%iGB" % block_volume['capacityGb']])
2929
table.add_row(['LUN Id', "%s" % block_volume['lunId']])
3030

31-
if block_volume.get('iops'):
32-
table.add_row(['IOPs', block_volume['iops']])
31+
if block_volume.get('provisionedIops'):
32+
table.add_row(['IOPs', int(block_volume['provisionedIops'])])
3333

3434
if block_volume.get('storageTierLevel'):
3535
table.add_row([
@@ -62,12 +62,10 @@ def cli(env, volume_id):
6262

6363
if block_volume['activeTransactions']:
6464
for trans in block_volume['activeTransactions']:
65-
table.add_row([
66-
'Ongoing Transactions',
67-
trans['transactionStatus']['friendlyName']])
65+
if 'transactionStatus' in trans and 'friendlyName' in trans['transactionStatus']:
66+
table.add_row(['Ongoing Transaction', trans['transactionStatus']['friendlyName']])
6867

69-
table.add_row(['Replicant Count', "%u"
70-
% block_volume['replicationPartnerCount']])
68+
table.add_row(['Replicant Count', "%u" % block_volume.get('replicationPartnerCount', 0)])
7169

7270
if block_volume['replicationPartnerCount'] > 0:
7371
# This if/else temporarily handles a bug in which the SL API
@@ -102,12 +100,12 @@ def cli(env, volume_id):
102100
table.add_row(['Replicant Volumes', replicant_list])
103101

104102
if block_volume.get('originalVolumeSize'):
105-
duplicate_info = formatting.Table(['Original Volume Name',
106-
block_volume['originalVolumeName']])
107-
duplicate_info.add_row(['Original Volume Size',
108-
block_volume['originalVolumeSize']])
109-
duplicate_info.add_row(['Original Snapshot Name',
110-
block_volume['originalSnapshotName']])
111-
table.add_row(['Duplicate Volume Properties', duplicate_info])
103+
original_volume_info = formatting.Table(['Property', 'Value'])
104+
original_volume_info.add_row(['Original Volume Size', block_volume['originalVolumeSize']])
105+
if block_volume.get('originalVolumeName'):
106+
original_volume_info.add_row(['Original Volume Name', block_volume['originalVolumeName']])
107+
if block_volume.get('originalSnapshotName'):
108+
original_volume_info.add_row(['Original Snapshot Name', block_volume['originalSnapshotName']])
109+
table.add_row(['Original Volume Properties', original_volume_info])
112110

113111
env.fout(table)

SoftLayer/CLI/block/duplicate.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
'the origin volume will be used.***\n'
2323
'Potential Sizes: [20, 40, 80, 100, 250, '
2424
'500, 1000, 2000, 4000, 8000, 12000] '
25-
'Minimum: [the size of the origin volume] '
26-
'Maximum: [the minimum of 12000 GB or '
27-
'10*(origin volume size)]')
25+
'Minimum: [the size of the origin volume]')
2826
@click.option('--duplicate-iops', '-i',
2927
type=int,
3028
help='Performance Storage IOPS, between 100 and 6000 in '

SoftLayer/CLI/block/modify.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"""Modify an existing block storage volume."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
import SoftLayer
6+
from SoftLayer.CLI import environment
7+
from SoftLayer.CLI import exceptions
8+
9+
10+
CONTEXT_SETTINGS = {'token_normalize_func': lambda x: x.upper()}
11+
12+
13+
@click.command(context_settings=CONTEXT_SETTINGS)
14+
@click.argument('volume-id')
15+
@click.option('--new-size', '-c',
16+
type=int,
17+
help='New Size of block volume in GB. ***If no size is given, the original size of volume is used.***\n'
18+
'Potential Sizes: [20, 40, 80, 100, 250, 500, 1000, 2000, 4000, 8000, 12000]\n'
19+
'Minimum: [the original size of the volume]')
20+
@click.option('--new-iops', '-i',
21+
type=int,
22+
help='Performance Storage IOPS, between 100 and 6000 in multiples of 100 [only for performance volumes] '
23+
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***\n'
24+
'Requirements: [If original IOPS/GB for the volume is less than 0.3, new IOPS/GB must also be '
25+
'less than 0.3. If original IOPS/GB for the volume is greater than or equal to 0.3, new IOPS/GB '
26+
'for the volume must also be greater than or equal to 0.3.]')
27+
@click.option('--new-tier', '-t',
28+
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] '
29+
'***If no tier is specified, the original tier of the volume will be used.***\n'
30+
'Requirements: [If original IOPS/GB for the volume is 0.25, new IOPS/GB for the volume must also '
31+
'be 0.25. If original IOPS/GB for the volume is greater than 0.25, new IOPS/GB for the volume '
32+
'must also be greater than 0.25.]',
33+
type=click.Choice(['0.25', '2', '4', '10']))
34+
@environment.pass_env
35+
def cli(env, volume_id, new_size, new_iops, new_tier):
36+
"""Modify an existing block storage volume."""
37+
block_manager = SoftLayer.BlockStorageManager(env.client)
38+
39+
if new_tier is not None:
40+
new_tier = float(new_tier)
41+
42+
try:
43+
order = block_manager.order_modified_volume(
44+
volume_id,
45+
new_size=new_size,
46+
new_iops=new_iops,
47+
new_tier_level=new_tier,
48+
)
49+
except ValueError as ex:
50+
raise exceptions.ArgumentError(str(ex))
51+
52+
if 'placedOrder' in order.keys():
53+
click.echo("Order #{0} placed successfully!".format(order['placedOrder']['id']))
54+
for item in order['placedOrder']['items']:
55+
click.echo(" > %s" % item['description'])
56+
else:
57+
click.echo("Order could not be placed! Please verify your options and try again.")

SoftLayer/CLI/block/replication/order.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
@click.argument('volume_id')
1515
@click.option('--snapshot-schedule', '-s',
1616
help='Snapshot schedule to use for replication, '
17-
'(HOURLY | DAILY | WEEKLY)',
17+
'(INTERVAL | HOURLY | DAILY | WEEKLY)',
1818
required=True,
19-
type=click.Choice(['HOURLY', 'DAILY', 'WEEKLY']))
19+
type=click.Choice(['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']))
2020
@click.option('--location', '-l',
2121
help='Short name of the data center for the replicant '
2222
'(e.g.: dal09)',

0 commit comments

Comments
 (0)