Skip to content

Commit b0ad23e

Browse files
resolving merge conflict
2 parents 09f86f4 + 4f533c5 commit b0ad23e

File tree

15 files changed

+376
-36
lines changed

15 files changed

+376
-36
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2+
3+
name: Publish 📦 to TestPyPI
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
12+
runs-on: ubuntu-18.04
13+
steps:
14+
- uses: actions/checkout@master
15+
- name: Set up Python 3.7
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.7
19+
- name: Install pypa/build
20+
run: >-
21+
python -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
build
29+
--sdist
30+
--wheel
31+
--outdir dist/
32+
.
33+
- name: Publish 📦 to Test PyPI
34+
uses: pypa/gh-action-pypi-publish@master
35+
with:
36+
password: ${{ secrets.CGALLO_TEST_PYPI }}
37+
repository_url: https://test.pypi.org/legacy/

CONTRIBUTING.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,24 @@ self.assertEqual(123, order_args['hostId'])
116116

117117
### Issues
118118

119-
* ~~Title~~: Should contain quick highlight of the issue is about
120-
* ~~Body~~: All the technical information goes here
121-
* ~~Assignee~~: Should be the person who is actively working on an issue.
122-
* ~~Label~~: All issues should have at least 1 Label.
123-
* ~~Projects~~: Should be added to the quarerly Softlayer project when being worked on
124-
* ~~Milestones~~: Not really used, can be left blank
125-
* ~~Linked Pull Request~~: Should be linked to the relavent pull request when it is opened.
119+
* _Title_: Should contain quick highlight of the issue is about
120+
* _Body_: All the technical information goes here
121+
* _Assignee_: Should be the person who is actively working on an issue.
122+
* _Label_: All issues should have at least 1 Label.
123+
* _Projects_: Should be added to the quarerly Softlayer project when being worked on
124+
* _Milestones_: Not really used, can be left blank
125+
* _Linked Pull Request_: Should be linked to the relavent pull request when it is opened.
126126

127127
### Pull Requests
128128

129-
* ~~Title~~: Should be similar to the title of the issue it is fixing, or otherwise descibe what is chaning in the pull request
130-
* ~~Body~~: Should have "Fixes #1234" at least, with some notes about the specific pull request if needed. Most technical information should still be in the github issue.
131-
* ~~Reviewers~~: 1 Reviewer is required
132-
* ~~Assignee~~: Should be the person who opened the pull request
133-
* ~~Labels~~: Should match the issue
134-
* ~~Projects~~: Should match the issue
135-
* ~~Milestones~~: Not really used, can be left blank
136-
* ~~Linked issues~~: If you put "Fixes #<Issue number>" in the body, this should be automatically filled in, otherwise link manually.
129+
* _Title_: Should be similar to the title of the issue it is fixing, or otherwise descibe what is chaning in the pull request
130+
* _Body_: Should have "Fixes #1234" at least, with some notes about the specific pull request if needed. Most technical information should still be in the github issue.
131+
* _Reviewers_: 1 Reviewer is required
132+
* _Assignee_: Should be the person who opened the pull request
133+
* _Labels_: Should match the issue
134+
* _Projects_: Should match the issue
135+
* _Milestones_: Not really used, can be left blank
136+
* _Linked issues_: If you put "Fixes #<Issue number>" in the body, this should be automatically filled in, otherwise link manually.
137137

138138
### Code Reviews
139139
All issues should be reviewed by at least 1 member of the SLDN team that is not the person opening the pull request. Time permitting, all members of the SLDN team should review the request.

README.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ SoftLayer products and services.
2828

2929
Documentation
3030
-------------
31-
Documentation for the Python client is available at
32-
http://softlayer.github.io/softlayer-python/.
31+
Documentation for the Python client is available at `Read the Docs <https://softlayer-python.readthedocs.io/en/latest/index.html>`_ .
3332

3433
Additional API documentation can be found on the SoftLayer Development Network:
3534

@@ -38,7 +37,7 @@ Additional API documentation can be found on the SoftLayer Development Network:
3837
* `Object mask information and examples
3938
<https://sldn.softlayer.com/article/object-masks>`_
4039
* `Code Examples
41-
<https://softlayer.github.io/python/>`_
40+
<https://sldn.softlayer.com/python/>`_
4241

4342
Installation
4443
------------
@@ -82,7 +81,7 @@ Issues with the Softlayer API itself should be addressed by opening a ticket.
8281
Examples
8382
--------
8483

85-
A curated list of examples on how to use this library can be found at `softlayer.github.io <https://softlayer.github.io/python/>`_
84+
A curated list of examples on how to use this library can be found at `SLDN <https://softlayer.github.io/python/>`_
8685

8786
Debugging
8887
---------

RELEASE.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,74 @@
1-
# Release steps
21

3-
* Update version constants (find them by running `git grep [VERSION_NUMBER]`)
4-
* Create changelog entry (edit CHANGELOG.md with a one-liner for each closed issue going in the release)
5-
* Commit and push changes to master with the message: "Version Bump to v[VERSION_NUMBER]"
6-
* Make sure your `upstream` repo is set
2+
3+
# Versions
4+
5+
This project follows the Major.Minor.Revision versioning system. Fixes, and minor additions would increment Revision. Large changes and additions would increment Minor, and anything that would be a "Breaking" change, or redesign would be an increment of Major.
6+
7+
# Changelog
8+
9+
When doing a release, the Changelog format should be as follows:
10+
11+
```markdown
12+
13+
## [Version] - YYYY-MM-DD
14+
https://github.com/softlayer/softlayer-python/compare/v5.9.0...v5.9.1
15+
16+
#### New Command
17+
- `slcli new command` #issueNumber
18+
19+
#### Improvements
20+
- List out improvements #issueNumber
21+
- Something else that changed #issueNumber
22+
23+
#### Deprecated
24+
- List something that got removed #issueNumber
25+
26+
```
27+
28+
# Normal Release steps
29+
30+
A "release" of the softlayer-python project is the current state of the `master` branch. Any changes in the master branch should be considered releaseable.
31+
32+
33+
1. Create the changelog entry, us this to update `CHANGELOG.md` and as the text for the release on github.
34+
2. Update the version numbers in these files on the master branch.
35+
- `SoftLayer/consts.py`
36+
- `setup.py`
37+
3. Make sure the tests for the build all pass
38+
4. [Draft a new release](https://github.com/softlayer/softlayer-python/releases/new)
39+
- Version should start with `v` followed by Major.Minor.Revision: `vM.m.r`
40+
- Title should be `M.m.r`
41+
- Description should be the release notes
42+
- Target should be the `master` branch
43+
5. The github automation should take care of publishing the release to [PyPi](https://pypi.org/project/SoftLayer/). This may take a few minutes to update.
44+
45+
# Manual Release steps
46+
47+
1. Create the changelog entry, us this to update `CHANGELOG.md` and as the text for the release on github.
48+
2. Update the version numbers in these files on the master branch.
49+
- `SoftLayer/consts.py`
50+
- `setup.py`
51+
3. Commit your changes to `master`, and make sure `softlayer/softlayer-python` repo is updated to reflect that
52+
4. Make sure your `upstream` repo is set
53+
754
```
855
git remote -v
956
upstream git@github.com:softlayer/softlayer-python.git (fetch)
1057
upstream git@github.com:softlayer/softlayer-python.git (push)
1158
```
12-
* Push tag and PyPi `python fabfile.py 5.7.2`. Before you do this, make sure you have the organization repository set up as upstream remote, also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents:
59+
60+
5. Create and publish the package
61+
- Make sure you have `twine` installed, this is what uploads the pacakge to PyPi.
62+
- Before you do this, make sure you have the organization repository set up as upstream remote, also make sure that you have pip set up with your PyPi user credentials. The easiest way to do that is to create a file at `~/.pypirc` with the following contents:
1363

1464
```
1565
[server-login]
1666
username:YOUR_USERNAME
1767
password:YOUR_PASSWORD
1868
```
69+
70+
- Run `python fabfile.py 5.7.2`. Where `5.7.2` is the `M.m.r` version number. Don't use the `v` here in the version number.
71+
72+
73+
*NOTE* PyPi doesn't let you reupload a version, if you upload a bad package for some reason, you have to create a new version.
74+

SoftLayer/CLI/environment.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,23 @@ def input(self, prompt, default=None, show_default=True):
6767

6868
def getpass(self, prompt, default=None):
6969
"""Provide a password prompt."""
70-
return click.prompt(prompt, hide_input=True, default=default)
70+
password = click.prompt(prompt, hide_input=True, default=default)
71+
72+
# https://github.com/softlayer/softlayer-python/issues/1436
73+
# click.prompt uses python's getpass() in the background
74+
# https://github.com/python/cpython/blob/3.9/Lib/getpass.py#L97
75+
# In windows, shift+insert actually inputs the below 2 characters
76+
# If we detect those 2 characters, need to manually read from the clipbaord instead
77+
# https://stackoverflow.com/questions/101128/how-do-i-read-text-from-the-clipboard
78+
if password == 'àR':
79+
# tkinter is a built in python gui, but it has clipboard reading functions.
80+
# pylint: disable=import-outside-toplevel
81+
from tkinter import Tk
82+
tk_manager = Tk()
83+
password = tk_manager.clipboard_get()
84+
# keep the window from showing
85+
tk_manager.withdraw()
86+
return password
7187

7288
# Command loading methods
7389
def list_commands(self, *path):

SoftLayer/CLI/hardware/upgrade.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,40 @@
2424
default=None,
2525
type=click.Choice(['Non-RAID', 'RAID']))
2626
@click.option('--public-bandwidth', type=click.INT, help="Public Bandwidth in GB")
27+
@click.option('--add-disk', nargs=2, multiple=True, type=(int, int),
28+
help="Add a Hard disk in GB to a specific channel, e.g 1000 GB in disk2, it will be "
29+
"--add-disk 1000 2")
30+
@click.option('--resize-disk', nargs=2, multiple=True, type=(int, int),
31+
help="Upgrade a specific disk size in GB, e.g --resize-disk 2000 2")
2732
@click.option('--test', is_flag=True, default=False, help="Do not actually upgrade the hardware server")
2833
@environment.pass_env
29-
def cli(env, identifier, memory, network, drive_controller, public_bandwidth, test):
34+
def cli(env, identifier, memory, network, drive_controller, public_bandwidth, add_disk, resize_disk, test):
3035
"""Upgrade a Hardware Server."""
3136

3237
mgr = SoftLayer.HardwareManager(env.client)
3338

34-
if not any([memory, network, drive_controller, public_bandwidth]):
39+
if not any([memory, network, drive_controller, public_bandwidth, add_disk, resize_disk]):
3540
raise exceptions.ArgumentError("Must provide "
36-
" [--memory], [--network], [--drive-controller], or [--public-bandwidth]")
41+
" [--memory], [--network], [--drive-controller], [--public-bandwidth],"
42+
"[--add-disk] or [--resize-disk]")
3743

3844
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'Hardware')
3945
if not test:
4046
if not (env.skip_confirmations or formatting.confirm(
4147
"This action will incur charges on your account. Continue?")):
4248
raise exceptions.CLIAbort('Aborted')
4349

50+
disk_list = list()
51+
if add_disk:
52+
for guest_disk in add_disk:
53+
disks = {'description': 'add_disk', 'capacity': guest_disk[0], 'number': guest_disk[1]}
54+
disk_list.append(disks)
55+
if resize_disk:
56+
for guest_disk in resize_disk:
57+
disks = {'description': 'resize_disk', 'capacity': guest_disk[0], 'number': guest_disk[1]}
58+
disk_list.append(disks)
59+
4460
if not mgr.upgrade(hw_id, memory=memory, nic_speed=network, drive_controller=drive_controller,
45-
public_bandwidth=public_bandwidth, test=test):
61+
public_bandwidth=public_bandwidth, disk=disk_list, test=test):
4662
raise exceptions.CLIAbort('Hardware Server Upgrade Failed')
4763
env.fout('Successfully Upgraded.')

SoftLayer/CLI/virt/detail.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ def cli(env, identifier, passwords=False, price=False):
6969
table.add_row(['transient', result.get('transientGuestFlag', False)])
7070
table.add_row(['created', result['createDate']])
7171
table.add_row(['modified', result['modifyDate']])
72+
last_transaction = "{} ({})".format(utils.lookup(result, 'lastTransaction', 'transactionGroup', 'name'),
73+
utils.clean_time(utils.lookup(result, 'lastTransaction', 'modifyDate')))
74+
75+
table.add_row(['last_transaction', last_transaction])
76+
table.add_row(['billing', 'Hourly' if result['hourlyBillingFlag'] else'Monthly'])
7277
table.add_row(['preset', utils.lookup(result, 'billingItem',
7378
'orderItem',
7479
'preset',

SoftLayer/fixtures/SoftLayer_Hardware_Server.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
'children': [
1414
{'description': 'test', 'nextInvoiceTotalRecurringAmount': 1},
1515
],
16+
'nextInvoiceChildren': [
17+
{'description': 'test', 'nextInvoiceTotalRecurringAmount': 1, 'categoryCode': 'disk1'},
18+
{'description': 'test2', 'nextInvoiceTotalRecurringAmount': 2, 'categoryCode': 'disk3'}
19+
],
1620
'orderItem': {
1721
'order': {
1822
'userRecord': {
@@ -336,5 +340,40 @@
336340
"id": 6177,
337341
"keyName": "BANDWIDTH_500_GB"
338342
}
343+
},
344+
{
345+
"hourlyRecurringFee": ".023",
346+
"id": 49759,
347+
"recurringFee": "15",
348+
"categories": [
349+
{
350+
"categoryCode": "disk2",
351+
"id": 6,
352+
"name": "Third Hard Drive"
353+
}
354+
],
355+
"item": {
356+
"capacity": "1000",
357+
"description": "1.00 TB SATA",
358+
"id": 6159,
359+
"keyName": "HARD_DRIVE_1_00_TB_SATA_2",
360+
}
361+
},
362+
{
363+
"id": 49759,
364+
"recurringFee": "0",
365+
"categories": [
366+
{
367+
"categoryCode": "disk1",
368+
"id": 5,
369+
"name": "Second Hard Drive"
370+
}
371+
],
372+
"item": {
373+
"capacity": "1000",
374+
"description": "1.00 TB SATA",
375+
"id": 6159,
376+
"keyName": "HARD_DRIVE_1_00_TB_SATA_2"
377+
}
339378
}
340379
]

0 commit comments

Comments
 (0)