diff --git a/containers/types.go b/containers/types.go index 0e651ac..8aec98c 100644 --- a/containers/types.go +++ b/containers/types.go @@ -242,17 +242,17 @@ func (c *Container) GenerateDeploySSHKeys() (bool, error) { return false, nil } - _, err := driver.Exec(c.App.Name, []string{"mkdir", "-p", "/srv/.ssh"}, "", []string{}, false) + _, err := driver.Exec(c.App.Name, []string{"mkdir", "-p", "/srv/.ssh"}, "", []string{}, true) if err != nil { return false, err } - _, err = driver.Exec(c.App.Name, []string{"ssh-keygen", "-f", "/srv/.ssh/id_rsa", "-P", ""}, "", []string{}, false) + _, err = driver.Exec(c.App.Name, []string{"ssh-keygen", "-f", "/srv/.ssh/id_rsa", "-P", ""}, "", []string{}, true) if err != nil { return false, err } - _, err = driver.Exec(c.App.Name, []string{"chown", "app:app", "-R", "/srv/.ssh"}, "", []string{}, false) + _, err = driver.Exec(c.App.Name, []string{"chown", "app:app", "-R", "/srv/.ssh"}, "", []string{}, true) if err != nil { return false, err } @@ -301,7 +301,7 @@ func (c *Container) GetHostKey() (string, error) { } // Append text to a file in the container -func (c *Container) AppendOfFile(filename string, text string, mode string) error { +func (c *Container) AppendFile(filename string, text string, mode string) error { driver := c.getDriver() _, err := driver.Exec(c.App.Name, []string{"tee", "-a", filename}, text, []string{}, false) diff --git a/glue/main.go b/glue/main.go index c76cde7..b850cd2 100644 --- a/glue/main.go +++ b/glue/main.go @@ -510,7 +510,7 @@ func (p *Processor) GenerateDeploySSHKeys() (string, string, error) { } if created { - err = container.AppendOfFile(sshPubKeysLocation, pubKey+"\n", "0600") + err = container.AppendFile(sshPubKeysLocation, pubKey+"\n", "0600") if err != nil { return "", "", err } diff --git a/handlers_nats.go b/handlers_nats.go index cb31a05..859f08c 100644 --- a/handlers_nats.go +++ b/handlers_nats.go @@ -419,7 +419,10 @@ func getDeploySSHKeysEventHandler(m *nats.Msg, message *RequestMessage) error { // Assembling reply message reply := ReplyMessage{ - Payload: struct{ PrivateKey, PublicKey string }{ + Payload: struct { + PrivateKey string `json:"private_key"` + PublicKey string `json:"public_key"` + }{ PrivateKey: privateKey, PublicKey: pubKey, },