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

Method RunPingStream

internal/plugins/ansible/runner.go:84–105  ·  view source on GitHub ↗

RunPingStream executes `ansible -m ping` and streams output lines when handler is provided.

(
	ctx context.Context,
	inventoryText,
	inventoryFormat,
	limit string,
	extraArgs []string,
	handler OutputLineHandler,
)

Source from the content-addressed store, hash-verified

82
83// RunPingStream executes `ansible -m ping` and streams output lines when handler is provided.
84func (r *Runner) RunPingStream(
85 ctx context.Context,
86 inventoryText,
87 inventoryFormat,
88 limit string,
89 extraArgs []string,
90 handler OutputLineHandler,
91) CommandResult {
92 inventoryPath, cleanup, err := writeTempInventory(inventoryText, inventoryFormat)
93 if err != nil {
94 return CommandResult{Err: fmt.Errorf("create temp inventory: %w", err)}
95 }
96 defer cleanup()
97
98 args := buildAdhocArgs(inventoryPath, AdhocOptions{
99 Pattern: "all",
100 Module: "ping",
101 Limit: limit,
102 ExtraArgs: extraArgs,
103 })
104 return runAnsibleCommand(ctx, r.env, args, handler)
105}
106
107// RunInventoryList resolves an inventory source with ansible-inventory --list.
108func (r *Runner) RunInventoryList(ctx context.Context, inventory InventoryResult) CommandResult {

Callers 1

RunPingMethod · 0.95

Calls 3

writeTempInventoryFunction · 0.85
buildAdhocArgsFunction · 0.85
runAnsibleCommandFunction · 0.85

Tested by

no test coverage detected