[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14728 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14728 - gauger |
Date: |
Fri, 25 Mar 2011 16:19:04 +0100 |
Author: bartpolot
Date: 2011-03-25 16:19:04 +0100 (Fri, 25 Mar 2011)
New Revision: 14728
Modified:
gauger/gauger-cli.py
Log:
Added check option (just local checking so far), redirected error messages to
stderr
Modified: gauger/gauger-cli.py
===================================================================
--- gauger/gauger-cli.py 2011-03-25 15:13:45 UTC (rev 14727)
+++ gauger/gauger-cli.py 2011-03-25 15:19:04 UTC (rev 14728)
@@ -47,16 +47,18 @@
parser = arg_parser.ArgumentParser(description='Gauger client.')
parser.add_argument('-i', '--id',
help="identifier of the data, default: svn revision")
- parser.add_argument('-n', '--name', required=True,
+ parser.add_argument('-n', '--name',
help="name of the counter")
- parser.add_argument('-c', '--category', required=True,
+ parser.add_argument('-c', '--category',
help="category under which the counter will appear")
- parser.add_argument('-d', '--data', required=True,
+ parser.add_argument('-d', '--data',
help="value of the data itself")
parser.add_argument('-u', '--unit',
help="unit in which the data is expressed")
parser.add_argument('-p', '--port', type=int,
help="port on which to connect")
+ parser.add_argument('--check', action='store_true',
+ help="check if gauger is correctly configured and exit")
args = parser.parse_args()
return args
@@ -72,8 +74,15 @@
configfile = open(homefilename, "r")
remotehost, username, password = configfile.readline().strip().split()
except:
- print "please put 'remotehost username password' in gauger-cli.conf"
+ print >> sys.stderr, "please put 'remotehost username password' in
gauger-cli.conf"
exit(1)
+
+if(args.check):
+ exit(0)
+else:
+ if(not args.name or not args.data or not args.unit):
+ print >> sys.stderr, "NAME, DATA and UNIT are mandatory when sending
data to server"
+ exit(1)
if(args.id):
revision = args.id
@@ -81,8 +90,8 @@
revision = svnversion()
if (not revision):
- print "please make sure to be in a svn respoitory and have svn installed"
- print "or specify an identifier at runtime with the --id option"
+ print >> sys.stderr, "please make sure to be in a svn respoitory and have
svn installed"
+ print >> sys.stderr, "or specify an identifier at runtime with the --id
option"
exit(1)
if(args.unit):
@@ -102,7 +111,7 @@
try:
s1.connect((remotehost, port))
except:
- print "ERROR: Couldn't connect to", remotehost
+ print >> sys.stderr, "Couldn't connect to", remotehost
exit(1)
l1 = [username, password, revision]
l1.append(args.name);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14728 - gauger,
gnunet <=