Error when host key is not found
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7f07a50bfd
commit
3ae383d1cd
1 changed files with 5 additions and 4 deletions
|
@ -16,6 +16,7 @@ import (
|
|||
// username in the containers under which all containers run
|
||||
const appUsername = "app"
|
||||
const passwordFile = "/srv/.rosti"
|
||||
const keyType = "ed25519"
|
||||
|
||||
// Process contains info about background application usually running in supervisor
|
||||
type Process struct {
|
||||
|
@ -247,7 +248,7 @@ func (c *Container) GenerateDeploySSHKeys() (bool, error) {
|
|||
return false, err
|
||||
}
|
||||
|
||||
_, err = driver.Exec(c.App.Name, []string{"ssh-keygen", "-f", "/srv/.ssh/id_rsa", "-P", ""}, "", []string{}, true)
|
||||
_, err = driver.Exec(c.App.Name, []string{"ssh-keygen", "-f", "/srv/.ssh/id_" + keyType, "-P", ""}, "", []string{}, true)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -265,11 +266,11 @@ func (c *Container) GenerateDeploySSHKeys() (bool, error) {
|
|||
func (c *Container) GetDeploySSHKeys() (string, string, error) {
|
||||
driver := c.getDriver()
|
||||
|
||||
privateKey, err := driver.Exec(c.App.Name, []string{"cat", "/srv/.ssh/id_rsa"}, "", []string{}, true)
|
||||
privateKey, err := driver.Exec(c.App.Name, []string{"cat", "/srv/.ssh/id_" + keyType}, "", []string{}, true)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
pubKey, err := driver.Exec(c.App.Name, []string{"cat", "/srv/.ssh/id_rsa.pub"}, "", []string{}, true)
|
||||
pubKey, err := driver.Exec(c.App.Name, []string{"cat", "/srv/.ssh/id_" + keyType + ".pub"}, "", []string{}, true)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
@ -298,7 +299,7 @@ func (c *Container) GetHostKey() (string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
return "", errors.New("key not found")
|
||||
}
|
||||
|
||||
// Append text to a file in the container
|
||||
|
|
Loading…
Reference in a new issue