Skip to content

Commit cb508db

Browse files
author
Fernando
committed
Merge branch 'master' of https://github.com/softlayer/softlayer-python into ft/cdn_edit_option
2 parents c8033c5 + 6861d23 commit cb508db

Some content is hidden

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

44 files changed

+834
-73
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release Snapcraft and PyPi (Testing)
22

33
on:
44
release:
@@ -20,4 +20,32 @@ jobs:
2020
VERSION=`snapcraft list-revisions slcli --arch ${{ matrix.arch }} | grep "edge\*" | awk '{print $1}'`
2121
echo Publishing $VERSION on ${{ matrix.arch }}
2222
snapcraft release slcli $VERSION stable
23+
build-n-publish:
24+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@master
28+
- name: Set up Python 3.8
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: 3.8
32+
- name: Install pypa/build
33+
run: >-
34+
python -m
35+
pip install
36+
build
37+
--user
38+
- name: Build a binary wheel and a source tarball
39+
run: >-
40+
python -m
41+
build
42+
--sdist
43+
--wheel
44+
--outdir dist/
45+
.
46+
- name: Publish 📦 to Test PyPI
47+
uses: pypa/gh-action-pypi-publish@master
48+
with:
49+
password: ${{ secrets.CGALLO_TEST_PYPI }}
50+
repository_url: https://test.pypi.org/legacy/
2351

.github/workflows/test_pypi_release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ name: Publish 📦 to TestPyPI
44

55
on:
66
push:
7-
branches: [ test-pypi ]
7+
branches: [test-pypi ]
88

99
jobs:
1010
build-n-publish:
1111
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
12-
runs-on: ubuntu-18.04
12+
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@master
15-
- name: Set up Python 3.7
16-
uses: actions/setup-python@v1
15+
- name: Set up Python 3.8
16+
uses: actions/setup-python@v2
1717
with:
18-
python-version: 3.7
18+
python-version: 3.8
1919
- name: Install pypa/build
2020
run: >-
2121
python -m

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Change Log
22

3+
## [5.9.6] - 2021-07-05
4+
https://github.com/softlayer/softlayer-python/compare/v5.9.5...v5.9.6
5+
6+
#### Improvements
7+
- Updated snap to core20 and edited README #1494
8+
- Add a table result for `slcli hw upgrade` output. #1488
9+
- Remove block/file interval option for replica volume. #1497
10+
- `slcli vlan cancel` should report if a vlan is automatic. #1495
11+
- New method to manage how long text is in output tables. #1506
12+
- Fix Tox-analysis issues. #1510
13+
14+
#### New Commands
15+
- add new email feature #1483
16+
+ `slcli email list`
17+
+ `slcli email detail`
18+
+ `slcli email edit`
19+
- `slcli vlan cancel`
20+
- Add slcli account licenses #1501
21+
+ `slcli account licenses`
22+
- Create a new commands on slcli that create/cancel a VMware licenses #1504
23+
+ `slcli licenses create`
24+
+ `slcli licenses cancel`
25+
326

427
## [5.9.5] - 2021-05-25
528
https://github.com/softlayer/softlayer-python/compare/v5.9.4...v5.9.5

SoftLayer/API.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
'BaseClient',
3232
'API_PUBLIC_ENDPOINT',
3333
'API_PRIVATE_ENDPOINT',
34+
'IAMClient',
3435
]
3536

3637
VALID_CALL_ARGS = set((

SoftLayer/CLI/account/licenses.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Show all licenses."""
2+
# :license: MIT, see LICENSE for more details.
3+
import click
4+
5+
from SoftLayer import utils
6+
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import formatting
9+
from SoftLayer.managers import account
10+
11+
12+
@click.command()
13+
@environment.pass_env
14+
def cli(env):
15+
"""Show all licenses."""
16+
17+
manager = account.AccountManager(env.client)
18+
19+
control_panel = manager.get_active_virtual_licenses()
20+
vmwares = manager.get_active_account_licenses()
21+
22+
table_panel = formatting.KeyValueTable(['id', 'ip_address', 'manufacturer', 'software',
23+
'key', 'subnet', 'subnet notes'], title="Control Panel Licenses")
24+
25+
table_vmware = formatting.KeyValueTable(['name', 'license_key', 'cpus', 'description',
26+
'manufacturer', 'requiredUser'], title="VMware Licenses")
27+
for panel in control_panel:
28+
table_panel.add_row([panel.get('id'), panel.get('ipAddress'),
29+
utils.lookup(panel, 'softwareDescription', 'manufacturer'),
30+
utils.trim_to(utils.lookup(panel, 'softwareDescription', 'longDescription'), 40),
31+
panel.get('key'), utils.lookup(panel, 'subnet', 'broadcastAddress'),
32+
utils.lookup(panel, 'subnet', 'note')])
33+
34+
env.fout(table_panel)
35+
for vmware in vmwares:
36+
table_vmware.add_row([utils.lookup(vmware, 'softwareDescription', 'name'),
37+
vmware.get('key'), vmware.get('capacity'),
38+
utils.lookup(vmware, 'billingItem', 'description'),
39+
utils.lookup(vmware, 'softwareDescription', 'manufacturer'),
40+
utils.lookup(vmware, 'softwareDescription', 'requiredUser')])
41+
42+
env.fout(table_vmware)

SoftLayer/CLI/block/count.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ def cli(env, sortby, datacenter):
3737

3838
table = formatting.KeyValueTable(DEFAULT_COLUMNS)
3939
table.sortby = sortby
40-
for datacenter_name in datacenters:
41-
table.add_row([datacenter_name, datacenters[datacenter_name]])
40+
for key, value in datacenters.items():
41+
table.add_row([key, value])
4242
env.fout(table)

SoftLayer/CLI/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ def list_commands(self, ctx):
5454

5555
return sorted(env.list_commands(*self.path))
5656

57-
def get_command(self, ctx, name):
57+
def get_command(self, ctx, cmd_name):
5858
"""Get command for click."""
5959
env = ctx.ensure_object(environment.Environment)
6060
env.load()
6161

6262
# Do alias lookup (only available for root commands)
6363
if len(self.path) == 0:
64-
name = env.resolve_alias(name)
64+
cmd_name = env.resolve_alias(cmd_name)
6565

6666
new_path = list(self.path)
67-
new_path.append(name)
67+
new_path.append(cmd_name)
6868
module = env.get_command(*new_path)
6969
if isinstance(module, types.ModuleType):
7070
return CommandLoader(*new_path, help=module.__doc__ or '')

SoftLayer/CLI/file/count.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ def cli(env, sortby, datacenter):
3636

3737
table = formatting.KeyValueTable(DEFAULT_COLUMNS)
3838
table.sortby = sortby
39-
for datacenter_name in datacenters:
40-
table.add_row([datacenter_name, datacenters[datacenter_name]])
39+
for key, value in datacenters.items():
40+
table.add_row([key, value])
4141
env.fout(table)

SoftLayer/CLI/formatting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,11 @@ def __str__(self):
248248
class CLIJSONEncoder(json.JSONEncoder):
249249
"""A JSON encoder which is able to use a .to_python() method on objects."""
250250

251-
def default(self, obj):
251+
def default(self, o):
252252
"""Encode object if it implements to_python()."""
253-
if hasattr(obj, 'to_python'):
254-
return obj.to_python()
255-
return super().default(obj)
253+
if hasattr(o, 'to_python'):
254+
return o.to_python()
255+
return super().default(o)
256256

257257

258258
class Table(object):

SoftLayer/CLI/licenses/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)