fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] fab java_version


From: Christian Vest Hansen
Subject: Re: [Fab-user] fab java_version
Date: Wed, 1 Jun 2011 09:57:16 +0200

Looks like the output of java -version is printed to stderr and not stdout. This output should be accessible from the stderr attribute of the return value of run: version.stderr.

There is more information in the documentation here:
http://docs.fabfile.org/en/1.0.1/api/core/operations.html#fabric.operations.run
and here:
http://docs.fabfile.org/en/1.0.1/usage/interactivity.html#combine-streams

I hope this helps.

On Wed, Jun 1, 2011 at 05:15, Kaushal Shriyan <address@hidden> wrote:
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))
address@hidden:~$ fab ^C
address@hidden:~$ fab java_version
[10.30.0.10] Executing task 'java_version'
[10.30.0.10] run: java -version
Password for address@hidden:
[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.
address@hidden:~$ cat output.txt
10.30.0.10: address@hidden:~$

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
address@hidden
https://lists.nongnu.org/mailman/listinfo/fab-user



--
Venlig hilsen / Kind regards,
Christian Vest Hansen.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]