fix: fixes an error where stdin could not be used to create tasks (#444)
This commit is contained in:
@ -87,16 +87,7 @@ func newTaskCreateCmd() cli.Command {
|
|||||||
TasksApi: api.TasksApi,
|
TasksApi: api.TasksApi,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(fluxFile) > 0 {
|
if len(scriptID) > 0 {
|
||||||
if len(scriptParams) > 0 {
|
|
||||||
return errors.New("cannot specify script parameters when not using a script in the task")
|
|
||||||
}
|
|
||||||
var err error
|
|
||||||
params.FluxQuery, err = clients.ReadQuery(fluxFile, ctx.Args())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
params.ScriptID = scriptID
|
params.ScriptID = scriptID
|
||||||
params.ScriptParams = make(map[string]interface{})
|
params.ScriptParams = make(map[string]interface{})
|
||||||
|
|
||||||
@ -105,7 +96,17 @@ func newTaskCreateCmd() cli.Command {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if len(scriptParams) > 0 {
|
||||||
|
return errors.New("cannot specify script parameters when not using a script in the task")
|
||||||
|
}
|
||||||
|
var err error
|
||||||
|
params.FluxQuery, err = clients.ReadQuery(fluxFile, ctx.Args())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.Create(getContext(ctx), ¶ms)
|
return client.Create(getContext(ctx), ¶ms)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user