Catch `FileNotFound` for all `subprocess.run()` calls
Metadata
Current evaluation
Enhancement to catch FileNotFoundError from subprocess.run calls in LXC and Multipass wrappers, raising ProviderError instead. Unaddressed for over two years.
Suggested action: keep open
Reason: The issue describes a valid error-handling improvement that remains applicable, as the LXC and Multipass wrapper methods still call subprocess.run directly without catching FileNotFoundError. It has been inactive for over two years with only a Jira sync comment, so it requires maintainer prioritization rather than immediate closure.
Impact:
50
Quick Win:
35.0
Staleness:
80
Complexity:
30
Confidence:
75
Support Request:
10
Issue body
### What needs to get done
Catch `FileNotFound` for all `subprocess.run()` calls and raise a `ProviderError`.
### Why it needs to get done
If the executable is not available, `FileNotFound` bubbles up as an internal error via craft-application.
### Example
```
(testcraft_venv) root@u2204-parts-dev:/opt/testcraft/examples/ruff# testcraft pack
testcraft internal error: FileNotFoundError(2, 'No such file or directory')
Full execution log: '/root/.local/state/testcraft/log/testcraft-20240620-161753.039218.log'
```
```
2024-06-20 16:17:53.076 Executing on host: lxc remote list --format=yaml
2024-06-20 16:17:53.077 testcraft internal error: FileNotFoundError(2, 'No such file or directory')
2024-06-20 16:17:53.080 Traceback (most recent call last):
2024-06-20 16:17:53.080 File .../craft_application/application.py", line 536, in run
2024-06-20 16:17:53.080 self.run_managed(platform, build_for)
2024-06-20 16:17:53.080 File .../craft_application/application.py", line 361, in run_managed
2024-06-20 16:17:53.080 with self.services.provider.instance(
2024-06-20 16:17:53.080 File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
2024-06-20 16:17:53.080 return next(self.gen)
2024-06-20 16:17:53.080 File .../craft_application/services/provider.py", line 120, in instance
2024-06-20 16:17:53.080 with provider.launched_environment(
2024-06-20 16:17:53.080 File "/usr/lib/python3.10/contextlib.py", line 135, in __enter__
2024-06-20 16:17:53.080 return next(self.gen)
2024-06-20 16:17:53.080 File "/root/testcraft_venv/lib/python3.10/site-packages/craft_providers/lxd/lxd_provider.py", line 137, in launched_environment
2024-06-20 16:17:53.080 image.add_remote(lxc=self.lxc)
2024-06-20 16:17:53.080 File "/root/testcraft_venv/lib/python3.10/site-packages/craft_providers/lxd/remotes.py", line 97, in add_remote
2024-06-20 16:17:53.080 if self.remote_name in lxc.remote_list():
2024-06-20 16:17:53.080 File "/root/testcraft_venv/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 1001, in remote_list
2024-06-20 16:17:53.080 proc = self._run_lxc(command, capture_output=True)
2024-06-20 16:17:53.080 File "/root/testcraft_venv/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 104, in _run_lxc
2024-06-20 16:17:53.080 return subprocess.run(lxc_cmd, check=check, stdin=stdin.value, **kwargs)
2024-06-20 16:17:53.080 File "/usr/lib/python3.10/subprocess.py", line 503, in run
2024-06-20 16:17:53.080 with Popen(*popenargs, **kwargs) as process:
2024-06-20 16:17:53.080 File "/usr/lib/python3.10/subprocess.py", line 971, in __init__
2024-06-20 16:17:53.080 self._execute_child(args, executable, preexec_fn, close_fds,
2024-06-20 16:17:53.080 File "/usr/lib/python3.10/subprocess.py", line 1863, in _execute_child
2024-06-20 16:17:53.080 raise child_exception_type(errno_num, err_msg, err_filename)
2024-06-20 16:17:53.080 FileNotFoundError: [Errno 2] No such file or directory: 'lxc'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 |
Impact:
50
Quick Win:
35.0
Staleness:
80
Complexity:
30
Confidence:
75
Support Request:
10
|
keep open | Enhancement to catch FileNotFoundError from subprocess.run calls in LXC and Multipass wrappers, raising ProviderError instead. Unaddressed for over two years. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
85
Complexity:
20
Confidence:
90
Support Request:
5
|
needs triage | Enhancement to catch FileNotFoundError from subprocess.run() calls and raise ProviderError instead of bubbling up as an internal error. Currently untriaged with only an automated Jira sync comment. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
20
Confidence:
85
Support Request:
0
|
keep open | Enhancement to catch FileNotFoundError in subprocess.run calls and raise ProviderError instead of bubbling up as an internal error. Currently inactive with no maintainer follow-up since June 2024. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
20
Confidence:
80
Support Request:
0
|
close stale | Enhancement to catch FileNotFoundError in subprocess calls and raise ProviderError instead. Open for over two years with no implementation or maintainer discussion. |
Update history
No update history recorded yet.
Related issues
No related issues found above the similarity threshold.