Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-7289

scheduled_task : Support an array of possible values for "which_occurrence"

    XMLWordPrintable

Details

    • Hide
      • puppet resource should emit a string array for occurrences, even where there are 0 or 1 items in the array
      • occurrences should allow an array to be used in a manifest
      • new integration tests where applicable
      Show
      puppet resource should emit a string array for occurrences , even where there are 0 or 1 items in the array occurrences should allow an array to be used in a manifest new integration tests where applicable
    • Windows
    • 1
    • Needs Assessment

    Description

      The current module only allows for setting occurrences to a single string value, and only exposes the first value in the manifest generated by puppet resource.

      In reality, the V2 API supports a bitmask now instead of the single value supported in the V1 API. This is a problem for a few reasons:

      • Users cannot set a combination of weeks to repeat on - for instance first and third
      • When managing existing tasks, information may be lost if the task was setup to repeat on different weeks
      • The output emitted by puppet resource is wrong and cannot be round-tripped properly.

      See https://github.com/puppetlabs/puppetlabs-scheduled_task/commit/d6ba376cf2ad3696adc883c80f0060e3b4bb2ab2 for more information on when this was uncovered

      Notice comments like

        # HACK: choose only the last week selected for test conversion, as this LOSES information
        - :WeeksOfMonth => 0b10000,
      

      Implementing this will also need to consider :

      • The default compatibility level for a task is 1 when left unspecified. However, an array value for occurrence should either - set the compatibility to 2 automatically and emit a warning OR hard fail with a message to the user about compatibility
      • The value should be canonicalized / stored into an array in the canonicalize_and_validate helper code
      • trigger_spec.rb tests should be updated

      Attachments

        Activity

          People

            Unassigned Unassigned
            ethan Ethan Brown
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support