Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsc_scheduledtask taskpath parameter should have mandatory_for_get: true #326

Open
Clebam opened this issue Jun 21, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Clebam
Copy link
Contributor

Clebam commented Jun 21, 2024

Describe the Bug

When trying to set a scheduled task in a different taskpath, the resource won't search in the right place to retrieve the resource information and will always apply the configuration.

Expected Behavior

When applying a scheduled task in a specific taskpath, it should not reapply at each run

Steps to Reproduce

Using computermanagementdsc module : https://forge.puppet.com/modules/dsc/computermanagementdsc/readme
Using dsc_scheduledtask module

  dsc_scheduledtask { "my_task":
    dsc_ensure            => present,
    dsc_enable            => true,
    dsc_taskname          => "my_task",
    dsc_taskpath          => '\\my_taskpath\\',
    dsc_actionexecutable  => 'ping.exe',
    dsc_actionarguments   => "localhost",
    dsc_actionworkingpath => '',
    dsc_scheduletype      => 'daily',
    dsc_daysinterval      => 1,
  }

This results in this output (at each run)

Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_daysinterval: dsc_daysinterval changed  to 1 (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_taskpath: dsc_taskpath changed '\' to '\my_taskpath\' (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_scheduletype: dsc_scheduletype changed  to 'daily' (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_enable: dsc_enable changed  to 'true' (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_ensure: dsc_ensure changed 'Absent' to 'present' (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_actionexecutable: dsc_actionexecutable changed  to 'ping.exe' (corrective)
Notice: /Stage[main]/Main/Node[default]/Dsc_scheduledtask[my_task]/dsc_actionarguments: dsc_actionarguments changed  to 'localhost' (corrective)

Environment

  • Version puppet 7.23
  • Platform Windows 2022

Additional Context

The thing is that the data that are retrieved are mostly nil because it searches the task my_task in default taskpath \

The dsc_taskpath parameter is declared as this in the module

    dsc_taskpath: {
      type: 'Optional[String]',
      desc: 'The path to the task - defaults to the root directory.',

      mandatory_for_get: false,
      mandatory_for_set: false,
      mof_type: 'String',
      mof_is_embedded: false,
    },

If I use mandatory_for_get: true, it works as wanted.
However the module being auto generated I guess it should be set on the powershell side. Though given this problem occurs because of dsc_base_provider.rb way of working, and given it may be a breaking change on the powershell side, I'm not sure they would update this 🤷
There is this issue that could help but it does not seem to move since 5 years :(

@Clebam Clebam added the bug Something isn't working label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant