gwcli return code is always 0 when invocation includes a command to run
- Dominant language
- Python
- Stars
- 68
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
A non-zero sys.exit should be reported when a command fails.
Command below should fail and report the rbd image already exists.
```
# gwcli /disks/ create pool=rbd image=iscsi-test-image size=100G
# echo $?
0
#
```
```
2021-03-10 21:37:14,373 DEBUG [ceph.py:33:__init__()] Adding ceph cluster 'ceph' to the UI
2021-03-10 21:37:14,711 DEBUG [ceph.py:241:populate()] Fetching ceph osd information
2021-03-10 21:37:14,783 DEBUG [ceph.py:150:update_state()] Querying ceph for state information
2021-03-10 21:37:14,994 DEBUG [storage.py:105:refresh()] Refreshing disk information from the config object
2021-03-10 21:37:14,994 DEBUG [storage.py:109:refresh()] - Scanning will use 8 scan threads
2021-03-10 21:37:15,121 DEBUG [storage.py:135:refresh()] - rbd image scan complete: 1s
2021-03-10 21:37:15,123 DEBUG [gateway.py:378:refresh()] Refreshing gateway & client information
2021-03-10 21:37:15,431 DEBUG [gateway.py:935:refresh()] - checking iSCSI/API ports on esg4bel40.mastercard.int
2021-03-10 21:37:15,699 DEBUG [gateway.py:935:refresh()] - checking iSCSI/API ports on esg4bel38.mastercard.int
2021-03-10 21:37:16,245 DEBUG [ceph.py:150:update_state()] Querying ceph for state information
2021-03-10 21:37:16,308 DEBUG [ceph.py:261:refresh()] Gathering pool stats for cluster 'ceph'
2021-03-10 21:37:16,364 DEBUG [storage.py:262:ui_command_create()] CMD: /disks/ create pool=rbd image=iscsi-test-image size=100G count=1
2021-03-10 21:37:16,365 DEBUG [storage.py:281:_valid_pool()] pool 'rbd' is ok to use
2021-03-10 21:37:16,365 DEBUG [storage.py:304:create_disk()] Creating/mapping disk rbd/iscsi-test-image
2021-03-10 21:37:16,365 DEBUG [storage.py:317:create_disk()] Issuing disk create request
2021-03-10 21:37:16,522 ERROR [storage.py:369:create_disk()] Failed : at least one rbd image(s) with that name/prefix is already defined
```
For reference:
https://github.com/ceph/ceph-iscsi/blob/b5355b8e61e58f3c4c1231f6a6f93dfc1bf1a156/gwcli.py#L120
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at gwcli.py around line 120, where command-line invocation and exit handling are referenced. Reproduce the documented gwcli command and inspect how the failed create operation is propagated to the process exit status. Done means the existing-image failure reports a non-zero return code instead of 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100