feat: add host actions, lifecycle hooks and operational tools
This commit is contained in:
1 parent
8d4915543e
commit
e5bde9c61f
32 files changed
+2083
-64
No files matched your search
@@ -165,6 +165,15 @@ func BuildAliasEntries(entries []cache.Entry, cfg config.Config) []AliasEntry {
|
||||
// Build from the final SSH aliases, preserving per-instance prefix and
|
||||
// collision handling. Never replace an existing SSH or command alias.
|
||||
hostAliases := append([]AliasEntry(nil), out...)
|
||||
hostMetadata := map[string]config.SSHHost{}
|
||||
for _, e := range entries {
|
||||
instance, hostname, ok := strings.Cut(e.Name, "/")
|
||||
if !ok {
|
||||
hostname = instance
|
||||
instance = ""
|
||||
}
|
||||
hostMetadata[e.Name] = config.SSHHost{Instance: instance, Name: hostname, Kind: e.Kind, Tags: e.Tags}
|
||||
}
|
||||
var commands []string
|
||||
for name := range cfg.Commands {
|
||||
commands = append(commands, name)
|
||||
@@ -181,6 +190,9 @@ func BuildAliasEntries(entries []cache.Entry, cfg config.Config) []AliasEntry {
|
||||
if host.Host == "" {
|
||||
continue
|
||||
}
|
||||
if !cfg.Commands[name].Allowed(hostMetadata[host.Host]) {
|
||||
continue
|
||||
}
|
||||
alias := prefix + host.Name
|
||||
commandCounts[alias]++
|
||||
candidatesForCommands = append(candidatesForCommands, AliasEntry{Name: alias, Host: host.Host, Command: name})
|
||||
|
||||
Reference in new issue
Block a user