Skip to content

Commit f88d595

Browse files
committed
Improve error message when pool was not destroyed/created
This is idempotency related; if a pool does not exist, stratisd will return success if the user requests that it be destroyed. The CLI wants to return an error, so it detects lack of change. This change makes the error message a bit more clear. Signed-off-by: mulhern <[email protected]>
1 parent 1f6c701 commit f88d595

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/stratis_cli/_actions/_pool.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def create_pool(namespace: Namespace): # pylint: disable=too-many-locals
249249
raise StratisCliIncoherenceError(
250250
(
251251
f"Expected to create the specified pool {pool_name} but stratisd "
252-
f"reports that it did not actually create the pool"
252+
"reports that it did not actually create the pool because "
253+
f"a pool with name {pool_name} already exists"
253254
)
254255
)
255256

@@ -478,9 +479,10 @@ def destroy_pool(namespace: Namespace):
478479
if not changed: # pragma: no cover
479480
raise StratisCliIncoherenceError(
480481
(
481-
f"Expected to destroy the specified pool {namespace.pool_name} but "
482-
f"stratisd reports that it did not actually "
483-
f"destroy the pool requested"
482+
"Expected to destroy the specified pool "
483+
f"{namespace.pool_name} but stratisd reports that it did "
484+
"not actually destroy the pool because no pool named "
485+
f"{namespace.pool_name} was found."
484486
)
485487
)
486488

0 commit comments

Comments
 (0)