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

Cannot use regextract with string containing ${text} where text is not a cfengine variable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 3.6.x, 3.7.5, 3.10.1
    • Fix Version/s: None
    • Component/s: Evaluation
    • Labels:
      None

      Description

      Regextract cannot extract content from string containing ${} if it's not a known cfengine variable - it simply doesn't do anything

       

      "extracted" expression => regextract("(.*\s+)?(ssh-rsa|ssh-dss)\s+(\S+)", "from=\"host.fqdn\",command=\"sudo ${SSH_ORIGINAL_COMMAND}\" ssh-rsa some_key", "result");

      results in nothing - extracted is not defined and nothing is extracted

      I tried with ${const.dollar}{SSH_ORIGINAL_COMMAND} to no avail, and tried with various numbers of const.dollar to see if there was a limit in evaluation (like ${const.dollar}{const.dollar}{const.dollar}{const.dollar}{const.dollar}{SSH_ORIGINAL_COMMAND} ) - and still doesn't do anything.

      Debug output doesn't help either.

       

      Removing the { } makes the regextract works

       

      See atteched file for a self contained example.

        Attachments

          Activity

            People

            • Assignee:
              a10003 Eystein Maloy Stenberg
              Reporter:
              ncharles Nicolas Charles
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel