Get SSH host keys message handler
This commit is contained in:
parent
df5a390680
commit
8051310677
@ -280,6 +280,26 @@ func (c *Container) GetDeploySSHKeys() (string, string, error) {
|
||||
return "", "", nil
|
||||
}
|
||||
|
||||
// Return host key without hostname
|
||||
func (c *Container) GetHostKey() (string, error) {
|
||||
driver := c.getDriver()
|
||||
|
||||
hostKeyRaw, err := driver.Exec(c.App.Name, []string{"ssh-keyscan ", "localhost"}, "", []string{}, true)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if hostKeyRaw != nil {
|
||||
parts := strings.SplitN(string(*hostKeyRaw), " ", 1)
|
||||
if len(parts) > 1 {
|
||||
return parts[1], nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
// Append text to a file in the container
|
||||
func (c *Container) AppendOfFile(filename string, text string, mode string) error {
|
||||
driver := c.getDriver()
|
||||
|
||||
|
20
glue/main.go
20
glue/main.go
@ -519,6 +519,26 @@ func (p *Processor) GenerateDeploySSHKeys() (string, string, error) {
|
||||
return privateKey, pubKey, nil
|
||||
}
|
||||
|
||||
// Return SSH host key without hostname (first part of the line)
|
||||
func (p *Processor) GetHostKey() (string, error) {
|
||||
err := p.waitForApp()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
container, err := p.getContainer()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
hostKey, err := container.GetHostKey()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return hostKey, nil
|
||||
}
|
||||
|
||||
// Processes returns list of supervisord processes
|
||||
func (p *Processor) Processes() ([]docker.Process, error) {
|
||||
container, err := p.getContainer()
|
||||
|
Loading…
Reference in New Issue
Block a user