fix(datasource/CloudSigma): Add a test for an empty ssh key

This commit is contained in:
Kiril Vladimirov
2015-02-22 05:31:38 +02:00
parent c30fc51b03
commit be53013431
2 changed files with 23 additions and 0 deletions

View File

@@ -108,6 +108,8 @@ func (scs *serverContextService) FetchMetadata() (metadata datasource.Metadata,
}
metadata.SSHPublicKeys = map[string]string{}
// CloudSigma uses an empty string, rather than no string,
// to represent the lack of a SSH key
if key, _ := inputMetadata.Meta["ssh_public_key"]; len(key) > 0 {
splitted := strings.Split(key, " ")
metadata.SSHPublicKeys[splitted[len(splitted)-1]] = key