Skip to content

Commit

Permalink
Fix the password handle error when migrate devops (#153)
Browse files Browse the repository at this point in the history
Co-authored-by: rick <[email protected]>
  • Loading branch information
LinuxSuRen and LinuxSuRen committed Jun 21, 2021
1 parent 9b79cbf commit fdf545b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions kubectl-plugin/config/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ func (o *migrateOption) getDevOpsPassword() (password string, err error) {
var mapObj map[string]interface{}
if obj, ok = mapData["devops"]; ok {
mapObj = obj.(map[string]interface{})
password = mapObj["password"].(string)
if passwdObj := mapObj["password"]; passwdObj != nil {
password = passwdObj.(string)
}
}
}
} else {
Expand All @@ -118,7 +120,8 @@ func updateAuthWithObj(yamlf string, dataMap map[string]interface{}) string {
if obj, ok = mapData["devops"]; ok {
mapObj = obj.(map[string]interface{})
} else {
return ""
mapObj = make(map[string]interface{})
mapData["devops"] = mapObj
}

for key, val := range dataMap {
Expand Down

0 comments on commit fdf545b

Please sign in to comment.