mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Merge pull request #3349 from ptone/gcp-fixes
Update GCP metadata provider
This commit is contained in:
commit
547521d146
@ -53,7 +53,7 @@ func (p *ProviderGCP) Extract() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generic userdata
|
// Generic userdata
|
||||||
userData, err := gcpGet(instance + "attributes/userdata")
|
userData, err := gcpGet(instance + "attributes/user-data")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("GCP: Failed to get user-data: %s", err)
|
log.Printf("GCP: Failed to get user-data: %s", err)
|
||||||
// This is not an error
|
// This is not an error
|
||||||
@ -102,9 +102,11 @@ func (p *ProviderGCP) handleSSH() error {
|
|||||||
return fmt.Errorf("Failed to get sshKeys: %s", err)
|
return fmt.Errorf("Failed to get sshKeys: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if _, err := os.Stat(path.Join(ConfigPath, SSH)); os.IsNotExist(err) {
|
||||||
if err := os.Mkdir(path.Join(ConfigPath, SSH), 0755); err != nil {
|
if err := os.Mkdir(path.Join(ConfigPath, SSH), 0755); err != nil {
|
||||||
return fmt.Errorf("Failed to create %s: %s", SSH, err)
|
return fmt.Errorf("Failed to create %s: %s", SSH, err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rootKeys := ""
|
rootKeys := ""
|
||||||
for _, line := range strings.Split(string(sshKeys), "\n") {
|
for _, line := range strings.Split(string(sshKeys), "\n") {
|
||||||
|
@ -266,7 +266,7 @@ func (g GCPClient) CreateInstance(name, image, zone, machineType string, disks D
|
|||||||
Value: sshKey,
|
Value: sshKey,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: "userdata",
|
Key: "user-data",
|
||||||
Value: data,
|
Value: data,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user