mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Fix the Scaleway provider in the metadata package
This commit will update the Scaleway provider to fetch the cloud-init/cloud-config data from the user_data/cloud-init endpoint it will also make sure the whole public ssh key is fetched and no longer strip out the `ssh-rsa` part of the keys Signed-off-by: Simon Fridlund <simon@fridlund.email>
This commit is contained in:
parent
afff608c49
commit
ea5f542450
@ -210,11 +210,11 @@ func scalewayGetUserdata() ([]byte, error) {
|
|||||||
return nil, errors.New("not able to found a free port below 1024")
|
return nil, errors.New("not able to found a free port below 1024")
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
fmt.Fprintf(conn, "GET /user_data HTTP/1.0\r\n\r\n")
|
fmt.Fprintf(conn, "GET /user_data/cloud-init HTTP/1.0\r\n\r\n")
|
||||||
|
|
||||||
reader := bufio.NewReader(conn)
|
reader := bufio.NewReader(conn)
|
||||||
resp, err := http.ReadResponse(reader, nil)
|
resp, err := http.ReadResponse(reader, nil)
|
||||||
if err != nil {
|
if err != nil || resp.StatusCode == 404 {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
@ -245,10 +245,7 @@ func (p *ProviderScaleway) handleSSH(metadata []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
line := string(bytes.Trim(sshKey, "'"))
|
line := string(bytes.Trim(sshKey, "'"))
|
||||||
parts := strings.SplitN(line, " ", 2)
|
rootKeys = rootKeys + line + "\n"
|
||||||
if len(parts) == 2 {
|
|
||||||
rootKeys = rootKeys + parts[1] + "\n"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Mkdir(path.Join(ConfigPath, SSH), 0755); err != nil {
|
if err := os.Mkdir(path.Join(ConfigPath, SSH), 0755); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user