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

Cannot execresult when it contains bash command

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Rejected
    • Priority: (None)
    • Resolution: Done
    • Affects Version/s: 3.10.5, 3.12.1
    • Fix Version/s: None
    • Component/s: Built-in functions
    • Labels:
      None

      Description

      Consider the following promise

      bundle agent test {
        methods:
          "call" usebundle => my_command_run("/usr/bin/touch /tmp/rudder-test-$(date --iso-8601=second)");
      }
      
      bundle agent my_command_run(command) {
         vars:
            "result" string => execresult("${command}",   "useshell");
      
            "without_variable" string => execresult("/usr/bin/touch /tmp/rudder-test2-${const.dollar}(date --iso-8601=second)", "useshell");
      
        reports:
         "Executing command ${command}";
      
      }
      

       

      Result is

      cf-agent -KIf ./test.cf
      R: Executing command /usr/bin/touch /tmp/rudder-test-$(date --iso-8601=second)

       

      None of the execresult is executed - tried with ${const.dollar} to hide the fact that it is a variable, without success

       

      What is the correct way to make it work ?

       

      Thanks

       

        Attachments

          Activity

            People

            • Assignee:
              a10042 Nick Anderson
              Reporter:
              ncharles Nicolas Charles
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel