`lpcraft run --clean` broken

Bug #1986374 reported by Jürgen Gmach
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lpci
Fix Released
Low
Jürgen Gmach

Bug Description

Running

```
lpcraft run --clean -v
```

on current `lpcraft` repository (5b743d6afab286eec3a63fba4bbe873bfc3fd6c3), I get the following error:

```
...
2022-08-12 22:01:36.589 :: Successfully built lpcraft-0.0.26.tar.gz and lpcraft-0.0.26-py3-none-any.whl
2022-08-12 22:01:36.689 Executing in container: lxc --project lpcraft exec local:lpcraft-lpcraft-60425368-focal-amd64 -- rm -rf /root/lpcraft/project
2022-08-12 22:01:40.216 Executing on host: lxc --project lpcraft config device show local:lpcraft-lpcraft-60425368-focal-amd64
2022-08-12 22:01:40.353 Executing on host: lxc --project lpcraft stop local:lpcraft-lpcraft-60425368-focal-amd64
2022-08-12 22:01:41.650 Executing on host: lxc --project lpcraft delete local:lpcraft-lpcraft-60425368-focal-amd64 --force
2022-08-12 22:01:41.839 Executing on host: lxc --project lpcraft delete local:lpcraft-lpcraft-60425368-focal-amd64 --force
2022-08-12 22:01:41.934 Failed to delete instance 'lpcraft-lpcraft-60425368-focal-amd64'.
* Command that failed: 'lxc --project lpcraft delete local:lpcraft-lpcraft-60425368-focal-amd64 --force'
* Command exit code: 1
* Command standard error output: b'Error: Failed checking instance exists "local:lpcraft-lpcraft-60425368-focal-amd64": Instance not found\n'
2022-08-12 22:01:41.935 Traceback (most recent call last):
2022-08-12 22:01:41.935 File "/snap/lpcraft/548/lib/craft_providers/lxd/lxc.py", line 268, in delete
2022-08-12 22:01:41.936 self._run_lxc(
2022-08-12 22:01:41.936 File "/snap/lpcraft/548/lib/craft_providers/lxd/lxc.py", line 98, in _run_lxc
2022-08-12 22:01:41.936 return subprocess.run(lxc_cmd, check=check, stdin=stdin.value, **kwargs)
2022-08-12 22:01:41.936 File "/snap/lpcraft/548/usr/lib/python3.8/subprocess.py", line 516, in run
2022-08-12 22:01:41.936 raise CalledProcessError(retcode, process.args,
2022-08-12 22:01:41.936 subprocess.CalledProcessError: Command '['lxc', '--project', 'lpcraft', 'delete', 'local:lpcraft-lpcraft-60425368-focal-amd64', '--force']' returned non-zero exit status 1.
2022-08-12 22:01:41.936
2022-08-12 22:01:41.936 The above exception was the direct cause of the following exception:
2022-08-12 22:01:41.936 Traceback (most recent call last):
2022-08-12 22:01:41.936 File "/snap/lpcraft/548/lib/lpcraft/providers/_lxd.py", line 154, in clean_project_environments
2022-08-12 22:01:41.936 self.lxc.delete(
2022-08-12 22:01:41.936 File "/snap/lpcraft/548/lib/craft_providers/lxd/lxc.py", line 275, in delete
2022-08-12 22:01:41.936 raise LXDError(
2022-08-12 22:01:41.936 craft_providers.lxd.errors.LXDError: Failed to delete instance 'lpcraft-lpcraft-60425368-focal-amd64'.
2022-08-12 22:01:41.936 * Command that failed: 'lxc --project lpcraft delete local:lpcraft-lpcraft-60425368-focal-amd64 --force'
2022-08-12 22:01:41.936 * Command exit code: 1
2022-08-12 22:01:41.936 * Command standard error output: b'Error: Failed checking instance exists "local:lpcraft-lpcraft-60425368-focal-amd64": Instance not found\n'
2022-08-12 22:01:41.936 Full execution log: '/home/jugmac00/snap/lpcraft/common/cache/lpcraft/log/lpcraft-20220812-215947.328406.log'
```

Related branches

Revision history for this message
Jürgen Gmach (jugmac00) wrote :

On a first glance it looks like there are two attempts to delete the container - the first works, the seconds fails as the container is gone already.

Guruprasad (lgp171188)
Changed in lpcraft:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Jürgen Gmach (jugmac00) wrote :

In order to reproduce the issue...

- install lpcraft via snap
- clone this repository ( https://code.launchpad.net/lpcraft )
- run `lpcraft run --clean -v`

Revision history for this message
Jürgen Gmach (jugmac00) wrote :

This only happens when two jobs are ran with the same series/architectures, as then the container name is the same.

Jürgen Gmach (jugmac00)
Changed in lpcraft:
assignee: nobody → Jürgen Gmach (jugmac00)
status: Triaged → Fix Committed
Jürgen Gmach (jugmac00)
Changed in lpcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.