MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / removeSSHHostEntry

Function removeSSHHostEntry

cmd/delete.go:162–175  ·  view source on GitHub ↗
(configPath, instanceID string)

Source from the content-addressed store, hash-verified

160}
161
162func removeSSHHostEntry(configPath, instanceID string) error {
163 if _, err := os.Stat(configPath); os.IsNotExist(err) {
164 return nil
165 }
166
167 data, err := os.ReadFile(configPath)
168 if err != nil {
169 return err
170 }
171
172 hostName := fmt.Sprintf("tnr-%s", instanceID)
173 result := filterSSHHostBlock(string(data), hostName)
174 return os.WriteFile(configPath, []byte(result), 0o600)
175}
176
177// filterSSHHostBlock removes a Host block (header + indented body) from SSH config content.
178// Returns the filtered content with a trailing newline.

Calls 4

filterSSHHostBlockFunction · 0.85
StatMethod · 0.65
ReadFileMethod · 0.65
WriteFileMethod · 0.65