Modify

Ticket #1046 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

Docs incorrectly refer to metadata.Properties[<filepath>].data

Reported by: cpennington@… Owned by: solj
Priority: minor Milestone: Bcfg2 1.2.0 Release
Component: bcfg2-doc Version: 1.0
Keywords: Cc: sol.jerome@…

Description

The .data member of PropertyFile? no longer exists. Instead, .xdata contains the lxml elements that .data used to contain.

Attachments

Change History

comment:1 Changed 10 years ago by Calen Pennington <cpennington@…>

The following docs reference .data as xml:

  • doc/development/plugins.txt
  • doc/server/plugins/generators/tcheetah.txt
  • doc/server/plugins/generators/tgenshi/clientsxml.txt
  • doc/server/plugins/generators/tgenshi/test.txt

comment:2 Changed 10 years ago by Calen Pennington <cpennington@…>

The following docs reference .data as xml:

  • doc/development/plugins.txt
  • doc/server/plugins/generators/tcheetah.txt
  • doc/server/plugins/generators/tgenshi/clientsxml.txt
  • doc/server/plugins/generators/tgenshi/test.txt

comment:3 Changed 10 years ago by solj

  • Cc sol.jerome@… added
  • Owner changed from desai to solj
  • Status changed from new to accepted
  • Component changed from bcfg2-server to bcfg2-doc
  • Priority changed from major to minor

Does this cover everything that you found?

diff --git a/doc/development/plugins.txt b/doc/development/plugins.txt
index e6a5a73..15b5123 100644
--- a/doc/development/plugins.txt
+++ b/doc/development/plugins.txt
@@ -175,7 +175,7 @@ Example Connector
         def get_additional_data(self, metadata):
 
             mydata = {}
-            for data in self.store.entries['foo.xml'].data.get("foo", []):
+            for data in self.store.entries['foo.xml'].xdata.get("foo", []):
 
                 mydata[data] = "bar"
 
diff --git a/doc/server/plugins/generators/tcheetah.txt b/doc/server/plugins/generators/tcheetah.txt
index ef8bb55..29fd7af 100644
--- a/doc/server/plugins/generators/tcheetah.txt
+++ b/doc/server/plugins/generators/tcheetah.txt
@@ -28,7 +28,7 @@ files, ``template`` and ``info``. The template is a standard Cheetah
 template with two additions:
 
 * `self.metadata` is the client's :ref:`metadata <server-plugins-grouping-metadata-clientmetadata>`
-* `self.metadata.Properties.data` is an xml document of unstructured data
+* `self.metadata.Properties.xdata` is an xml document of unstructured data
 
 The ``info`` file is formatted like ``:info`` files from Cfg.
 
@@ -47,7 +47,7 @@ self.metadata variables
 self.metadata is an instance of the class ClientMetadata and documented
 :ref:`here <server-plugins-grouping-metadata-clientmetadata>`.
 
-self.metadata.Properties.data
+self.metadata.Properties.xdata
 =============================
 
 .. note::
@@ -56,7 +56,7 @@ self.metadata.Properties.data
     :ref:`server-plugins-connectors-properties` plugin in
     ``/etc/bcfg2.conf``.
 
-Properties.data is a python `ElementTree <http://codespeak.net/lxml/>`_
+Properties.xdata is a python `ElementTree <http://codespeak.net/lxml/>`_
 object, loaded from the data in ``/var/lib/bcfg2/Properties/<properties
 file>.xml``. That file should have a ``Properties`` node at its root.

@@ -76,13 +76,13 @@ You may use any of the ElementTree methods to access data in your
 template.  Several examples follow, each producing an identical result
 on the host 'www.example.com'::
 
-    $self.metadata.Properties['example.xml'].data.find('host').find('www.example.com').find('rootdev').text
-    $self.metadata.Properties['example.xml'].data.find('host').find($self.metadata.hostname).find('rootdev').text
-    ${self.metadata.Properties['example.xml'].data.xpath('host/www.example.com/rootdev')[0].text}
-    ${self.metadata.Properties['example.xml'].data.xpath('host/' + self.metadata.hostname + '/rootdev')[0].text}
+    $self.metadata.Properties['example.xml'].xdata.find('host').find('www.example.com').find('rootdev').text
+    $self.metadata.Properties['example.xml'].xdata.find('host').find($self.metadata.hostname).find('rootdev').text
+    ${self.metadata.Properties['example.xml'].xdata.xpath('host/www.example.com/rootdev')[0].text}
+    ${self.metadata.Properties['example.xml'].xdata.xpath('host/' + self.metadata.hostname + '/rootdev')[0].text}
     #set $path = 'host/' + $self.metadata.hostname + '/rootdev'
-    ${self.metadata.Properties['example.xml'].data.xpath($path)[0].text}
-    ${self.metadata.Properties['example.xml'].data.xpath(path)[0].text}
+    ${self.metadata.Properties['example.xml'].xdata.xpath($path)[0].text}
+    ${self.metadata.Properties['example.xml'].xdata.xpath(path)[0].text}
 
 Other Variables
 ===============
diff --git a/doc/server/plugins/generators/tgenshi/clientsxml.txt b/doc/server/plugins/generators/tgenshi/clientsxml.txt
index 7305ba7..7a8d1fc 100644
--- a/doc/server/plugins/generators/tgenshi/clientsxml.txt
+++ b/doc/server/plugins/generators/tgenshi/clientsxml.txt
@@ -22,7 +22,7 @@ There are two main advantages:
    thing to note is how the `name` variable is handled - when
    just referring to it the standard `${name}` syntax is used, but
    when it is used as a variable in the expression to get the password,
-   `password="${metadata.Properties['passwords.xml'].data.find('password').find('bcfg2-client').find(name).text}"`,
+   `password="${metadata.Properties['passwords.xml'].xdata.find('password').find('bcfg2-client').find(name).text}"`,
    it is just referred to as `name`.
 
 There is the disadvantage that sometimes 2 passes will be needed to get
@@ -53,7 +53,7 @@ Possible improvements:
                profile="${profile}"
                name="${name}"
                uuid="${name}"
-               password="${metadata.Properties['passwords.xml'].data.find('password').find('bcfg2-client').find(name).text}"
+               password="${metadata.Properties['passwords.xml'].xdata.find('password').find('bcfg2-client').find(name).text}"
                address="${address}"
                location="fixed"
                secure="true"
@@ -64,7 +64,7 @@ Possible improvements:
                profile="${profile}"
                name="${name}"
                uuid="${name}"
-               password="${metadata.Properties['passwords.xml'].data.find('password').find('bcfg2-client').find(name).text}"
+               password="${metadata.Properties['passwords.xml'].xdata.find('password').find('bcfg2-client').find(name).text}"
                location="floating"
                secure="true"
            />\
diff --git a/doc/server/plugins/generators/tgenshi/test.txt b/doc/server/plugins/generators/tgenshi/test.txt
index dca5784..c047b88 100644
--- a/doc/server/plugins/generators/tgenshi/test.txt
+++ b/doc/server/plugins/generators/tgenshi/test.txt
@@ -45,8 +45,8 @@ This file just shows you what's available. It assumes a
     {% end %}\
 
     Two main ways to get the same property value:
-    ${metadata.Properties['test.xml'].data.find('password').find('bcfg2').text}
-    ${metadata.Properties['test.xml'].data.xpath('password/bcfg2')[0].text}
+    ${metadata.Properties['test.xml'].xdata.find('password').find('bcfg2').text}
+    ${metadata.Properties['test.xml'].xdata.xpath('password/bcfg2')[0].text}
 
     One way to get information about metadata and properties:
 
@@ -55,28 +55,28 @@ This file just shows you what's available. It assumes a
     ${var} \
     {% end %}

-    dir(metadata.Properties.data):
-    {% for var in dir(metadata.Properties.data) %}\
+    dir(metadata.Properties.xdata):
+    {% for var in dir(metadata.Properties.xdata) %}\
     ${var} \
     {% end %}
 
-    dir(metadata.Properties.data.entries):
-    {% for var in dir(metadata.Properties.data.entries) %}\
+    dir(metadata.Properties.xdata.entries):
+    {% for var in dir(metadata.Properties.xdata.entries) %}\
     ${var} \
     {% end %}
 
-    dir(metadata.Properties.data.label):
-    {% for var in dir(metadata.Properties.data.label) %}\
+    dir(metadata.Properties.xdata.label):
+    {% for var in dir(metadata.Properties.xdata.label) %}\
     ${var} \
     {% end %}
 
-    dir(metadata.Properties.data.name):
-    {% for var in dir(metadata.Properties.data.name) %}\
+    dir(metadata.Properties.xdata.name):
+    {% for var in dir(metadata.Properties.xdata.name) %}\
     ${var} \
     {% end %}
 
-    dir(metadata.Properties.data.properties):
-    {% for var in dir(metadata.Properties.data.properties) %}\
+    dir(metadata.Properties.xdata.properties):
+    {% for var in dir(metadata.Properties.xdata.properties) %}\
     ${var} \
     {% end %}

@@ -113,13 +113,13 @@ this (below reformatted a little bit to fit in 80 columns)::
      __weakref__ all bundles categories get_clients_by_group get_clients_by_profile
      groups hostname inGrouppassword probes uuid
 
-    dir(metadata.Properties.data):
+    dir(metadata.Properties.xdata):
     HandleEvent Index __class__ __delattr__ __dict__ __doc__ __getattribute__
      __hash__ __identifier__ __init__ __iter__ __module__ __new__ __reduce__
      __reduce_ex__ __repr__ __setattr__ __str__ __weakref__ entries label name
      properties
 
-    dir(metadata.Properties.data.entries):
+    dir(metadata.Properties.xdata.entries):
     __add__ __class__ __contains__ __delattr__ __delitem__ __delslice__ __doc__
      __eq__ __ge__ __getattribute__ __getitem__ __getslice__ __gt__ __hash__
      __iadd__ __imul__ __init__ __iter__ __le__ __len__ __lt__ __mul__ __ne__
@@ -127,7 +127,7 @@ this (below reformatted a little bit to fit in 80 columns)::
      __setitem__ __setslice__ __str__ append count extend index insert pop remove
      reverse sort
 
-    dir(metadata.Properties.data.label):
+    dir(metadata.Properties.xdata.label):
     __add__ __class__ __contains__ __delattr__ __doc__ __eq__ __ge__
      __getattribute__ __getitem__ __getnewargs__ __getslice__ __gt__ __hash__
      __init__ __le__ __len__ __lt__ __mod__ __mul__ __ne__ __new__ __reduce__
@@ -137,7 +137,7 @@ this (below reformatted a little bit to fit in 80 columns)::
      rfind rindex rjust rpartition rsplit rstrip split splitlinesstartswith strip
      swapcase title translate upper zfill
 
-    dir(metadata.Properties.data.name):
+    dir(metadata.Properties.xdata.name):
     __add__ __class__ __contains__ __delattr__ __doc__ __eq__ __ge__
      __getattribute__ __getitem__ __getnewargs__ __getslice__ __gt__ __hash__
      __init__ __le__ __len__ __lt__ __mod__ __mul__ __ne__ __new__ __reduce__
@@ -147,7 +147,7 @@ this (below reformatted a little bit to fit in 80 columns)::
      rfind rindex rjust rpartition rsplit rstrip split splitlinesstartswith strip
      swapcase title translate upper zfill
 
-    dir(metadata.Properties.data.properties):
+    dir(metadata.Properties.xdata.properties):
     __class__ __contains__ __copy__ __deepcopy__ __delattr__ __delitem__
      __delslice__ __doc__ __getattribute__ __getitem__ __getslice__ __hash__
      __init__ __iter__ __len__ __new__ __nonzero__ __reduce__ __reduce_ex__

comment:4 Changed 10 years ago by Calen Pennington <cpennington@…>

Yes, I think that covers everything.

comment:5 Changed 10 years ago by solj

  • Status changed from accepted to closed
  • Resolution set to fixed

Fixed in d28bea2d1991b76a05702638ce7f42c92b219665. Thanks for the bug report!

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.