ewcloud / ewcloud/ewccli

[BUG] `ewc infra show` crashes when the VM doesn't have an image

Open
#159 0 comments 0 reactions 1 assignee Claimed by @pacospace View on GitHub
bug
Dominant language
Python
Stars
3
Forks
4
Avg merge
1d 17h
Merged PRs (30d)
11

Description

### Affected Command

ewc infra show

### Describe the issue

Some VM in Openstack do not have an image attached to them.
The openstack command lien shows them as:
```
$ openstack server show test-registry
...
| image | N/A (booted from volume) |
```

In this case, `ewc infra show` crashes with the stack trace below.

### Steps to Reproduce

1. Create an image from an existing volume
2. run `ewc infra show` against it

### Expected Behavior

Do not show the image name, but show the other parameters!

### Logs or Output

```shell
$ ewc infra show test-registry
[08/20/26 17:01:39] INFO Using `default` profile.
Traceback (most recent call last):
File "/Users/samuellanglois/.venv/bin/ewc", line 10, in
sys.exit(cli())
~~~^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/rich_click/rich_command.py", line 402, in __call__
return super().__call__(*args, **kwargs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 1462, in __call__
return self.main(*args, **kwargs)
~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/rich_click/rich_command.py", line 216, in main
rv = self.invoke(ctx)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 1850, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 1850, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 1246, in invoke
return ctx.invoke(self.callback, **ctx.params)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 814, in invoke
return callback(*args, **kwargs)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/decorators.py", line 93, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
# Step 1: Authenticate and initialize the OpenStack connection
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/click/core.py", line 814, in invoke
return callback(*args, **kwargs)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/ewccli/commands/infra_command.py", line 309, in show_cmd
image_info = openstack_api.image.find_image(image_id)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/image/v2/_proxy.py", line 998, in find_image
return self._find(
~~~~~~~~~~^
_image.Image,
^^^^^^^^^^^^^
name_or_id,
^^^^^^^^^^^
ignore_missing=ignore_missing,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/proxy.py", line 663, in _find
return resource_type.find(
~~~~~~~~~~~~~~~~~~^
self, name_or_id, ignore_missing=ignore_missing, **attrs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/image/v2/image.py", line 503, in find
result = super().find(
session,
...<5 lines>...
**params,
)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/resource.py", line 2549, in find
return match.fetch(session, microversion=microversion, **params)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/resource.py", line 1817, in fetch
request = self._prepare_request(
requires_id=requires_id,
base_path=base_path,
)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/image/v2/image.py", line 445, in _prepare_request
request = super()._prepare_request(
requires_id=requires_id,
...<4 lines>...
**kwargs,
)
File "/Users/samuellanglois/.venv/lib/python3.13/site-packages/openstack/resource.py", line 1330, in _prepare_request
raise exceptions.InvalidRequest(
"Request requires an ID but none was found"
)
```

### Environment

Linux

### EWC CLI Version

0.7.1

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.