stream.py: Make usage() function return a string.
authorEthan Jackson <ethan@nicira.com>
Mon, 26 Sep 2011 23:02:14 +0000 (16:02 -0700)
committerEthan Jackson <ethan@nicira.com>
Tue, 27 Sep 2011 21:50:26 +0000 (14:50 -0700)
This will marginally simplify a future patch.

python/ovs/stream.py
tests/test-jsonrpc.py

index 5180642..3bb0c10 100644 (file)
@@ -302,14 +302,10 @@ class PassiveStream(object):
         self.socket.close()
 
 
-def usage(name, active, passive):
-    print
-    if active:
-        print("Active %s connection methods:" % name)
-        print("  unix:FILE               "
-               "Unix domain socket named FILE")
-
-    if passive:
-        print("Passive %s connection methods:" % name)
-        print("  punix:FILE              "
-              "listen on Unix domain socket FILE")
+def usage(name):
+    return """
+Active %s connection methods:
+  unix:FILE               Unix domain socket named FILE
+
+Passive %s connection methods:
+  punix:FILE              Listen on Unix domain socket FILE""" % (name, name)
index 9da3bd2..5ce45ad 100644 (file)
@@ -212,7 +212,7 @@ usage: %s [OPTIONS] COMMAND [ARG...]
   request REMOTE METHOD PARAMS   send request, print reply
   notify REMOTE METHOD PARAMS  send notification and exit
 """ % (ovs.util.PROGRAM_NAME, ovs.util.PROGRAM_NAME))
-    ovs.stream.usage("JSON-RPC", True, True)
+    sys.stdout.write(ovs.stream.usage("JSON-RPC") + "\n")
     ovs.daemon.usage()
     sys.stdout.write("""
 Other options: