fix(datasource/CloudSigma): Make sure public ssh key is not empty
Even when public ssh key is not set by the user, CloudSigma's server context has a key `meta.ssh_public_key` which is just an empty string. So instead of just relying on the "comma ok" idiom I make sure the value is not an empty string.
This commit is contained in:
parent
b429eaab84
commit
c30fc51b03
@ -108,7 +108,7 @@ func (scs *serverContextService) FetchMetadata() (metadata datasource.Metadata,
|
||||
}
|
||||
|
||||
metadata.SSHPublicKeys = map[string]string{}
|
||||
if key, ok := inputMetadata.Meta["ssh_public_key"]; ok {
|
||||
if key, _ := inputMetadata.Meta["ssh_public_key"]; len(key) > 0 {
|
||||
splitted := strings.Split(key, " ")
|
||||
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user