Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/spf13/viper"
)

var Version string = "33.15"
var Version string = "33.16"

var cfgFile string
var userAgent string
Expand Down
16 changes: 16 additions & 0 deletions docs/releases/33.16.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## What's new

### `cronitor sync --auto` no longer installs an empty crontab when the API fails

Fixes for 33.15 ([#93](https://github.com/cronitorio/cronitor-cli/pull/93)):

- With `--auto` and a single crontab file, if the Cronitor API call fails, sync now prints the original crontab to stdout, leaves the file unchanged, and exits 1. Before, it printed nothing, so `cronitor sync --auto file | crontab -` installed an empty crontab.
- The same applies once sync has read the file and then hits a missing API key, an invalid `--format`, or a file it can't write. It prints the original crontab and exits 1.
- A crontab file that is missing or can't be read now exits 1, with the error on stderr and nothing on stdout. Before, it exited 0. `--dry-run` on a single named file that can't be written also exits 1.
- `--verbose` request logs go to stderr when stdout carries the crontab, so they can't end up in the pipe.
- With several crontabs, or in interactive mode, an API failure no longer stops the run. Each remaining crontab is still tried, and sync exits 1 at the end.
- A direct `| crontab -` pipe can still install an empty crontab if sync fails before it reads the file, for example when the file is missing or a flag is invalid. Capture the output first: `out=$(cronitor sync --auto file) && printf '%s\n' "$out" | crontab -`. Don't add `--silent` to that command, because `--auto --silent` prints no crontab.

### Other changes

- The reminder after an interactive dry run now tells you to run the same command without `--dry-run`. Before, it suggested `--auto --silent`. API keys passed with `-k`/`--api-key` or `-p`/`--ping-api-key` are hidden in that reminder.
Loading