Skip to content

Commit 3305b19

Browse files
committedSep 19, 2017
Fix autoupdates with @Cron prefix
1 parent 5b6e8bd commit 3305b19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed
 

‎main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
func main() {
3333
if err := cmd.RootCmd.Execute(); err != nil {
34-
if err == cmd.ErrUsage {
34+
if err != cmd.ErrUsage {
3535
fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error()) // #nosec
3636
os.Exit(1)
3737
}

‎pkg/instance/updates.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net/url"
7+
"strings"
78
"sync"
89
"time"
910

@@ -34,6 +35,7 @@ type updateCron struct {
3435
// updates of all the instances existing.
3536
func StartUpdateCron() (utils.Shutdowner, error) {
3637
autoUpdates := config.GetConfig().AutoUpdates
38+
3739
if !autoUpdates.Activated {
3840
return utils.NopShutdown, nil
3941
}
@@ -43,7 +45,8 @@ func StartUpdateCron() (utils.Shutdowner, error) {
4345
finished: make(chan struct{}),
4446
}
4547

46-
schedule, err := cron.Parse(autoUpdates.Schedule)
48+
spec := strings.TrimPrefix(autoUpdates.Schedule, "@cron ")
49+
schedule, err := cron.Parse(spec)
4750
if err != nil {
4851
return nil, err
4952
}

0 commit comments

Comments
 (0)