Skip to content
Snippets Groups Projects
Unverified Commit f1ab75bd authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Leave support for legacy images

parent 55a9006c
Branches
Tags
No related merge requests found
......@@ -459,6 +459,15 @@ func (c *ComputeUtil) uploadSSHKey(instance *raw.Instance, sshKeyPath string) er
metaDataValue := fmt.Sprintf("%s:%s %s\n", c.userName, strings.TrimSpace(string(sshKey)), c.userName)
metadata := instance.Metadata
// "sshKeys" was deprecated in favor of "ssh-keys" metadata key. However, old images may still depend
// on the old metadata configuration. And users may still have legitimate reasons to use these older
// images. As instance metadata is a simple key-value store, it should have no problems with having
// the keys defined twice under two different names. Legacy images will then still be able to use the
// legacy key naming, while new ones will get support for the expected new naming.
metadata.Items = append(metadata.Items, &raw.MetadataItems{
Key: "sshKeys",
Value: &metaDataValue,
})
metadata.Items = append(metadata.Items, &raw.MetadataItems{
Key: "ssh-keys",
Value: &metaDataValue,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment