Skip to content

Various fixes identified using an LLM#169

Merged
ogayot merged 8 commits into
canonical:mainfrom
ogayot:various-fixes
Jun 1, 2026
Merged

Various fixes identified using an LLM#169
ogayot merged 8 commits into
canonical:mainfrom
ogayot:various-fixes

Conversation

@ogayot

@ogayot ogayot commented May 28, 2026

Copy link
Copy Markdown
Member

This PR fixes:

  • two issues related to exception / error formatting.
  • an except block trying to capture an undefined exception type (which is defined in curtin.util, not in probert, nor in subprocess)
  • a file potentially staying open until garbage collection happens
  • a misspelled property name in the JSON schema
  • typos in user facing messages

Some tests added, covering the fixes.

ogayot added 5 commits May 27, 2026 21:51
The log.error() call was passing the exception as a second positional
argument without a %s placeholder, so it was silently discarded.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
subprocess.ProcessExecutionError does not exist. ProcessExecutionError is
defined in curtin but isn't defined in probert.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The open() call was missing a with statement, leaving the file handle
unreferenced until garbage collection.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
@ogayot ogayot changed the title Various fixes suggested Various fixes suggested by LLM May 28, 2026
@ogayot ogayot changed the title Various fixes suggested by LLM Various fixes identified using an LLM May 28, 2026
ogayot added 2 commits May 28, 2026 09:59
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
 * Requsted -> Requested
 * Unavilable -> Unavailable

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR applies several small correctness and user-facing fixes across probert’s storage, firmware, DASD, dmcrypt, and ZFS probing paths, with added tests for selected ZFS and DASD behavior.

Changes:

  • Fixes formatting/typo issues in exceptions, logs, schema keys, and printed messages.
  • Updates DASD /proc/devices reading to close the file via a context manager.
  • Adds/updates tests for ZFS property probing and DASD virtio detection.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
probert/zfs.py Updates invalid-name error formatting and exception type for ZFS property probing.
probert/tests/test_zfs.py Adds tests for ZFS property parsing, empty-name validation, and subprocess errors.
probert/tests/test_dasd.py Updates virtio DASD tests to mock context-managed file access.
probert/storage.py Corrects typos in user-facing probe availability messages.
probert/firmware.py Corrects the firmware schema property name for BIOS release date.
probert/dmcrypt.py Fixes exception interpolation in dmsetup logging.
probert/dasd.py Wraps /proc/devices reading in a context manager.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread probert/zfs.py
cmd = ['zfs', 'get', 'all', '-Hp', zfs_name]
try:
result = subprocess.run(cmd, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right! With that said, all subprocess.run in probert have an unreachable except subprocess.CalledProcessError block.

I would like to take care of them in a separate PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #170

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>

@Chris-Peterson444 Chris-Peterson444 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@ogayot ogayot merged commit b080e89 into canonical:main Jun 1, 2026
2 checks passed
@ogayot ogayot deleted the various-fixes branch June 1, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants