From a2386bbab8a2966f6832314187e65cf9e0267751 Mon Sep 17 00:00:00 2001 From: Eugene Dementiev Date: Wed, 13 Jun 2018 10:24:55 +1200 Subject: [PATCH] Fetch names after paths to finely override parameters --- ssm/parameters.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ssm/parameters.go b/ssm/parameters.go index 8fc4ff5..1187561 100644 --- a/ssm/parameters.go +++ b/ssm/parameters.go @@ -100,25 +100,25 @@ func GetParameters(names, paths []string, expand, strict, recursive bool) (param localNames = ExpandArgs(names) localPaths = ExpandArgs(paths) } - if len(localNames) > 0 { - parametersFromNames, err := getJsonSSMParameters(localNames, strict) + if len(localPaths) > 0 { + parametersFromPaths, err := getJsonSSMParametersByPaths(localPaths, strict, recursive) if err != nil { log.WithError(err).WithFields( - log.Fields{"names": localNames}, - ).Fatal("Can't get parameters by names") + log.Fields{"paths": localPaths}, + ).Fatal("Can't get parameters by paths") } - for _, parameter := range parametersFromNames { + for _, parameter := range parametersFromPaths { parameters = append(parameters, parameter) } } - if len(localPaths) > 0 { - parametersFromPaths, err := getJsonSSMParametersByPaths(localPaths, strict, recursive) + if len(localNames) > 0 { + parametersFromNames, err := getJsonSSMParameters(localNames, strict) if err != nil { log.WithError(err).WithFields( - log.Fields{"paths": localPaths}, - ).Fatal("Can't get parameters by paths") + log.Fields{"names": localNames}, + ).Fatal("Can't get parameters by names") } - for _, parameter := range parametersFromPaths { + for _, parameter := range parametersFromNames { parameters = append(parameters, parameter) } }