Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Support instance/attributes/block-project-ssh-keys for gce metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
niusmallnan committed Dec 27, 2018
1 parent 4cab9c9 commit 7a0d3a8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions config/cloudinit/datasource/metadata/gce/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (ms MetadataService) FetchMetadata() (datasource.Metadata, error) {
if err != nil {
return datasource.Metadata{}, err
}
blockProjectSSHKeys, err := ms.fetchString("instance/attributes/block-project-ssh-keys")
if err != nil {
return datasource.Metadata{}, err
}

md := datasource.Metadata{
PublicIPv4: public,
PrivateIPv4: local,
Expand All @@ -89,8 +94,10 @@ func (ms MetadataService) FetchMetadata() (datasource.Metadata, error) {
md.NetworkConfig.Interfaces["eth0"] = network
}
*/

keyStrings := strings.Split(projectSSHKeys+"\n"+instanceSSHKeys, "\n")
keyStrings := strings.Split(instanceSSHKeys, "\n")
if blockProjectSSHKeys != "true" {
keyStrings = append(keyStrings, strings.Split(projectSSHKeys, "\n")...)
}

i := 0
for _, keyString := range keyStrings {
Expand Down

0 comments on commit 7a0d3a8

Please sign in to comment.