Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ To change image tag of `smiling-penguin` release:
helm update-config "cf.20190214.142635" --set-value image.tag=stable,kube.diego_cell_size=1
helm update-config "cf.20190214.142635" --values file_path1
helm update-config "cf.20190214.142635" --set-value image.tag=stable --values=file_path1
helm --tls --tls-ca-cert /tmp/helm_secret/ca.cert.pem --tls-cert /tmp/helm_secret/helm.cert.pem --tls-key /tmp/helm_secret/helm.key.pem update-config "cf.20190909.143636" --set-value sizing.diego_cell.count="1",kube.diego_cell_size="1"
```

For the last sample command, the plugin will merge the key/value pairs specified in both --set-value and --value file, if there are different keys specified in both --set-value and --value file, then --set-value will override the value in --value file.
Expand Down
12 changes: 12 additions & 0 deletions updatecfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,18 @@ func (cmd *updateConfigCommand) run() error {
return err
}

if ls == nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we mock helm.Interface and improve unit test?

return errors.New("[ERROR] Release list is nil.")
}

if len(ls.Releases) == 0 {
return errors.New("[ERROR] Release list is none.")
}

if ls.Releases[0].Config == nil {
return errors.New("[ERROR] Release config is nil.")
}

var preVals map[string]interface{}
err = yaml.Unmarshal([]byte(ls.Releases[0].Config.Raw), &preVals)
if err != nil {
Expand Down