stratis-storage/stratis-cli

When statisd gives error, stratis command still returns 0

bleve opened this issue · 4 comments

bleve commented

Logged error:

Oct 26 04:10:16 tuomo.foobar.fi snapshooter[319833]: Execution failed:
Oct 26 04:10:16 tuomo.foobar.fi snapshooter[319833]: stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: Nix error: EBUSY: Device or resource busy.

But like stated, stratis(-cli) still returns 0 as success.

Executed comman was:

stratis filesystem snapshot tuomo home 20211026-0410-snap-home

Environment is rhel 8.4 based distro. stratis-cli-2.3.0-3.el8

Thanks for the report.

Could the 0 exit code be an artifact of some script you're running? If you look at the source code here: stratis-storage/stratisd#2824, you'll see that that's the only place we create the "Execution failed:" message and in the very next line we pass a 1 to the exit_ method defined here: https://github.com/stratis-storage/stratis-cli/blob/develop-2.2.1/src/stratis_cli/_exit.py#L33.

I'm going to close this issue, but we'll continue to look at stratis-storage/stratisd#2824.

bleve commented

Not possible because I was running stratis command with:

if ! stratis filesystem snapshot tuomo home 20211026-0410-snap-home; then
   echo "command failed...... 
   do other checks....
fi

And those commands would only be run if stratis cli will return with value > 0.

And none of those commands were run.

because I was running service I would have all those command outputs in journal and they were not.

I see what you're saying, but it is much easier to believe that what you're seeing can be explained by some interaction between your script and the journal than between the stratis-cli source and your version of python. Our code is just too simple and too well-tested for it to be possible that it is returning a 0 here.

@bleve If you can reproduce the above error from the command that you're running in an interactive shell, please check echo $?.