8000 Added detect-secrets workflow by allmightyspiff · Pull Request #2132 · softlayer/softlayer-python · GitHub
[go: up one dir, main page]

Skip to content

Added detect-secrets workflow #2132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7,3.8,3.9,'3.10',3.11]
python-version: [3.8,3.9,'3.10',3.11]

steps:
- uses: actions/checkout@v4
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -45,10 +45,26 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tools/test-requirements.txt
- name: Tox Analysis
run: tox -e analysis
detectsecrets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python/@v4
with:
python-version: 3.11
- name: Install Detect Secrets
run: |
python -m pip install --upgrade pip
pip install --upgrade "git+https://github.com/ibm/detect-secrets.git@master#egg=detect-secrets"
- name: Detect Secrets
run: |
detect-secrets scan --update .secrets.baseline
detect-secrets audit .secrets.baseline --report --fail-on-unaudited --omit-instructions
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
# You are encouraged to use static refs such as tags, instead of branch name
#
# Running "pre-commit autoupdate" automatically updates rev to latest tag
rev: 0.13.1+ibm.61.dss
rev: 0.13.1+ibm.62.dss
hooks:
- id: detect-secrets # pragma: whitelist secret
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.
Expand Down
7 changes: 4 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "^.secrets.baseline$",
"lines": null
},
"generated_at": "2023-10-13T20:28:05Z",
"generated_at": "2024-04-18T01:09:09Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -532,6 +532,7 @@
"tests/CLI/modules/hardware/hardware_basic_tests.py": [
{
"hashed_secret": "6367c48dd193d56ea7b0baad25b19455e529f5ee",
"is_secret": false,
"is_verified": false,
"line_number": 57,
"type": "Secret Keyword",
Expand Down Expand Up @@ -573,7 +574,7 @@
"hashed_secret": "a4c805a62a0387010cd172cfed6f6772eb92a5d6",
"is_secret": false,
"is_verified": false,
"line_number": 33,
"line_number": 32,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -761,7 +762,7 @@
}
]
},
"version": "0.13.1+ibm.61.dss",
"version": "0.13.1+ibm.62.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
24 changes: 8 additions & 16 deletions SoftLayer/managers/vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,25 +1048,20 @@ def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=Tr
vsi_disk = self.get_instance(instance_id)
for item in vsi_disk.get('billingItem').get('children'):
if 'guest_disk' in item.get('categoryCode'):
if disk_number < int("".join(filter(str.isdigit, item.get('categoryCode')))):
disk_number = int("".join(filter(str.isdigit, item.get('categoryCode'))))
disk_number = max(disk_number, int("".join(filter(str.isdigit, item.get('categoryCode')))))
for disk_guest in disk:
if disk_guest.get('number') > 0:
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, 'disk',
disk_guest.get('capacity'),
public)
disk_number = disk_guest.get('number')

else:
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, 'disk',
disk_guest.get('capacity'),
public)
disk_number = disk_number + 1
price_id = self._get_price_id_for_upgrade_option(upgrade_prices,
'disk',
disk_guest.get('capacity'),
public)

if price_id is None:
raise exceptions.SoftLayerAPIError(500,
'Unable to find %s option with value %s' % (
('disk', disk_guest.get('capacity'))))
error = f"Unable to find disk option with value {disk_guest.get('capacity')}"
raise exceptions.SoftLayerAPIError(500, error)

category_id = self.get_disk_category_id_by_disk_number(disk_guest.get('capacity'), disk_number)
if category_id is None:
Expand All @@ -1083,10 +1078,7 @@ def upgrade(self, instance_id, cpus=None, memory=None, nic_speed=None, public=Tr
for option, value in data.items():
if not value:
continue
price_id = self._get_price_id_for_upgrade_option(upgrade_prices,
option,
value,
public)
price_id = self._get_price_id_for_upgrade_option(upgrade_prices, option, value, public)
if not price_id:
# Every option provided is expected to have a price
raise exceptions.SoftLayerError(
Expand Down
0