Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] improper exit code on failed command #185

Closed
clemenko opened this issue Feb 18, 2024 · 4 comments
Closed

[BUG] improper exit code on failed command #185

clemenko opened this issue Feb 18, 2024 · 4 comments

Comments

@clemenko
Copy link
Contributor

Environmental Info:
rocky 9

Hauler Version:
0.4.4

System CPU architecture, OS, and Version:
Linux iventoy 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 8 17:36:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Describe the bug:
when the hauler command failed it still has an exit code of "0" which tells bash it completed.

[root@iventoy hauler]# hauler store sync -f /opt/hauler/airgap_haulerdd.yaml
Error: open /opt/hauler/airgap_haulerdd.yaml: no such file or directory
Usage:
  hauler store sync [flags]

Flags:
  -f, --files strings      Path to content files
  -h, --help               help for sync
  -k, --key string         (Optional) Path to the key for signature verification
  -p, --platform string    (Optional) Specific platform to save. i.e. linux/amd64. Defaults to all if flag is omitted.
      --products strings   Used for RGS Carbide customers to supply a product and version and Hauler will retrieve the images. i.e. '--product rancher=v2.7.6'

Global Flags:
      --cache string       Location of where to store cache data (defaults to $XDG_CACHE_DIR/hauler)
  -l, --log-level string    (default "info")
  -s, --store string       Location to create store at (default "store")

1:47PM ERR open /opt/hauler/airgap_haulerdd.yaml: no such file or directory
[root@iventoy hauler]# echo $?
0

Steps To Reproduce:
type a filename wrong

hauler store sync -f /opt/hauler/airgap_haulerdd.yaml

Expected behavior:
when hauler has an ERR output an exit code of '1' is expected
1:50PM ERR open /opt/hauler/airgap_haulerdd.yaml: no such file or directory

Actual behavior:
exit code "0"

Additional context / logs:
I am trying to add error checking around the use of hauler and have correct exit codes is important.

@github-project-automation github-project-automation bot moved this to Pending Review in Hauler Feb 18, 2024
@amartin120
Copy link
Contributor

D'oh. Easy fix. I'll queue this up soon. Thanks, @clemenko

@clemenko
Copy link
Contributor Author

thanks @amartin120 fantastic!

@clemenko
Copy link
Contributor Author

@amartin120
Copy link
Contributor

amartin120 commented Feb 20, 2024

PR: #187. (merged)

in line for v1.0.1, "soon"

@github-project-automation github-project-automation bot moved this from Pending Review to Resolved in Hauler Feb 27, 2024
@github-project-automation github-project-automation bot moved this to Pending Review in Hauler Jul 17, 2024
@zackbradys zackbradys moved this from Pending Review to Resolved in Hauler Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Resolved
Development

No branches or pull requests

2 participants