Skip to content

Commit

Permalink
Merge pull request #18 from mittwald/align-casing
Browse files Browse the repository at this point in the history
rename max_attempts to maxAttempts
  • Loading branch information
martin-helmich authored Mar 9, 2020
2 parents 8b2c0be + 19fcb1f commit 1e172c9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Possible directives to use in a job definition.
job "foo" {
command = "/usr/local/bin/foo"
args = "bar"
max_attempts = 3
maxAttempts = 3
canFail = false
watch "/etc/conf.d/barfoo" {
Expand Down
7 changes: 7 additions & 0 deletions internal/config/ignitionconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ func (ignitionConfig *Ignition) GenerateFromConfigDir(configDir string) error {
}
}

for _, job := range ignitionConfig.Jobs {
if job.MaxAttempts_ != 0 {
log.Infof("field max_attempts in job %s is deprecated in favor of maxAttempts", job.Name)
job.MaxAttempts = job.MaxAttempts_
}
}

return nil
}
15 changes: 8 additions & 7 deletions internal/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ type Watch struct {
}

type JobConfig struct {
Name string `hcl:",key"`
Command string `hcl:"command"`
Args []string `hcl:"args"`
Watches []Watch `hcl:"watch"`
MaxAttempts int `hcl:"max_attempts"`
CanFail bool `hcl:"canFail"`
OneTime bool `hcl:"oneTime"`
Name string `hcl:",key"`
Command string `hcl:"command"`
Args []string `hcl:"args"`
Watches []Watch `hcl:"watch"`
MaxAttempts_ int `hcl:"max_attempts"` // deprecated
MaxAttempts int `hcl:"maxAttempts"`
CanFail bool `hcl:"canFail"`
OneTime bool `hcl:"oneTime"`
}

type File struct {
Expand Down

0 comments on commit 1e172c9

Please sign in to comment.