Skip to content

Commit fc2dcee

Browse files
Merge pull request #2132 from allmightyspiff/issues2131
Added detect-secrets workflow
2 parents 4875065 + 1491658 commit fc2dcee

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

.github/workflows/tests.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
python-version: [3.7,3.8,3.9,'3.10',3.11]
13+
python-version: [3.8,3.9,'3.10',3.11]
1414

1515
steps:
1616
- uses: actions/checkout@v4
@@ -31,7 +31,7 @@ jobs:
3131
- name: Set up Python
3232
uses: actions/setup-python@v4
3333
with:
34-
python-version: 3.9
34+
python-version: 3.11
3535
- name: Install dependencies
3636
run: |
3737
python -m pip install --upgrade pip
@@ -45,10 +45,26 @@ jobs:
4545
- name: Set up Python
4646
uses: actions/setup-python@v4
4747
with:
48-
python-version: 3.9
48+
python-version: 3.11
4949
- name: Install dependencies
5050
run: |
5151
python -m pip install --upgrade pip
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/@v4
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

SoftLayer/managers/vs.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,25 +1048,20 @@ def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=Tr
10481048
vsi_disk = self.get_instance(instance_id)
10491049
for item in vsi_disk.get('billingItem').get('children'):
10501050
if 'guest_disk' in item.get('categoryCode'):
1051-
if disk_number < int("".join(filter(str.isdigit, item.get('categoryCode')))):
1052-
disk_number = int("".join(filter(str.isdigit, item.get('categoryCode'))))
1051+
disk_number = max(disk_number, int("".join(filter(str.isdigit, item.get('categoryCode')))))
10531052
for disk_guest in disk:
10541053
if disk_guest.get('number') > 0:
1055-
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, 'disk',
1056-
disk_guest.get('capacity'),
1057-
public)
10581054
disk_number = disk_guest.get('number')
1059-
10601055
else:
1061-
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, 'disk',
1062-
disk_guest.get('capacity'),
1063-
public)
10641056
disk_number = disk_number + 1
1057+
price_id = self._get_price_id_for_upgrade_option(upgrade_prices,
1058+
'disk',
1059+
disk_guest.get('capacity'),
1060+
public)
10651061

10661062
if price_id is None:
1067-
raise exceptions.SoftLayerAPIError(500,
1068-
'Unable to find %s option with value %s' % (
1069-
('disk', disk_guest.get('capacity'))))
1063+
error = f"Unable to find disk option with value {disk_guest.get('capacity')}"
1064+
raise exceptions.SoftLayerAPIError(500, error)
10701065

10711066
category_id = self.get_disk_category_id_by_disk_number(disk_guest.get('capacity'), disk_number)
10721067
if category_id is None:
@@ -1083,10 +1078,7 @@ def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=Tr
10831078
for option, value in data.items():
10841079
if not value:
10851080
continue
1086-
price_id = self._get_price_id_for_upgrade_option(upgrade_prices,
1087-
option,
1088-
value,
1089-
public)
1081+
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, option, value, public)
10901082
if not price_id:
10911083
# Every option provided is expected to have a price
10921084
raise exceptions.SoftLayerError(

0 commit comments

Comments
 (0)