Hi,

I have the below fabric script

#!/usr/bin/env python
from fabric.api import *

out_log = open("output.txt", "w")

with open("hosts.txt") as host_file:
        host_list = [x.strip() for x in host_file.readlines()]

@hosts(host_list)
def java_version():
        with settings(warn_only=True):
            version = run("java -version")
        out_log.write("%s: %s" % (env.host, version))
kaushal@kaushal-laptop:~$ fab ^C
kaushal@kaushal-laptop:~$ fab java_version
[10.30.0.10] Executing task 'java_version'
[10.30.0.10] run: java -version
Password for kaushal@10.30.0.10:
[10.30.0.10] err: java version "1.6.0_06"
[10.30.0.10] err: Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
[10.30.0.10] err: Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)

Done.
Disconnecting from 10.30.0.10... done.
kaushal@kaushal-laptop:~$ cat output.txt
10.30.0.10: kaushal@kaushal-laptop:~$

When i look at the output.txt i dont see the version name as against
the hostname. Please suggest/guide.

Regards,

Kaushal

_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to