Skip to content

Commit 495dcc2

Browse files
authored
Merge branch 'master' into finishfish
2 parents 6ae6814 + eeabb61 commit 495dcc2

197 files changed

Lines changed: 10183 additions & 2205 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.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ dist/*
1414
*.egg-info
1515
.cache
1616
.idea
17+
.pytest_cache/*
18+
slcli

CHANGELOG.md

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

3+
4+
## [5.6.4] - 2018-11-16
5+
6+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.3...v5.6.4
7+
8+
+ #1041 Dedicated host cancel, cancel-guests, list-guests
9+
+ #1071 added createDate and modifyDate parameters to sg rule-list
10+
+ #1060 Fixed slcli subnet list
11+
+ #1056 Fixed documentation link in image manager
12+
+ #1062 Added description to slcli order
13+
14+
## [5.6.3] - 2018-11-07
15+
16+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.6.0...v5.6.3
17+
18+
+ #1065 Updated urllib3 and requests libraries due to CVE-2018-18074
19+
+ #1070 Fixed an ordering bug
20+
+ Updated release process and fab-file
21+
22+
## [5.6.0] - 2018-10-16
23+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.5.3...v5.6.0
24+
25+
+ #1026 Support for [Reserved Capacity](https://console.bluemix.net/docs/vsi/vsi_about_reserved.html#about-reserved-virtual-servers)
26+
* `slcli vs capacity create`
27+
* `slcli vs capacity create-guest`
28+
* `slcli vs capacity create-options`
29+
* `slcli vs capacity detail`
30+
* `slcli vs capacity list`
31+
+ #1050 Fix `post_uri` parameter name on docstring
32+
+ #1039 Fixed suspend cloud server order.
33+
+ #1055 Update to use click 7
34+
+ #1053 Add export/import capabilities to/from IBM Cloud Object Storage to the image manager as well as the slcli.
35+
36+
37+
## [5.5.3] - 2018-08-31
38+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.5.2...v5.5.3
39+
40+
+ Added `slcli user delete`
41+
+ #1023 Added `slcli order quote` to let users create a quote from the slcli.
42+
+ #1032 Fixed vs upgrades when using flavors.
43+
+ #1034 Added pagination to ticket list commands
44+
+ #1037 Fixed DNS manager to be more flexible and support more zone types.
45+
+ #1044 Pinned Click library version at >=5 < 7
46+
47+
## [5.5.2] - 2018-08-31
48+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.5.1...v5.5.2
49+
50+
+ #1018 Fixed hardware credentials.
51+
+ #1019 support for ticket priorities
52+
+ #1025 create dedicated host with gpu fixed.
53+
54+
55+
## [5.5.1] - 2018-08-06
56+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.5.0...v5.5.1
57+
58+
- #1006, added paginations to several slcli methods, making them work better with large result sets.
59+
- #995, Fixed an issue displaying VLANs.
60+
- #1011, Fixed an issue displaying some NAS passwords
61+
- #1014, Ability to delete users
62+
63+
## [5.5.0] - 2018-07-09
64+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.4...v5.5.0
65+
66+
- Added a warning when ordering legacy storage volumes
67+
- Added documentation link to volume-order
68+
- Increased slcli output width limit to 999 characters
69+
- More unit tests
70+
- Fixed an issue canceling some block storage volumes
71+
- Fixed `slcli order` to work with network gateways
72+
- Fixed an issue showing hardware credentials when they do not exist
73+
- Fixed an issue showing addressSpace when listing virtual servers
74+
- Updated ordering class to support baremetal servers with multiple GPU
75+
- Updated prompt-toolkit as a fix for `slcli shell`
76+
- Fixed `slcli vlan detail` to not fail when objects don't have a hostname
77+
- Added user management
78+
79+
80+
## [5.4.4] - 2018-04-18
81+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.3...v5.4.4
82+
83+
- fixed hw list not showing transactions
84+
- Re-factored RestTransport and XMLRPCTransport, logging is now only done in the DebugTransport
85+
- Added print_reproduceable to XMLRPCTransport and RestTransport, which should be very useful in printing out pure API calls.
86+
- Fixed an issue with RestTransport and locationGroupId
87+
88+
89+
## [5.4.3] - 2018-03-30
90+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.2...v5.4.3
91+
92+
- Corrected to current create-options output
93+
- Allow ordering of account restricted presets
94+
- Added lookup function for datacenter names and ability to use `slcli order` with short DC names
95+
- Changed locatoinGroupId to check for None instead of empty string
96+
- Added a way to try to cancel montly bare metal immediately. THis is done by automatically updating the cancellation request. A human still needs to read the ticket and process it for the reclaim to complete.
97+
98+
## [5.4.2] - 2018-02-22
99+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.1...v5.4.2
100+
101+
- add GPU to the virtual create-options table
102+
- Remove 'virtual' from the hardware ready command.
103+
- Carefully check for the metric tracking id on virtual guests when building a bandwidth report.
104+
- Do not fail if the source or destination subnet mask does not exist for ipv6 rules.
105+
106+
## [5.4.1] - 2018-02-05
107+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.4.0...v5.4.1
108+
109+
- Improve error conditions when adding SSH keys
110+
- added type filters to package-list, auto-removes bluemix_services on package listing
111+
- Add boot mode option to virtual guest creation
112+
- Update documentation for security group rule add
113+
- Add fix for unsetting of values in edit SG rules
114+
115+
## [5.4.0] - 2018-01-15
116+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.2...v5.4.0
117+
118+
- 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
119+
- reworked wait_for_ready function for virtual, and added to hardware managers.
120+
- fixed block/file iops in the `slcli block|file detail` view
121+
- Added sub items to `hw detail --price`, removed reverse PTR entries
122+
123+
### Added to CLI
124+
- slcli order
125+
```
126+
$ ./slcli order
127+
Usage: slcli order [OPTIONS] COMMAND [ARGS]...
128+
129+
Options:
130+
-h, --help Show this message and exit.
131+
132+
Commands:
133+
category-list List the categories of a package.
134+
item-list List package items used for ordering.
135+
package-list List packages that can be ordered via the...
136+
package-locations List Datacenters a package can be ordered in.
137+
place Place or verify an order.
138+
preset-list List package presets.
139+
```
140+
141+
3142
## [5.3.2] - 2017-12-18
4-
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.1...master
143+
- Changes: https://github.com/softlayer/softlayer-python/compare/v5.3.1...v5.3.2
5144

6145
- Expanded `@retry` useage to a few areas in the hardware manager
7146
- Added INTERVAL options to block and file replication

CONTRIBUTING.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,93 @@ guidelines below.
1212
* Additional infomration can be found in our [contribution guide](http://softlayer-python.readthedocs.org/en/latest/dev/index.html)
1313

1414

15+
## Code style
16+
17+
Code is tested and style checked with tox, you can run the tox tests individually by doing `tox -e <TEST>`
18+
19+
* `autopep8 -r -v -i --max-line-length 119 SoftLayer/`
20+
* `autopep8 -r -v -i --max-line-length 119 tests/`
21+
* `tox -e analysis`
22+
* `tox -e py36`
23+
* `git commit --message="#<ISSUENUMBER> <whatever you did>`
24+
* `git push origin <issueBranch>`
25+
* create pull request
26+
27+
28+
## Documentation
29+
30+
CLI command should have a more human readable style of documentation.
31+
Manager methods should have a decent docblock describing any parameters and what the method does.
32+
33+
Docs are generated with [Sphinx](https://docs.readthedocs.io/en/latest/intro/getting-started-with-sphinx.html) and once Sphinx is setup, you can simply do
34+
35+
`make html` in the softlayer-python/docs directory, which should generate the HTML in softlayer-python/docs/_build/html for testing.
36+
37+
38+
## Unit Tests
39+
40+
All new features should be 100% code covered, and your pull request should at the very least increase total code overage.
41+
42+
### Mocks
43+
To tests results from the API, we keep mock results in SoftLayer/fixtures/<SoftLayer_Service>/ with the method name matching the variable name.
44+
45+
Any call to a service that doesn't have a fixture will result in a TransportError
46+
47+
### Overriding Fixtures
48+
49+
Adding your expected output in the fixtures file with a unique name is a good way to define a fixture that gets used frequently in a test.
50+
51+
```python
52+
from SoftLayer.fixtures import SoftLayer_Product_Package
53+
54+
def test_test(self):
55+
amock = self.set_mock('SoftLayer_Product_Package', 'getAllObjects')
56+
amock.return_value = fixtures.SoftLayer_Product_Package.RESERVED_CAPACITY
57+
```
58+
59+
Otherwise defining it on the spot works too.
60+
```python
61+
def test_test(self):
62+
mock = self.set_mock('SoftLayer_Network_Storage', 'getObject')
63+
mock.return_value = {
64+
'billingItem': {'hourlyFlag': True, 'id': 449},
65+
}
66+
```
67+
68+
69+
### Call testing
70+
Testing your code to make sure it makes the correct API call is also very important.
71+
72+
The testing.TestCase class has a method call `assert_called_with` which is pretty handy here.
73+
74+
```python
75+
self.assert_called_with(
76+
'SoftLayer_Billing_Item', # Service
77+
'cancelItem', # Method
78+
args=(True, True, ''), # Args
79+
identifier=449, # Id
80+
mask=mock.ANY, # object Mask,
81+
filter=mock.ANY, # object Filter
82+
limit=0, # result Limit
83+
offset=0 # result Offset
84+
)
85+
```
86+
87+
Making sure a API was NOT called
88+
89+
```python
90+
self.assertEqual([], self.calls('SoftLayer_Account', 'getObject'))
91+
```
92+
93+
Making sure an API call has a specific arg, but you don't want to list out the entire API call (like with a place order test)
94+
95+
```python
96+
# Get the API Call signature
97+
order_call = self.calls('SoftLayer_Product_Order', 'placeOrder')
98+
99+
# Get the args property of that API call, which is a tuple, with the first entry being our data.
100+
order_args = getattr(order_call[0], 'args')[0]
101+
102+
# Test our specific argument value
103+
self.assertEqual(123, order_args['hostId'])
104+
```

0 commit comments

Comments
 (0)