fix: support --global on cron:set
`cron:set --global` wrote the property but emitted `unknown flag: --global` because the post-set `scheduler-cron-write` trigger received `--global` as the appName arg, which pflag rejected before reaching the trigger body. The trigger args now omit appName for global writes, and the `scheduler-k3s` cron-write trigger short-circuits when called without an app since per-app reconciliation requires a real app name. The docker-local trigger already regenerates the global crontab from all apps so global `mailfrom`/`mailto` are picked up without any further changes.
This commit is contained in:
@@ -192,9 +192,13 @@ func CommandSet(appName string, property string, value string) error {
|
||||
|
||||
common.CommandPropertySet("cron", appName, property, value, validProperties, globalProperties)
|
||||
scheduler := common.GetAppScheduler(appName)
|
||||
triggerArgs := []string{scheduler, appName}
|
||||
if appName == "--global" {
|
||||
triggerArgs = []string{scheduler}
|
||||
}
|
||||
_, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "scheduler-cron-write",
|
||||
Args: []string{scheduler, appName},
|
||||
Args: triggerArgs,
|
||||
StreamStdio: true,
|
||||
})
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user