qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gmur...@apache.org
Subject qpid-dispatch git commit: DISPATCH-391 - Added back attributes missing for listener and connector
Date Thu, 16 Jun 2016 17:32:38 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 0a1ae2b93 -> 833986dae


DISPATCH-391 - Added back attributes missing for listener and connector


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/833986da
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/833986da
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/833986da

Branch: refs/heads/master
Commit: 833986dae01468d30c3833c27b54afea7ece5f8f
Parents: 0a1ae2b
Author: Ganesh Murthy <gmurthy@redhat.com>
Authored: Thu Jun 16 13:32:24 2016 -0400
Committer: Ganesh Murthy <gmurthy@redhat.com>
Committed: Thu Jun 16 13:32:24 2016 -0400

----------------------------------------------------------------------
 doc/man/qdrouterd_conf_man.py                   | 38 ++++++++++++++++----
 .../qpid_dispatch_internal/management/schema.py |  3 +-
 2 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/833986da/doc/man/qdrouterd_conf_man.py
----------------------------------------------------------------------
diff --git a/doc/man/qdrouterd_conf_man.py b/doc/man/qdrouterd_conf_man.py
index b627a51..7358b44 100644
--- a/doc/man/qdrouterd_conf_man.py
+++ b/doc/man/qdrouterd_conf_man.py
@@ -34,6 +34,7 @@ class ManPageWriter(SchemaWriter):
     def __init__(self):
         super(ManPageWriter, self).__init__(sys.stdout, QdSchema())
         self.sslProfileAttributes = []
+        self.connectionRoleAddrPortAttrs = {}
 
     def attribute_type(self, attr, holder):
         # Don't show read-only attributes
@@ -41,11 +42,37 @@ class ManPageWriter(SchemaWriter):
             return
         super(ManPageWriter, self).attribute_type(attr, holder, show_create=False, show_update=False)
 
-    def is_entity_connector_or_listener(self, entity):
-        if CONNECTOR == entity.name or LISTENER == entity.name:
+    def is_entity_connector_or_listener(self, entity_type):
+        if CONNECTOR == entity_type.name or LISTENER == entity_type.name:
             return True
         return False
 
+    def add_connector_listener_attributes(self, entity_type):
+
+        # Artificially add an sslProfile
+        ssl_profile_attr = AttributeType("sslProfile", type="string", defined_in=entity_type,
+                                         create=True, update=True, description="name of the
sslProfile ")
+
+        entity_type.attributes[u'sslProfile'] = ssl_profile_attr
+
+        name_attr = entity_type.attributes.get(u'name')
+
+        # We modify this defined_by because otherwise the name does not show up in the doc
+        name_attr.defined_in = entity_type
+
+        # We will have to add the connectionRole and addrPort attributes to listener and
connector entities
+        # so that they show up in the man doc page.
+        for attr in self.connectionRoleAddrPortAttrs.keys():
+            annotation = self.connectionRoleAddrPortAttrs.get(attr)
+
+            for key in annotation.attributes.keys():
+                annotation_attr = annotation.attributes.get(key)
+                if not annotation_attr.deprecated:
+                    attr_type = AttributeType(key, type=annotation_attr.type,
+                                              defined_in=entity_type,
+                                              create=True, update=True, description=annotation_attr.description)
+                    entity_type.attributes[key] = attr_type
+
     def man_page(self):
         self.writeln(r"""
 :orphan:
@@ -132,7 +159,8 @@ attribute of 'sslProfile' sections.
                 # We are skipping connectionRole and addrPort annotations from the doc because
it is
                 # confusing to the user
                 if "addrPort" in annotation.name or "connectionRole" in annotation.name:
-                        continue
+                    self.connectionRoleAddrPortAttrs[annotation.short_name] = annotation
+                    continue
                 used_by = [e.short_name for e in self.schema.entity_types.itervalues()
                            if annotation in e.annotations]
                 with self.section(annotation.short_name):
@@ -159,9 +187,7 @@ attribute of 'sslProfile' sections.
                 if self.is_entity_connector_or_listener(entity_type):
                     for sslProfileAttribute in self.sslProfileAttributes:
                         del entity_type.attributes[sslProfileAttribute]
-                    ssl_profile_attr = AttributeType("sslProfile", type="string", defined_in=entity_type,
-                                                     create=True, update=True, description="name
of the sslProfile ")
-                    entity_type.attributes[u'sslProfile'] = ssl_profile_attr
+                    self.add_connector_listener_attributes(entity_type)
 
                 if config in entity_type.all_bases:
                     with self.section(entity_type.short_name):

http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/833986da/python/qpid_dispatch_internal/management/schema.py
----------------------------------------------------------------------
diff --git a/python/qpid_dispatch_internal/management/schema.py b/python/qpid_dispatch_internal/management/schema.py
index caf8f09..82bbdf2 100644
--- a/python/qpid_dispatch_internal/management/schema.py
+++ b/python/qpid_dispatch_internal/management/schema.py
@@ -215,8 +215,9 @@ class AttributeType(object):
         """
         try:
             self.name = name
+            self.type = type
             self.defined_in = defined_in
-            self.atype = get_type(type)
+            self.atype = get_type(self.type)
             self.required = required
             self.hidden = hidden
             self.deprecated = deprecated


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message