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

Errors when findprocesses() and processexists() are used in the same bundle with the same string

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: 3.10.0b1, 3.12.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      I get errors when I use both functions in the same bundle

            bundle agent main
            {
              vars:
                  "d" data => findprocesses(".+agent.+");
      
              classes:
                 "found" expression => processexists(".+agent.+");
      
              reports:
                  found::
                    "The first matching pid is $(d[0][pid]) running $(d[0][line]).";
            }
      
               error: /home/nickanderson/org/cfengine3-21907rgy:0:0: In attribute 'expression', Context string is invalid/out of range. Given attribute value '[
              {
                "line": "nickand+ 31297 21907 31297  0.0  0.0  59432   0      8972    1 14:45       00:02 00:00:00 /var/cfengine/bin/cf-agent --no-lock --file /home/nickanderson/org/cfengine3-21907rgy",
                "pid": 31297
              },
              {
                "line": "nickand+  4289  4142  4289  0.0  0.0 166740   0      2968    1 Nov26  3-21:30:25 00:00:04 gpg-agent --homedir /home/nickanderson/.gnupg --use-standard-socket --daemon",
                "pid": 4289
              }
            ]'
               error: Fatal CFEngine error: Cannot continue
      

      Used independently things are fine.

            bundle agent main
            {
              classes:
                 "found" expression => processexists(".+agent.+");
      
              reports:
                  found::
                    "I found at least one process matching '.+agent.+'";
            }
      
            : R: I found at least one process matching '.+agent.+'
      
            bundle agent main
            {
              vars:
                  "d" data => findprocesses(".+agent.+");
      
              reports:
                  "The first matching pid is $(d[0][pid]) running $(d[0][line])."
                    if => isvariable(d);
      
            }
      
            : R: The first matching pid is 31656 running nickand+ 31656 21907 31656  0.3  0.0  59432   0      8972    1 14:49       00:03 00:00:00 /var/cfengine/bin/cf-agent --no-lock --file /home/nickanderson/org/cfengine3-21907dqB.
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              a10042 Nick Anderson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel