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

exec_timeout does not work when combined with useshell => "true" in contain bodies

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Higher
    • Resolution: Unresolved
    • Affects Version/s: 3.20.0
    • Fix Version/s: None
    • Labels:
      None

      Description

      commands promises can use exec_timeout in contain bodies to control individual promise timeout, but note that does not work when combined with useshell.

      Example Policy
      bundle agent example_execresult
      {
        vars:
        commands:
            "/bin/sleep 10"
              contain => timeout_without_useshell( 1 );
      
             "/bin/sleep 10"
              contain => timeout_with_useshell( 1 );
      }
      body contain timeout_with_useshell( seconds )
      {
              useshell => "true";
              exec_timeout => "$(seconds)";
      }
      body contain timeout_without_useshell( seconds )
      {
              exec_timeout => "$(seconds)";
      }
      bundle agent __main__
      {
        methods:
            "example_execresult";
      }
      
      2022-08-02T12:38:06-0500     info: Executing 'timeout=1s' ... '/bin/sleep 10'
      2022-08-02T12:38:07-0500    error: Finished script '/bin/sleep 10' - failed (abnormal termination)
      2022-08-02T12:38:07-0500     info: Completed execution of '/bin/sleep 10'
      2022-08-02T12:38:07-0500     info: Executing 'timeout=1s' ... '/bin/sleep 10'
      2022-08-02T12:38:17-0500    error: Finished script '/bin/sleep 10' - failed (abnormal termination)
      2022-08-02T12:38:17-0500     info: Completed execution of '/bin/sleep 10'
      2022-08-02T12:38:17-0500    error: Method 'example_execresult' failed in some repairs

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: