Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-299

edit_template problems in cfengine-community 3.4.1

    XMLWordPrintable

    Details

      Description

      I really like the edit_template feature, but there are some defects
      that are making it very hard to use. It deletes large blocks of text,
      and complains about syntax problems that are not related to the
      [%CFEngine tags or scaler variables.

      Version info:
      cfengine-community 3.4.1 (32_bit) - installed from the repo
      Ubuntu 12.04.1 LTS

      Here are the problems I see and also some enhancement requests.

      ----------
      1) "[text-text]" in templates causes error messages like the following:

      Regular expression error "range out of order in character class" in expression "$_CONFIG['CL-CRCOM']['WSDL'] = '/projects/foo/lib/utils/bar/ws/etc/FooServices.wsdl';" at 13

      However the output is OK, so I can just ignore the messages.

      Is there some undocumented processing that is going on? Because I
      don't get it--there is nothing that looks like cfengine scaler
      variables any where near these lines.

      ----------
      2) Parens, () in the template files cause problems, even when there no
      $ any where near them. Syntax errors are thrown, and processing of
      the template stops. To reproduce, take the initial php.ini file installed
      by the ubuntu php5 package (/etc/php5/apache2/php.ini) and try to make
      that into a template, with all the comments left in.

      My workaround was to strip all comments from the file.

      ----------
      3) Using edit_template (I also tried edit_line =>expand_template()) to
      process xml files, significant parts of the files are removed. Yes I
      know there is a new xml edit feature, but I have control over the xml
      format, so a simple line edit replacement is all I need.

      See the attached file (defect3.zip) for the before and after edits.

      My only workaround is to use "sed" to do the replacement, or more
      likely I'll just preformat the changes into different files and have
      cfengine pick the file, based on a class.

      ----------
      4) Enhancement request: provide a edit_template tag, similar to the
      BEGIN/END tags, where a block can be specified to be left AS-IS, with
      no processing at all. This feature would help with a workaround for
      defect #3, because I could put the AS-IS tags around the parts of the
      files that edit_template is deleting.

      ----------
      5) Enhancement request: Can an edit default option be added, so that
      edit_template does not remove blank lines? I would like to use
      template files that are read by people, blank lines make things more
      readable (e.g. a /etc/motd file).

        Attachments

        1. defect3.zip
          9 kB
        2. myfile
          0.1 kB
        3. mytemplate
          0.1 kB
        4. promises.cf
          0.2 kB

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                brafnel Bruce Rafnel
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: