We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have some code as following:
func CheckAssetsConnectivityManual(ctx context.Context, adminUser, password, hosts string) { buff := new(bytes.Buffer) ansibleConnectionOptions := &options.AnsibleConnectionOptions{ User: adminUser, } ansibleAdhocOptions := &adhoc.AnsibleAdhocOptions{ Inventory: hosts, ModuleName: "ping", //ModuleName: "setup", } // install sshpass ansibleAdhocOptions.AddExtraVar("ansible_password", password) executor := execute.NewDefaultExecute( execute.WithWrite(io.Writer(buff)), ) adhoc := &adhoc.AnsibleAdhocCmd{ Pattern: "all", Options: ansibleAdhocOptions, ConnectionOptions: ansibleConnectionOptions, Exec: executor, StdoutCallback: "json", } err := adhoc.Run(ctx) if err != nil { log.Println(err.Error()) } log.Println(" ------ ===== buff: ", string(buff.Bytes())) res, err := results.JSONParse(buff.Bytes()) if err != nil { log.Println(err.Error()) } log.Println(" ---- res : ", res.String()) }
res, err := results.JSONParse(buff.Bytes())
panic.
The text was updated successfully, but these errors were encountered:
hi @wahello! I updated simple-ansibleadhoc to use json stdout callback, and it finishes properly. (simple-ansibleadhoc has been updated on my local host)
json
❯ go run simple-ansibleadhoc.go ansible all --inventory 127.0.0.1, --module-name ping --connection local [127.0.0.1] (ping) Host: 127.0.0.1 Changed: 0 Failures: 0 Ignored: 0 Ok: 1 Rescued: 0 Skipped: 0 Unreachable: 0
Can you share the panic's output?
Thanks!
Sorry, something went wrong.
hi @wahello! There is any update about you issue?
@wahello since there is any update about your issue, I am going to close it. In case you need anything else, just open a new issue! Thanks
No branches or pull requests
I have some code as following:
res, err := results.JSONParse(buff.Bytes())
panic.
The text was updated successfully, but these errors were encountered: