restore simple_cnf/add_single API
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Mon, 5 Nov 2018 08:21:49 +0000 (09:21 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Mon, 5 Nov 2018 11:21:05 +0000 (12:21 +0100)
Restore an API that vanished at some point despite there still
being users.

This is commit fa747d25a7c47a1ceef165c4e1667b9755c9da0d on
autotest/i2n. The original commit message in full:

    In

        commit 5f6735c41fc769ac9ba6ee62754ab2b7da3d68d2
        Author: Christian Herdtweck <christian.herdtweck@intra2net.com>
        Date:   Wed Apr 5 18:14:02 2017 +0200

            Extend SimpleCnf.add_single to SimpleCnf.add

    this ApI was folded into .add() without providing an overload for
    downstream consumers. Provide the symbol again as a thin wrapper
    around .add() and hope for the behavior to remain unaffected.

src/simple_cnf.py

index eea501e..96dc5b2 100644 (file)
@@ -314,6 +314,16 @@ class SimpleCnf(object):
             new_var['children'] = children   # only add if non-empty
         self.__cnfvars.append(new_var)
 
+
+    def add_single(self, varname, data=u'', number=None):
+        """
+        Add a single cnf var to config on top level.
+
+        Compatibility API.
+        """
+        return self.add (varname, data=data, number=number)
+
+
     def append_file_generic(self, reader, cnf, replacements=None):
         """
         Append conf var data from file.