diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9b0793507..ff003aad1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7fc2c1ecb..dcede9b96 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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. diff --git a/.secrets.baseline b/.secrets.baseline index c30275090..d236a8ed1 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -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" @@ -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", @@ -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 } @@ -761,7 +762,7 @@ } ] }, - "version": "0.13.1+ibm.61.dss", + "version": "0.13.1+ibm.62.dss", "word_list": { "file": null, "hash": null diff --git a/SoftLayer/managers/vs.py b/SoftLayer/managers/vs.py index df2e99f1f..534ea246e 100644 --- a/SoftLayer/managers/vs.py +++ b/SoftLayer/managers/vs.py @@ -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: @@ -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(