4 Replies Latest reply on Feb 25, 2013 3:03 AM by pigeon

    Rules and Dates confusion


      I'm creating a custom package to distribute one file.

      In terms of rules;

      • I want the package to deploy if either the file doesn't exist or is the wrong modified date.
      • I want the package to know its installed if it can find the file and the modified date is what's expected.


      So here's my Applicability Rule.



      NB: The 2 different dates. The Modified Date in the Editor is Different to the displayed Rule Date. It is the UTC conversion of the displayed date which is the correct date for my region.

      Also note the Rule Editor shows and saves a Modified Date but the display of Applicability Rules once set and saved shows a Creation Date setting a Modified rule.



      Here's the Installed Rule.



      NB: The 2 different dates. The Modified Date in the Editor is correct modified date but the displayed Rule Date is incorrect. It's assuming the date is a UTC and displaying the region converted date.


      The behaviour is not consistent between the two rule sets. I can't tell which date is the actual date that's going to be compared.

      The fact that one of the rules may be comparing the Creation date instead of the Modified date is also confusing.


      Can someone please take a look at this and see if this experince is consistant within your own environment.

        • Re: Rules and Dates confusion
          Andrew M

          The times appear consistent for me - it doesn't appear that there is any UTC correction occurring, but the wording in the graphical rule view has the same inconsistency as yours. I am fairly certain that this is only cosmetic, though. If you view the XML its apparent that the comparison is using the modified date. I'm running the latest version 1.85.474.0


          <bar:FileModified Path="X"Csidl="0"Comparison="EqualTo"Modified="2013-02-21T00:00:00"/>


          <bar:FileExists Path="X"Csidl="0"Modified="2013-02-21T00:00:00"/>

            • Re: Rules and Dates confusion

              Hi Andrew

              I think might have to upgrade. I'm on 1.80.785.


              In the Rule Editor I see 20/02/2013 11:29 AM

              In the Package Wizard Applicabilities Rule view I see 20/02/2013 7:29 PM

              When I go back into the Rule Editor I see this new time 20/02/2013 7:29 PM which is wrong.

              In the XML I see "Comparison="LessThan"Modified="2013-02-20T03:29:00" which is 8 hours in the other direction.

              In the Software Publishing window under the Applicability Rules tab the time looks correct 11:29 AM. So i'm going with that.

            • Re: Rules and Dates confusion
              Lawrence Garvin

              Greetings Phil


              Regarding your applicability rules, given that your criteria is File Exists AND File Modification Date IS EQUAL TO, I would suggest using a single File Exists rule. When testing with the File Exists rule, the basic test is that the file is there, or not, but you can supplement that test by also specifying that the file, if it exists, has specific criteria, such as Modification Date EQUAL TO some value. Generally this type of rule would be used in the Installed Ruleset, though, to identify that the specific file of that particular package is Installed.


              For Applicability Rules, generally a slightly more permissive approach is used. In the case of "should this update be installed", it's not just about whether the file exists, or the modification date IS NOT EQUAL TO, but more accurately that the modification date is LESS THAN that of the file in the package. In your current test simply looking for NOT Modification Date EQUAL TO, this package will actually throw a false positive for "Needed" when a NEWER configuration file has been deployed. Generally in these scenarios, a single File Version (or in your case) a File Modified rule will suffice for the Applicability Rules. If the file does not exist, then the Version or Mod date are interpreted as "zero" and IS LESS THAN will always return true. If the file does exist, then only in the case where the file exists and is NOT the same or newer, would the rule return true and show the update as "Needed".


              Regarding the display in the Package Wizard, that does appear to be a cosmetic bug with the display string. As Andrew noted, the XML is being properly rendered. I sent a note to the Product Manager about that defect.

                • Re: Rules and Dates confusion

                  Thanks LGarvin,

                  The key piece of info here was "If the file does not exist, then the Version or Mod date are interpreted as "zero" and IS LESS THAN will always return true."

                  I wasn't sure about the results of the rule test if the file wasn't there.

                  I've changed my Applicability Rule to be a File Modified < date_time.

                  I've changed my Installed Rule to do the Modified Date check.