Skip to content

Commit fefb704

Browse files
merged in master
2 parents de9319e + f796629 commit fefb704

File tree

21 files changed

+217
-124
lines changed

21 files changed

+217
-124
lines changed

.github/workflows/tests.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: ${{ matrix.python-version }}
2121
- name: Install dependencies
@@ -29,7 +29,7 @@ jobs:
2929
steps:
3030
- uses: actions/checkout@v4
3131
- name: Set up Python
32-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
3333
with:
3434
python-version: 3.12
3535
- name: Install dependencies
@@ -43,7 +43,7 @@ jobs:
4343
steps:
4444
- uses: actions/checkout@v4
4545
- name: Set up Python
46-
uses: actions/setup-python@v4
46+
uses: actions/setup-python@v5
4747
with:
4848
python-version: 3.12
4949
- name: Install dependencies
@@ -52,3 +52,19 @@ jobs:
5252
pip install -r tools/test-requirements.txt
5353
- name: Tox Analysis
5454
run: tox -e analysis
55+
detectsecrets:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Set up Python
60+
uses: actions/setup-python/@v5
61+
with:
62+
python-version: 3.11
63+
- name: Install Detect Secrets
64+
run: |
65+
python -m pip install --upgrade pip
66+
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
67+
- name: Detect Secrets
68+
run: |
69+
detect-secrets scan --update .secrets.baseline
70+
detect-secrets audit .secrets.baseline --report --fail-on-unaudited --omit-instructions

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
# You are encouraged to use static refs such as tags, instead of branch name
1111
#
1212
# Running "pre-commit autoupdate" automatically updates rev to latest tag
13-
rev: 0.13.1+ibm.61.dss
13+
rev: 0.13.1+ibm.62.dss
1414
hooks:
1515
- id: detect-secrets # pragma: whitelist secret
1616
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.

.secrets.baseline

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2023-10-13T20:28:05Z",
6+
"generated_at": "2024-04-18T01:09:09Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -532,6 +532,7 @@
532532
"tests/CLI/modules/hardware/hardware_basic_tests.py": [
533533
{
534534
"hashed_secret": "6367c48dd193d56ea7b0baad25b19455e529f5ee",
535+
"is_secret": false,
535536
"is_verified": false,
536537
"line_number": 57,
537538
"type": "Secret Keyword",
@@ -573,7 +574,7 @@
573574
"hashed_secret": "a4c805a62a0387010cd172cfed6f6772eb92a5d6",
574575
"is_secret": false,
575576
"is_verified": false,
576-
"line_number": 33,
577+
"line_number": 32,
577578
"type": "Secret Keyword",
578579
"verified_result": null
579580
}
@@ -761,7 +762,7 @@
761762
}
762763
]
763764
},
764-
"version": "0.13.1+ibm.61.dss",
765+
"version": "0.13.1+ibm.62.dss",
765766
"word_list": {
766767
"file": null,
767768
"hash": null

README.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,12 @@ SoftLayer API Python Client
22
===========================
33
.. image:: https://github.com/softlayer/softlayer-python/workflows/Tests/badge.svg
44
:target: https://github.com/softlayer/softlayer-python/actions?query=workflow%3ATests
5-
65
.. image:: https://github.com/softlayer/softlayer-python/workflows/documentation/badge.svg
76
:target: https://github.com/softlayer/softlayer-python/actions?query=workflow%3Adocumentation
8-
9-
.. image:: https://landscape.io/github/softlayer/softlayer-python/master/landscape.svg
10-
:target: https://landscape.io/github/softlayer/softlayer-python/master
11-
127
.. image:: https://badge.fury.io/py/SoftLayer.svg
138
:target: http://badge.fury.io/py/SoftLayer
14-
159
.. image:: https://coveralls.io/repos/github/softlayer/softlayer-python/badge.svg?branch=master
1610
:target: https://coveralls.io/github/softlayer/softlayer-python?branch=master
17-
1811
.. image:: https://snapcraft.io//slcli/badge.svg
1912
:target: https://snapcraft.io/slcli
2013

SoftLayer/CLI/block/limit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def cli(env, sortby, datacenter):
2323
Example::
2424
slcli block volume-limits
2525
This command lists the storage limits per datacenter for this account.
26-
"""
26+
"""
2727

2828
block_manager = SoftLayer.BlockStorageManager(env.client)
2929
block_volumes = block_manager.list_block_volume_limit()

SoftLayer/CLI/block/modify.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,21 @@
2020
@click.option('--new-iops', '-i',
2121
type=int,
2222
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.]')
23+
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***')
2724
@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.]',
25+
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] Classic Choices: '
26+
'***If no tier is specified, the original tier of the volume will be used.***',
3327
type=click.Choice(['0.25', '2', '4', '10']))
3428
@environment.pass_env
3529
def cli(env, volume_id, new_size, new_iops, new_tier):
36-
"""Modify an existing block storage volume.
30+
"""Modify an existing block storage volume. Choices.
31+
32+
Valid size and iops options can be found here:
33+
https://cloud.ibm.com/docs/BlockStorage/index.html#provisioning-considerations
34+
https://cloud.ibm.com/docs/BlockStorage?topic=BlockStorage-orderingBlockStorage&interface=cli
3735
3836
Example::
37+
3938
slcli block volume-modify 12345678 --new-size 1000 --new-iops 4000
4039
This command modify a volume 12345678 with size is 1000GB, IOPS is 4000.
4140

SoftLayer/CLI/command.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class OptionHighlighter(RegexHighlighter):
2828
r"(?P<option>\-\-[\w\-]+)", # long options like --verbose
2929
r"(?P<default_option>\[[^\]]+\])", # anything between [], usually default options
3030
r"(?P<option_choices>Choices: )",
31+
r"(?P<example_block>Example::)",
32+
r"(?P<url>(file|https|http|ws|wss)://[-0-9a-zA-Z$_+!`(),.?/;:&=%#~]*)"
3133
r"(?P<args_keyword>^[A-Z]+$)",
3234
]
3335

@@ -91,7 +93,7 @@ def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpF
9193

9294
if text:
9395
text = inspect.cleandoc(text).partition("\f")[0]
94-
self.console.print(f"\n\t{text}\n")
96+
self.console.print(f"\n\t{text}\n", highlight=True)
9597

9698
def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
9799
"""Writes the epilog if it exists, then prints out any sub-commands if they exist."""
@@ -191,9 +193,10 @@ def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpF
191193
text = f"(Deprecated) {text}"
192194

193195
if text:
194-
text = inspect.cleandoc(text)
196+
text = f"\n\t{inspect.cleandoc(text)}\n"
195197

196-
self.console.print(f"\n\t{text}\n", highlight=False)
198+
# Can't use F-string here because it messes with highlights
199+
self.console.print(self.highlighter(text))
197200

198201
def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
199202
"""Writes the epilog if it exists, then prints out any sub-commands if they exist."""

SoftLayer/CLI/file/modify.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@
2121
@click.option('--new-iops', '-i',
2222
type=int,
2323
help='Performance Storage IOPS, between 100 and 6000 in multiples of 100 [only for performance volumes] '
24-
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***\n'
25-
'Requirements: [If original IOPS/GB for the volume is less than 0.3, new IOPS/GB must also be '
26-
'less than 0.3. If original IOPS/GB for the volume is greater than or equal to 0.3, new IOPS/GB '
27-
'for the volume must also be greater than or equal to 0.3.]')
24+
'***If no IOPS value is specified, the original IOPS value of the volume will be used.***')
2825
@click.option('--new-tier', '-t',
2926
help='Endurance Storage Tier (IOPS per GB) [only for endurance volumes] '
30-
'***If no tier is specified, the original tier of the volume will be used.***\n'
31-
'Requirements: [If original IOPS/GB for the volume is 0.25, new IOPS/GB for the volume must also '
32-
'be 0.25. If original IOPS/GB for the volume is greater than 0.25, new IOPS/GB for the volume '
33-
'must also be greater than 0.25.]',
27+
'***If no tier is specified, the original tier of the volume will be used.***',
3428
type=click.Choice(['0.25', '2', '4', '10']))
3529
@click.option('--force', default=False, is_flag=True, help="Force modify")
3630
@environment.pass_env
3731
def cli(env, volume_id, new_size, new_iops, new_tier, force):
3832
"""Modify an existing file storage volume.
3933
34+
Valid size and iops options can be found here:
35+
https://cloud.ibm.com/docs/FileStorage/index.html#provisioning-considerations
36+
https://cloud.ibm.com/docs/FileStorage?topic=FileStorage-orderingFileStorage&interface=cli
37+
4038
Example::
39+
4140
slcli file volume-modify 12345678 --new-size 1000 --new-iops 400
4241
"""
4342
if not force:

SoftLayer/CLI/formatting.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ def no_going_back(confirmation):
259259
if not confirmation:
260260
confirmation = 'yes'
261261

262-
prompt = ('This action cannot be undone! Type "%s" or press Enter '
263-
'to abort' % confirmation)
262+
prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort"
264263

265264
ans = click.prompt(prompt, default='', show_default=False)
266265
if ans.lower() == str(confirmation):

SoftLayer/CLI/hardware/update_firmware.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@
1212

1313
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
1414
@click.argument('identifier')
15+
@click.option('-i', '--ipmi', is_flag=True, help="Update IPMI firmware")
16+
@click.option('-r', '--raid', is_flag=True, help="Update RAID firmware")
17+
@click.option('-b', '--bios', is_flag=True, help="Update BIOS firmware")
18+
@click.option('-d', '--harddrive', is_flag=True, help="Update Hard Drives firmware")
19+
@click.option('-n', '--network', is_flag=True, help="Update Network Card firmware")
1520
@environment.pass_env
16-
def cli(env, identifier):
17-
"""Update server firmware."""
21+
def cli(env, identifier, ipmi, raid, bios, harddrive, network):
22+
"""Update server firmware. By default will update all available server components."""
1823

1924
mgr = SoftLayer.HardwareManager(env.client)
2025
hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
21-
if not (env.skip_confirmations or
22-
formatting.confirm('This will power off the server with id %s and '
23-
'update device firmware. Continue?' % hw_id)):
26+
confirm_message = f"This will power off the server with id {hw_id} and update device firmware. Continue?"
27+
if not (env.skip_confirmations or formatting.confirm(confirm_message)):
2428
raise exceptions.CLIAbort('Aborted.')
2529

26-
mgr.update_firmware(hw_id)
30+
# If no options were specified, set them all to enabled.
31+
if not any([ipmi, raid, bios, harddrive, network]):
32+
ipmi = raid = bios = harddrive = network = 1
33+
mgr.update_firmware(hw_id, ipmi, raid, bios, harddrive, network)
34+
env.fout(f"[green]Firmware update for {identifier} started")

0 commit comments

Comments
 (0)