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

scheduled_task : Add the logon trigger

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Normal
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide
      • Puppet resource commands should detect existing tasks with logon triggers
      • Should be able to CRUD tasks with logon triggers
      • Should have spec tests for the trigger type
      • Should have an acceptance test to create and delete the trigger
      Show
      Puppet resource commands should detect existing tasks with logon triggers Should be able to CRUD tasks with logon triggers Should have spec tests for the trigger type Should have an acceptance test to create and delete the trigger
    • Team:
      Windows
    • Story Points:
      1
    • Sprint:
      Windows 2018-08-15, Windows 2018-08-22
    • QA Risk Assessment:
      Needs Assessment

      Description

      Similar to adding support for the boot trigger (as implemented in MODULES-6267 / PR https://github.com/puppetlabs/puppetlabs-scheduled_task/pull/42), support should be added for the logon trigger.

      After refactoring is complete from MODULES-7463, the number of files in the project is reduced to:

      In addition to adding the new schedule type logon, support must be added for the UserId property of the COM ILogonTrigger interface. The new trigger hash value should be called either user or user_id. Note that we will not be adding support for the Delay value at this time (as it's pertinent to more trigger types and that's ticketed / slated for a later release as part of MODULES-7215)

      A mapping of manifest -> ITrigger is in table form at https://gist.github.com/Iristyle/58ff446bd3f60e68d52df3868c917a0e

      To support the additional type requires modifying the trigger classes Manifest and Type such that:

      • The Manifest class understands a schedule of logon as it understands other schedule types like once. This is stored in the ValidScheduleKeys array.
      • The Manifest hash understands a key of user as it understands other values. This is stored in the ValidKeys array.
      • The Manifest method canonicalize_and_validate performs correct validation over the new schedule type of logon and requires user as a mandatory field.
      • The Type class includes Type::TASK_TRIGGER_LOGON in the EVENT_BASED_TRIGGER_MAP
      • The Type method to_manifest_hash must properly set the schedule type and copy the UserId value from the ITrigger instance
      • The Type method append_trigger must properly set the UserId value on the new ITrigger instance based on what was set in the manifest

      While demoing the code base, a quick incomplete spike that doesn't include docs or tests was put together at https://github.com/Iristyle/puppetlabs-scheduled_task/commit/45da6e4f980a34d4c62cde825cb66af9e250c3d8

      In addition task_spec.rb should be modified so that it no longer ignores logon and some modifications should be made to the tests in trigger_spec.rb validation.

      Once implemented, a manifest like the following should behave be able to create / modify a logon task, should behave idempotently, etc.

      scheduled_task { 'doIt':
        compatibility => 2,
        command => 'C:\\Windows\\System32\\notepad.exe',
        trigger => [{schedule => 'logon', minutes_interval => '30', start_time => '15:20', user => 'Bob'}],
      }
      

      A task that sets compatibility => 1 like the following should fail I believe (but worth testing to observe behavior)

      scheduled_task { 'doIt':
        compatibility => 1,
        command => 'C:\\Windows\\System32\\notepad.exe',
        trigger => [{schedule => 'logon', minutes_interval => '30', start_time => '15:20', user => 'Bob'}],
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.lombardi Michael Lombardi
              Reporter:
              larissa Larissa Lane
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support