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

usemodule reports success if module returns none-zero

    XMLWordPrintable

    Details

    • Platform:
      Linux

      Description

      In this example, I believe that the ok class should not be set.

      body common control
      {
              bundlesequence => { "main", };
          inputs => { "lib/3.5/files.cf", "lib/3.5/common.cf" };
      }
      
      bundle agent main
      {
          methods:
              "init" usebundle => init;
              "go" usebundle => runmod;
      }
      
      bundle agent init
      {
          vars:
          "mod" string =>
      "#!/bin/sh
      echo '=mystring=foo99'
      exit 1
      ";
      
          files:
              "${sys.workdir}/modules/foo"
                  create        => 'true',
                  perms         => m("700"),
                  edit_defaults => empty,
                  edit_line     => append_if_no_line( "${mod}" );
      }
      
      bundle agent runmod
      {
          classes:
              "ok" expression =>$ cf-agent -IKf ./mod.cf 
      2013-10-21T09:53:24-0400   notice: R: Module promise kept
       usemodule( "foo", "" );
      
          reports:
              ok::$ cf-agent -IKf ./mod.cf 
      2013-10-21T09:53:24-0400   notice: R: Module promise kept
      
                  "Module promise kept";
              !ok::
                  "Module promise failed";
      
      }
      
      $ cf-agent -IKf ./mod.cf 
      2013-10-21T09:53:24-0400   notice: R: Module promise kept
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              neilhwatson Neil Watson
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Summary Panel