MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / defaultLimitForSelection

Method defaultLimitForSelection

internal/ui/plugins/ansible/plugin.go:2537–2565  ·  view source on GitHub ↗
(node *api.Node, guest *api.VM, inventory coreansible.InventoryResult)

Source from the content-addressed store, hash-verified

2535}
2536
2537func (p *Plugin) defaultLimitForSelection(node *api.Node, guest *api.VM, inventory coreansible.InventoryResult) string {
2538 switch strings.ToLower(strings.TrimSpace(p.ansiblePluginConfig().DefaultLimitMode)) {
2539 case "none":
2540 return ""
2541 case "all":
2542 return "all"
2543 }
2544
2545 if guest != nil {
2546 for _, host := range inventory.Hosts {
2547 if host.Vars["pvetui_kind"] != "guest" {
2548 continue
2549 }
2550 if host.Vars["pvetui_guest_id"] == fmt.Sprintf("%d", guest.ID) && host.Vars["pvetui_node"] == guest.Node {
2551 return host.Alias
2552 }
2553 }
2554 }
2555
2556 if node != nil {
2557 for _, host := range inventory.Hosts {
2558 if host.Vars["pvetui_kind"] == "node" && host.Vars["pvetui_node"] == node.Name {
2559 return host.Alias
2560 }
2561 }
2562 }
2563
2564 return ""
2565}
2566
2567func (p *Plugin) mergeConfiguredAnsibleArgs(userArgs []string) []string {
2568 cfg := p.ansiblePluginConfig()

Callers 1

showMainMenuMethod · 0.95

Implementers 4

Plugininternal/ui/plugins/ansible/plugin.go
Plugininternal/ui/plugins/communityscripts/p
Plugininternal/ui/plugins/guestlist/plugin.g
Plugininternal/ui/plugins/commandrunner/plug

Calls 1

ansiblePluginConfigMethod · 0.95

Tested by

no test coverage detected