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

Integer out of range when using irange with Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.2
    • Component/s: Promise type: files
    • Labels:
      None

      Description

      Hi,

      I'm using irange to check the age of a file, and based on that, it defines a class
      Here is the code snippet:
      <pre>
      files:

      1. The aim of this promise is to create a class when this file is older
      2. than one hour. The class can not be created without touching but in
      3. order to not modifing the mtime we use WarnOnly.
        "${sys.workdir}/last_successful_inputs_update"
        file_select => over_an_hour,
        touch => "true",
        action => WarnOnly,
        classes => success("last_successful_inputs_update_too_old", "last_successful_inputs_update_check_error", "last_successful_inputs_update_ok");
        }

      body file_select over_an_hour()
      {

      1. Select file which are older than one hour
      2. Use of positive mtime instead of negative one
      3. In order to avoid corner effects
        mtime => irange(ago(0,0,0,1,0,0), now);
        file_result => "!mtime";
        }
        </pre>

      It used to work fine, and then suddently it didn't (end of august, and then during all september). I am suspecting an issue with the date format (my Windows as US locale) (i've been waiting before reporting to check if it would repair itself or not based on the date)

      Here is the output of the promise
      <pre>
      PS C:\Users\Administrator> cf-agent.exe -KIf failsafe.cf
      2014-09-28T07:23:05Romance Daylight Time error: /default/check_lock_db_problem/files: Fatal CFEngine error: In function 'irange', 'Integer is out of range'
      2014-09-28T07:23:05Romance Daylight Time error: Policy failed validation with command '"C:\Program Files\Cfengine\bin\cf-promises.exe" -c "C:\Program Files\Cfengine\inputs\failsafe.cf"'
      </pre>

      Version is:
      <pre>
      PS C:\Users\Administrator> cf-agent.exe -V
      CFEngine Core 3.6.1.5666e17
      CFEngine Enterprise 3.6.1.e9fc5b3
      </pre>

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                a10040 Kristian Amlie
                Reporter:
                ncharles Nicolas Charles
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel