Skip to content

Commit b691f21

Browse files
committed
Merge with master
2 parents dad7ce4 + ca21eec commit b691f21

Some content is hidden

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

49 files changed

+463
-221
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
1-
name: Release Snapcraft and PyPi
1+
name: Release to PyPi
22

33
on:
44
release:
55
types: [published]
66

77
jobs:
8-
snap-release:
9-
runs-on: ubuntu-18.04
10-
strategy:
11-
matrix:
12-
arch: ['armhf','amd64','arm64','ppc64el','s390x']
13-
steps:
14-
- name: Install Snapcraft
15-
uses: samuelmeuli/action-snapcraft@v1.2.0
16-
with:
17-
snapcraft_token: ${{ secrets.snapcraft_token }}
18-
- name: Push to stable
19-
run: |
20-
VERSION=`snapcraft list-revisions slcli --arch ${{ matrix.arch }} | grep "edge\*" | awk '{print $1}'`
21-
echo Publishing $VERSION on ${{ matrix.arch }}
22-
snapcraft release slcli $VERSION stable
238
build-n-publish:
249
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2510
runs-on: ubuntu-latest

SoftLayer/API.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def __init__(self, auth=None, transport=None, config_file=None):
177177
endpoint_url=url,
178178
proxy=self.settings['softlayer'].get('proxy'),
179179
# prevents an exception incase timeout is a float number.
180-
timeout=int(self.settings['softlayer'].getfloat('timeout')),
180+
timeout=int(self.settings['softlayer'].getfloat('timeout', 0)),
181181
user_agent=consts.USER_AGENT,
182182
verify=self.settings['softlayer'].getboolean('verify'),
183183
)
@@ -186,7 +186,7 @@ def __init__(self, auth=None, transport=None, config_file=None):
186186
transport = transports.XmlRpcTransport(
187187
endpoint_url=url,
188188
proxy=self.settings['softlayer'].get('proxy'),
189-
timeout=int(self.settings['softlayer'].getfloat('timeout')),
189+
timeout=int(self.settings['softlayer'].getfloat('timeout', 0)),
190190
user_agent=consts.USER_AGENT,
191191
verify=self.settings['softlayer'].getboolean('verify'),
192192
)

SoftLayer/CLI/account/hooks.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Show all Provisioning Scripts."""
2+
# :license: MIT, see LICENSE for more details.
3+
import click
4+
5+
6+
from SoftLayer.CLI.command import SLCommand as SLCommand
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import formatting
9+
from SoftLayer.managers import account
10+
11+
12+
@click.command(cls=SLCommand)
13+
@environment.pass_env
14+
def cli(env):
15+
"""Show all Provisioning Scripts."""
16+
17+
manager = account.AccountManager(env.client)
18+
hooks = manager.get_provisioning_scripts()
19+
20+
table = formatting.Table(["Id", "Name", "Uri"])
21+
22+
for hook in hooks:
23+
table.add_row([hook.get('id'), hook.get('name'), hook.get('uri')])
24+
25+
env.fout(table)

SoftLayer/CLI/block/options.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def cli(env, prices, location=None):
2222
"""List all options for ordering a block storage"""
2323

2424
order_manager = SoftLayer.OrderingManager(env.client)
25-
items = order_manager.get_items(PACKAGE_STORAGE)
25+
items = order_manager.get_items(PACKAGE_STORAGE, mask="mask[categories]")
2626
datacenters = order_manager.get_regions(PACKAGE_STORAGE, location)
2727

2828
tables = []
@@ -67,7 +67,7 @@ def _block_ios_get_table(items, prices):
6767
if block_item['itemCategory']['categoryCode'] == 'storage_tier_level':
6868
table.add_row([block_item.get('id'), block_item.get('description'),
6969
block_item.get('keyName')])
70-
table.sortby = 'Id'
70+
table.sortby = 'KeyName'
7171
table.align = 'l'
7272
return table
7373

@@ -86,7 +86,7 @@ def _block_storage_table(items, prices):
8686
if block_item['itemCategory']['categoryCode'] == 'performance_storage_space':
8787
table.add_row([block_item.get('id'), block_item.get('description'),
8888
block_item.get('keyName'), block_item.get('capacityMinimum') or '-', ])
89-
table.sortby = 'Id'
89+
table.sortby = 'KeyName'
9090
table.align = 'l'
9191
return table
9292

@@ -101,9 +101,16 @@ def _block_snapshot_get_table(items, prices):
101101
else:
102102
table = formatting.Table(['Id', 'Description', 'KeyName'], title='Snapshot')
103103
for block_item in items:
104-
if block_item['itemCategory']['categoryCode'] == 'storage_snapshot_space':
105-
table.add_row([block_item.get('id'), block_item.get('description'),
106-
block_item.get('keyName')])
107-
table.sortby = 'Id'
104+
if is_snapshot_category(block_item.get('categories', [])):
105+
table.add_row([block_item.get('id'), block_item.get('description'), block_item.get('keyName')])
106+
table.sortby = 'KeyName'
108107
table.align = 'l'
109108
return table
109+
110+
111+
def is_snapshot_category(categories):
112+
"""Checks if storage_snapshot_space is one of the categories"""
113+
for item in categories:
114+
if item.get('categoryCode') == "storage_snapshot_space":
115+
return True
116+
return False

SoftLayer/CLI/block/snapshot/cancel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1313
@click.argument('volume-id')
14-
@click.option('--reason', help="An optional reason for cancellation")
14+
@click.option('--reason', help="An optional reason for cancellation.")
1515
@click.option('--immediate',
1616
is_flag=True,
1717
help="Cancels the snapshot space immediately instead "
18-
"of on the billing anniversary")
18+
"of on the billing anniversary.")
1919
@environment.pass_env
2020
def cli(env, volume_id, reason, immediate):
2121
"""Cancel existing snapshot space for a given volume."""

SoftLayer/CLI/block/snapshot/create.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1010
@click.argument('volume_id')
1111
@click.option('--notes', '-n',
12-
help='Notes to set on the new snapshot')
12+
help='Notes to set on the new snapshot.')
1313
@environment.pass_env
1414
def cli(env, volume_id, notes):
15-
"""Creates a snapshot on a given volume"""
15+
"""Creates a snapshot on a given volume."""
1616
block_manager = SoftLayer.BlockStorageManager(env.client)
1717
snapshot = block_manager.create_snapshot(volume_id, notes=notes)
1818

SoftLayer/CLI/block/snapshot/delete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@click.argument('snapshot_id')
1111
@environment.pass_env
1212
def cli(env, snapshot_id):
13-
"""Deletes a snapshot on a given volume"""
13+
"""Deletes a snapshot on a given volume."""
1414
block_manager = SoftLayer.BlockStorageManager(env.client)
1515
deleted = block_manager.delete_snapshot(snapshot_id)
1616

SoftLayer/CLI/block/snapshot/disable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1111
@click.argument('volume_id')
1212
@click.option('--schedule-type',
13-
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
13+
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
1414
required=True)
1515
@environment.pass_env
1616
def cli(env, volume_id, schedule_type):
17-
"""Disables snapshots on the specified schedule for a given volume"""
17+
"""Disables snapshots on the specified schedule for a given volume."""
1818

1919
if (schedule_type not in ['INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY']):
2020
raise exceptions.CLIAbort(

SoftLayer/CLI/block/snapshot/enable.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1111
@click.argument('volume_id')
1212
@click.option('--schedule-type',
13-
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY]',
13+
help='Snapshot schedule [INTERVAL|HOURLY|DAILY|WEEKLY].',
1414
required=True)
1515
@click.option('--retention-count',
16-
help='Number of snapshots to retain',
16+
help='Number of snapshots to retain.',
1717
required=True)
1818
@click.option('--minute',
19-
help='Minute of the day when snapshots should be taken',
19+
help='Minute of the day when snapshots should be taken.',
2020
default=0)
2121
@click.option('--hour',
22-
help='Hour of the day when snapshots should be taken',
22+
help='Hour of the day when snapshots should be taken.',
2323
default=0)
2424
@click.option('--day-of-week',
25-
help='Day of the week when snapshots should be taken',
25+
help='Day of the week when snapshots should be taken.',
2626
default='SUNDAY')
2727
@environment.pass_env
2828
def cli(env, volume_id, schedule_type, retention_count,
2929
minute, hour, day_of_week):
30-
"""Enables snapshots for a given volume on the specified schedule"""
30+
"""Enables snapshots for a given volume on the specified schedule."""
3131
block_manager = SoftLayer.BlockStorageManager(env.client)
3232

3333
valid_schedule_types = {'INTERVAL', 'HOURLY', 'DAILY', 'WEEKLY'}

SoftLayer/CLI/block/snapshot/get_notify_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
@click.argument('volume_id')
1111
@environment.pass_env
1212
def cli(env, volume_id):
13-
"""Get snapshots space usage threshold warning flag setting for a given volume"""
13+
"""Get snapshots space usage threshold warning flag setting for a given volume."""
1414
block_manager = SoftLayer.BlockStorageManager(env.client)
1515
enabled = block_manager.get_volume_snapshot_notification_status(volume_id)
1616

0 commit comments

Comments
 (0)