aptible / aptible-cli

Command line interface to Aptible
MIT License
28 stars 35 forks source link

db:dump and db:execute return non-zero exit codes when postgres command fails #251

Closed joshraker closed 5 years ago

joshraker commented 5 years ago

https://aptible.zendesk.com/agent/tickets/19602

Also adds --on-error-stop flag to db:execute to make psql stop on error and return a non-zero exit code.

joshraker commented 5 years ago

Still need to write tests but I figured I'd get it out here where it can be reviewed. Right now the commands exit with the same code as the failed postgres command (psql or pg_dump). If we just need it to exit with a non-zero code we can raise a Thor::Error like we normally do but the exit code will always be 1.

codecov-io commented 5 years ago

Codecov Report

Merging #251 into master will increase coverage by 0.15%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #251      +/-   ##
==========================================
+ Coverage   97.21%   97.37%   +0.15%     
==========================================
  Files          81       81              
  Lines        3486     3543      +57     
==========================================
+ Hits         3389     3450      +61     
+ Misses         97       93       -4
Impacted Files Coverage Δ
spec/aptible/cli/subcommands/db_spec.rb 100% <100%> (ø) :arrow_up:
lib/aptible/cli/subcommands/db.rb 97.5% <100%> (+2.66%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a4604b8...ed9c3a0. Read the comment docs.

joshraker commented 5 years ago

Confirmed we want the commands to bubble up the same exit code.

joshraker commented 5 years ago

@UserNotFound I added tests for db:execute. Let me know if I violated any of our code style/norms.

joshraker commented 5 years ago

@UserNotFound bump