Skip to content

Commit ab08309

Browse files
feat(command/start): add --enable and --soft flags
Fixes #4647
1 parent bb389b3 commit ab08309

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

docs/source/sctool/partials/sctool_start.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ options:
99
shorthand: c
1010
usage: |
1111
The target cluster `name or ID` (envvar SCYLLA_MANAGER_CLUSTER).
12+
- name: enable
13+
default_value: "false"
14+
usage: |
15+
Enable the task if it was disabled.
1216
- name: help
1317
shorthand: h
1418
default_value: "false"
@@ -17,6 +21,10 @@ options:
1721
default_value: "false"
1822
usage: |
1923
Do not resume the last run.
24+
- name: soft
25+
default_value: "false"
26+
usage: |
27+
The task will be started only if its last run hasn't finished successfully or when it finished successfully and it missed its activation scheduled after that.
2028
inherited_options:
2129
- name: api-cert-file
2230
usage: |

pkg/command/start/cmd.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ type command struct {
2121

2222
cluster string
2323
noContinue bool
24+
enable bool
25+
soft bool
2426
}
2527

2628
func NewCommand(client *managerclient.Client) *cobra.Command {
@@ -46,12 +48,19 @@ func (cmd *command) init() {
4648
w := flag.Wrap(cmd.Flags())
4749
w.Cluster(&cmd.cluster)
4850
w.Unwrap().BoolVar(&cmd.noContinue, "no-continue", false, "")
51+
w.Unwrap().BoolVar(&cmd.enable, "enable", false, "")
52+
w.Unwrap().BoolVar(&cmd.soft, "soft", false, "")
4953
}
5054

5155
func (cmd *command) run(args []string) error {
5256
taskType, taskID, err := cmd.client.TaskSplit(cmd.Context(), cmd.cluster, args[0])
5357
if err != nil {
5458
return err
5559
}
56-
return cmd.client.StartTask(cmd.Context(), cmd.cluster, taskType, taskID, !cmd.noContinue)
60+
params := managerclient.StartTaskParams{
61+
Continue: !cmd.noContinue,
62+
Enable: cmd.enable,
63+
Soft: cmd.soft,
64+
}
65+
return cmd.client.StartTaskWithParams(cmd.Context(), cmd.cluster, taskType, taskID, params)
5766
}

pkg/command/start/res.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ long: |
88
99
no-continue: |
1010
Do not resume the last run.
11+
12+
enable: |
13+
Enable the task if it was disabled.
14+
15+
soft: |
16+
The task will be started only if its last run hasn't finished successfully or when it finished successfully and it missed its activation scheduled after that.

0 commit comments

Comments
 (0)