mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-17 17:44:41 +02:00
fix missingFileHandler (#440)
- Fix panics when `missingFileHandler` is not defined - Fix `missingFileHandler: Error` had been writing errors at the Warn level - Add `Info` and `Debug` as valid values Ref https://github.com/roboll/helmfile/pull/439#issuecomment-456155521
This commit is contained in:
+16
-4
@@ -1104,11 +1104,17 @@ func (st *HelmState) namespaceAndValuesFlags(helm helmexec.Interface, release *R
|
||||
path := st.normalizePath(release.ValuesPathPrefix + typedValue)
|
||||
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
if release.MissingFileHandler == nil && *release.MissingFileHandler == "Error" {
|
||||
if release.MissingFileHandler == nil || *release.MissingFileHandler == "Error" {
|
||||
return nil, err
|
||||
} else {
|
||||
} else if *release.MissingFileHandler == "Warn" {
|
||||
st.logger.Warnf("skipping missing values file \"%s\"", path)
|
||||
continue
|
||||
} else if *release.MissingFileHandler == "Info" {
|
||||
st.logger.Infof("skipping missing values file \"%s\"", path)
|
||||
continue
|
||||
} else {
|
||||
st.logger.Debugf("skipping missing values file \"%s\"", path)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,11 +1154,17 @@ func (st *HelmState) namespaceAndValuesFlags(helm helmexec.Interface, release *R
|
||||
for _, value := range release.Secrets {
|
||||
path := st.normalizePath(release.ValuesPathPrefix + value)
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
if release.MissingFileHandler == nil && *release.MissingFileHandler == "Error" {
|
||||
if release.MissingFileHandler == nil || *release.MissingFileHandler == "Error" {
|
||||
return nil, err
|
||||
} else {
|
||||
} else if *release.MissingFileHandler == "Warn" {
|
||||
st.logger.Warnf("skipping missing secrets file \"%s\"", path)
|
||||
continue
|
||||
} else if *release.MissingFileHandler == "Info" {
|
||||
st.logger.Infof("skipping missing secrets file \"%s\"", path)
|
||||
continue
|
||||
} else {
|
||||
st.logger.Debugf("skipping missing secrets file \"%s\"", path)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user