mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-20 00:02:13 +00:00
feat: firecracker mmds identity
This commit is contained in:
parent
500354cd9b
commit
3eb610b703
23 changed files with 1813 additions and 263 deletions
|
|
@ -54,6 +54,31 @@ hostname "$machine_name" >/dev/null 2>&1 || true
|
|||
return nil
|
||||
}
|
||||
|
||||
func (d *Daemon) syncGuestFilesystemOverSSH(ctx context.Context, runtimeHost string) error {
|
||||
runtimeHost = strings.TrimSpace(runtimeHost)
|
||||
if runtimeHost == "" {
|
||||
return fmt.Errorf("guest runtime host is required")
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(
|
||||
ctx,
|
||||
"ssh",
|
||||
"-i", d.backendSSHPrivateKeyPath(),
|
||||
"-o", "StrictHostKeyChecking=no",
|
||||
"-o", "UserKnownHostsFile=/dev/null",
|
||||
"-o", "IdentitiesOnly=yes",
|
||||
"-o", "BatchMode=yes",
|
||||
"-p", strconv.Itoa(int(defaultSSHPort)),
|
||||
"node@"+runtimeHost,
|
||||
"sudo bash -lc "+shellSingleQuote("sync"),
|
||||
)
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("sync guest filesystem over ssh: %w: %s", err, strings.TrimSpace(string(output)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func shellSingleQuote(value string) string {
|
||||
return "'" + strings.ReplaceAll(value, "'", `'"'"'`) + "'"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue