Try 07
This commit is contained in:
parent
4479fa02e4
commit
5a75bc5a37
|
@ -53,16 +53,6 @@ func (cf *ConfigFile) Generate(root string, templateDir string, values []byte) e
|
|||
return fmt.Errorf("Process templates failed with error: %v", err)
|
||||
}
|
||||
log.Printf("\tFile %s generated\n", dest)
|
||||
|
||||
if cf.Service != "" {
|
||||
sv := SystemService{
|
||||
Name: cf.Service,
|
||||
Enabled: true,
|
||||
Type: "",
|
||||
ToStart: true,
|
||||
}
|
||||
return sv.Restart()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ func processConfigFiles(tpls []ConfigFile, variables map[string]interface{}, tem
|
|||
return fmt.Errorf("Error unmarshaling values on template process; %v", err)
|
||||
}
|
||||
|
||||
var servicesToRestart []string
|
||||
for _, tpl := range tpls {
|
||||
fileExt := filepath.Ext(tpl.Source)
|
||||
if fileExt == ".hcl" {
|
||||
|
@ -94,6 +95,19 @@ func processConfigFiles(tpls []ConfigFile, variables map[string]interface{}, tem
|
|||
return fmt.Errorf("Template %s generation failed with error %v", tpl.Source, err)
|
||||
}
|
||||
|
||||
if len(tpl.Service) != 0 {
|
||||
servicesToRestart = append(servicesToRestart, tpl.Service)
|
||||
}
|
||||
}
|
||||
|
||||
for _, srv := range servicesToRestart {
|
||||
sv := SystemService{
|
||||
Name: srv,
|
||||
Enabled: true,
|
||||
Type: "",
|
||||
ToStart: true,
|
||||
}
|
||||
return sv.Restart()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue