Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
add prop verification
Browse files Browse the repository at this point in the history
  • Loading branch information
MChorfa committed Aug 11, 2020
1 parent 60e9d78 commit a56190c
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions pkg/helm/outputs.go
Expand Up @@ -42,33 +42,37 @@ func (m *Mixin) getOutput(resourceType, resourceName, namespace, jsonPath string
}

func (m *Mixin) handleOutputs(client kubernetes.Interface, outputs []HelmOutput) error {
var outputError error
//Now get the outputs
for _, output := range outputs {

val, err := getSecret(client, output.Namespace, output.Secret, output.Key)
if err != nil {
return err
}
if output.Secret != "" && output.Key != "" {
val, err := getSecret(client, output.Namespace, output.Secret, output.Key)

err = m.Context.WriteMixinOutputToFile(output.Name, val)
if err != nil {
return err
}
if err != nil {
return err
}

bytes, err := m.getOutput(
output.ResourceType,
output.ResourceName,
output.Namespace,
output.JSONPath,
)
if err != nil {
return err
outputError = m.Context.WriteMixinOutputToFile(output.Name, val)
}

err = m.Context.WriteMixinOutputToFile(output.Name, bytes)
if output.ResourceType != "" && output.ResourceName != "" && output.JSONPath != "" {
bytes, err := m.getOutput(
output.ResourceType,
output.ResourceName,
output.Namespace,
output.JSONPath,
)
if err != nil {
return err
}

outputError = m.Context.WriteMixinOutputToFile(output.Name, bytes)

}

if err != nil {
return errors.Wrapf(err, "unable to write output '%s'", output.Name)
if outputError != nil {
return errors.Wrapf(outputError, "unable to write output '%s'", output.Name)
}
}
return nil
Expand Down

0 comments on commit a56190c

Please sign in to comment.