Skip to content

Commit 77cca94

Browse files
fix: fixes an error where stdin could not be used to create tasks (#444)
1 parent e39e365 commit 77cca94

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cmd/influx/task.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,7 @@ func newTaskCreateCmd() cli.Command {
8787
TasksApi: api.TasksApi,
8888
}
8989

90-
if len(fluxFile) > 0 {
91-
if len(scriptParams) > 0 {
92-
return errors.New("cannot specify script parameters when not using a script in the task")
93-
}
94-
var err error
95-
params.FluxQuery, err = clients.ReadQuery(fluxFile, ctx.Args())
96-
if err != nil {
97-
return err
98-
}
99-
} else {
90+
if len(scriptID) > 0 {
10091
params.ScriptID = scriptID
10192
params.ScriptParams = make(map[string]interface{})
10293

@@ -105,7 +96,17 @@ func newTaskCreateCmd() cli.Command {
10596
return err
10697
}
10798
}
99+
} else {
100+
if len(scriptParams) > 0 {
101+
return errors.New("cannot specify script parameters when not using a script in the task")
102+
}
103+
var err error
104+
params.FluxQuery, err = clients.ReadQuery(fluxFile, ctx.Args())
105+
if err != nil {
106+
return err
107+
}
108108
}
109+
109110
return client.Create(getContext(ctx), &params)
110111
},
111112
}

0 commit comments

Comments
 (0)