asteris-llc/converge

task.query behavior

Closed this issue · 2 comments

The below is not writing to the javaversion.txt file.
I see the output in standard out

task.query "javaversion" {
query = "/usr/bin/java -version"
}

file.content "javaversion-data" {
destination = "javaversion.txt"
content = "{{lookup task.query.javaversion.status.stdout}}"
}

root/task.query.javaversion:
Messages:
check (returned: 0)

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)

Has Changes: no
Changes: No changes

root/file.content.javaversion-data:
Messages:
Has Changes: yes
Changes:
javaversion.txt: "" => ""
mode: "not set" => "0600"

Summary: 0 errors, 1 changes

It looks like java -version prints it's info to stderr instead of stdout, this should fix it:

task.query "javaversion" {
query = "/usr/bin/java -version"
}

file.content "javaversion-data" {
destination = "javaversion.txt"
content = "{{lookup `task.query.javaversion.status.stderr`}}"
}

yup, that's it. thanks