Skip to content

Commit

Permalink
feat(pkg/task/lib/apt_install): Add support for Update param (for apt…
Browse files Browse the repository at this point in the history
…-get update)
  • Loading branch information
ondrejsika committed Mar 28, 2023
1 parent 97520dc commit a5e5e71
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions pkg/task/lib/apt_install/apt_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,27 @@ import (
)

type TaskAptInstall struct {
Name string `yaml:"name"`
State string `yaml:"state"`
Name string `yaml:"name"`
State string `yaml:"state"`
Update bool `yaml:"update"`
}

func Run(
taskInput libtask.TaskInput,
taskParams TaskAptInstall,
) libtask.TaskOutput {
var err error
if taskParams.Update {
err = exec_utils.SSH(
taskInput,
"apt-get", "update",
)
if err != nil {
return libtask.TaskOutput{
Error: err,
}
}
}
if taskParams.State == "" {
taskParams.State = "present"
}
Expand Down

0 comments on commit a5e5e71

Please # to comment.