Skip to content
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
6 changes: 5 additions & 1 deletion .github/workflows/install_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
- name: Install poetry
run: |
python -m pip install poetry
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/install_test_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand All @@ -22,6 +22,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
- name: Install poetry
run: |
python -m pip install poetry
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/install_test_setup_py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Update PIP and install crypto package
run: python -m pip install -U pip && pip install cryptography
- name: Update PIP and install crypto and setuptools
run: python -m pip install -U pip && pip install cryptography && pip install setuptools
- name: Install poetry
run: |
python -m pip install poetry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pylint_and_mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.12
- name: Install poetry
run: |
python -m pip install poetry
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8 🐍🐍🐍
- name: Set up Python 3.12 🐍🐍🐍
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.12
- name: Install poetry
run: |
python -m pip install poetry
Expand Down
18 changes: 14 additions & 4 deletions libcloudforensics/providers/gcp/internal/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -1382,10 +1382,16 @@ def GetBootDisk(self) -> 'GoogleComputeDisk':

Raises:
ResourceNotFoundError: If no boot disk could be found.
InvalidNameError: If the boot disk Source could not be found.
"""

for disk in self.GetValue('disks'):
if disk['boot']:
if 'source' not in disk:
raise errors.InvalidNameError(
'Boot disk has no source attribute: {0:s}'.format(
self.name),
__name__)
disk_name = disk['source'].split('/')[-1]
return GoogleCloudCompute(self.project_id).GetDisk(disk_name=disk_name)
raise errors.ResourceNotFoundError(
Expand All @@ -1406,7 +1412,7 @@ def GetDisk(self, disk_name: str) -> 'GoogleComputeDisk':
"""

for disk in self.GetValue('disks'):
if disk['source'].split('/')[-1] == disk_name:
if disk.get('source', '').split('/')[-1] == disk_name:
return GoogleCloudCompute(self.project_id).GetDisk(disk_name=disk_name)
raise errors.ResourceNotFoundError(
'Disk {0:s} was not found in instance {1:s}'.format(
Expand All @@ -1423,7 +1429,9 @@ def ListDisks(self) -> Dict[str, 'GoogleComputeDisk']:

disks = {}
disk_names = [
disk['source'].split('/')[-1] for disk in self.GetValue('disks')
disk['source'].split('/')[-1]
for disk in self.GetValue('disks')
if disk.get('source', None)
]
for name in disk_names:
disks[name] = self.GetDisk(name)
Expand Down Expand Up @@ -1507,7 +1515,7 @@ def DetachDisk(self, disk: 'GoogleComputeDisk') -> None:
gce_instance_client = self.GceApi().instances() # pylint: disable=no-member
device_name = None
for disk_dict in self.GetValue('disks'):
if disk_dict['source'].split('/')[-1] == disk.name:
if disk_dict.get('source', '').split('/')[-1] == disk.name:
device_name = disk_dict['deviceName']
request = gce_instance_client.detachDisk(
instance=self.name,
Expand Down Expand Up @@ -1541,7 +1549,9 @@ def Delete(
disks_to_delete = []
if delete_disks:
disks_to_delete = [
disk['source'].split('/')[-1] for disk in self.GetValue('disks')
disk['source'].split('/')[-1]
for disk in self.GetValue('disks')
if disk.get('source', None)
]

gce_instance_client = self.GceApi().instances() # pylint: disable=no-member
Expand Down
Loading
Loading