Approved for 0.14.

On Fri, 18 Nov 2011, Ken Giusti wrote:

I +1 this change....

----- Original Message -----
Justin,

I'd like to get this commit backported to the 0.14 branch.  Can you
take
a quick look at it?

Thanks,

-Ted

-------- Original Message --------
Subject:        svn commit: r1203649 -
/qpid/trunk/qpid/tools/src/py/qmf-tool
Date:   Fri, 18 Nov 2011 13:48:29 -0000
From:   [email protected]
Reply-To:       [email protected]
To:     [email protected]



Author: tross
Date: Fri Nov 18 13:48:28 2011
New Revision: 1203649

URL:http://svn.apache.org/viewvc?rev=1203649&view=rev
Log:
NO-JIRA - Converted connection-options in qmf-tool from string to
map.
When the wrapped Python API was updated to match the pure Python API,
the connection options
were changed from the (c++)-style string to the python-style keyword
args.  This update
adapts qmf-tool to this change.

Modified:
     qpid/trunk/qpid/tools/src/py/qmf-tool

Modified: qpid/trunk/qpid/tools/src/py/qmf-tool
URL:http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qmf-tool?rev=1203649&r1=1203648&r2=1203649&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qmf-tool (original)
+++ qpid/trunk/qpid/tools/src/py/qmf-tool Fri Nov 18 13:48:28 2011
@@ -56,7 +56,7 @@ class OptsAndArgs(object):

    def parse(self):
      host = "localhost"
-    conn_options = []
+    conn_options = {}
      qmf_options = []

      options, encArgs =
      self.option_parser.parse_args(args=self.argv)
@@ -70,23 +70,23 @@ class OptsAndArgs(object):
        host = args[1]

      if options.user:
-      conn_options.append("username:'%s'" % options.user)
+      conn_options["username"] = options.user
      if options.password:
-      conn_options.append("password:'%s'" % options.password)
+      conn_options["password"] = options.password
      if options.transport:
-      conn_options.append("transport:'%s'" % options.transport)
+      conn_options["transport"] = options.transport
      if options.mechanism:
-      conn_options.append("sasl_mechanisms:'%s'" %
options.mechanism)
+      conn_options["sasl_mechanisms"] = options.mechanism
      if options.service:
-      conn_options.append("sasl_service:'%s'" % options.service)
+      conn_options["sasl_service"] = options.service
      if options.min_ssf:
-      conn_options.append("sasl_min_ssf:%d" % options.min_ssf)
+      conn_options["sasl_min_ssf"] = options.min_ssf
      if options.max_ssf:
-      conn_options.append("sasl_max_ssf:%d" % options.max_ssf)
+      conn_options["sasl_max_ssf"] = options.max_ssf
      for x in options.conn_option:
        try:
          key, val = x.split('=')
-        conn_options.append("%s:%s" % (key, val))
+        conn_options[key] = val
        except:
          raise Exception("Improperly formatted text for
          --conn-option: '%s'" % x)

@@ -101,16 +101,6 @@ class OptsAndArgs(object):
        except:
          raise Exception("Improperly formatted text for
          --qmf-option: '%s'" % x)

-    conn_string = '{'
-    first = True
-    for x in conn_options:
-      if first:
-        first = None
-      else:
-        conn_string += ','
-      conn_string += x
-    conn_string += '}'
-
      qmf_string = '{'
      first = True
      for x in qmf_options:
@@ -121,7 +111,7 @@ class OptsAndArgs(object):
        qmf_string += x
      qmf_string += '}'

-    return host, conn_string, qmf_string
+    return host, conn_options, qmf_string



@@ -740,15 +730,12 @@ class QmfData:
      return result

    def scrubConnOptions(self):
-    pw = self.conn_options.find('password:')
-    if pw<  0:
-      return self.conn_options
-    scrubbed = self.conn_options[:pw + 9] + "***"
-    delim = self.conn_options[pw:].find(',')
-    if delim<  0:
-      delim = self.conn_options[pw:].find('}')
-    scrubbed += self.conn_options[pw + delim:]
-    return scrubbed
+    scrubbed = {}
+    for key, val in self.conn_options.items():
+      if key == "password":
+        val = "***"
+      scrubbed[key] = val
+    return str(scrubbed)


  #=========================================================



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:http://qpid.apache.org
Use/Interact:mailto:[email protected]



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to