Jira (PUP-10138) Task Resource Type that behaves like an improved file->exec

11 views
Skip to first unread message

Alex Dreyer (JIRA)

unread,
Nov 13, 2019, 12:27:05 PM11/13/19
to puppe...@googlegroups.com
Alex Dreyer created an issue
 
Puppet / New Feature PUP-10138
Task Resource Type that behaves like an improved file->exec
Issue Type: New Feature New Feature
Assignee: Unassigned
Created: 2019/11/13 9:26 AM
Priority: Normal Normal
Reporter: Alex Dreyer

A common pattern in puppet is to ensure a script file is present then execute that script. Now that users are writing scripts as tasks for use with bolt and PE it's desirable to reuse these tasks during enforcement runs. Users should be able to refer to a task by name, explicitly pass parameters. The provider should handle downloading the task and any required files and executing it according to the task spec.

 

task{ 'running a task':
  task => 'task::name' # namevar?
  parameters => {
    p1 => foo,
  }
} 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Josh Cooper (JIRA)

unread,
Nov 13, 2019, 7:55:05 PM11/13/19
to puppe...@googlegroups.com
Josh Cooper commented on New Feature PUP-10138
 
Re: Task Resource Type that behaves like an improved file->exec

How would you prevent puppet from reporting changes every time it runs? Is the task only triggered via subscribe/notify due to some other resource changing, like we do for reboot?

Does the task always delete the downloaded file, or leave it around for next time?

Where should the task resource download the task from?

What should the is_to_s/should_to_s messages be if it syncs?

Alex Dreyer (JIRA)

unread,
Nov 25, 2019, 5:54:03 PM11/25/19
to puppe...@googlegroups.com
Alex Dreyer commented on New Feature PUP-10138

I think it would need the same constraints as execs do around when the task actually gets run.

I think caching the task file between runs is preferable but not a hard requirement. That is what pxp-agent does. The location should be hidden from the user though.

The task resource should download the task from the same puppet master it gets files from.

Alex Dreyer (Jira)

unread,
Mar 2, 2020, 12:57:02 PM3/2/20
to puppe...@googlegroups.com
Alex Dreyer updated an issue
 
Change By: Alex Dreyer
A common pattern in puppet is to ensure a script file is present then execute that script. Now that users are writing scripts as tasks for use with bolt and PE it's desirable to reuse these tasks during enforcement runs. Users should be able to refer to a task by name, explicitly pass parameters. The provider should handle downloading the task and any required files and executing it according to the task spec.

 
{noformat}

task{ 'running a task':
  task => 'task::name' # namevar?
  parameters => {
    p1 => foo,
  } ,
creates => '/foo/bar'
} {noformat}
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Nick Maludy (Jira)

unread,
Mar 2, 2020, 1:00:03 PM3/2/20
to puppe...@googlegroups.com
Nick Maludy commented on New Feature PUP-10138
 
Re: Task Resource Type that behaves like an improved file->exec

+1 for this

 

Current use case:

I'm trying to refactor the puppetlabs-chocolatey module to reuse the same PowerShell script to perform installation of Chocolatey from a Task and a Puppet manifest. Right now, this is proving difficult / impossible due to the current way it works (open to suggestions / ideas):

  • The chocolatey::install manifest has an exec{} resource that renders the PowerShell install script as an .erb template.
  • This is great, except that Tasks pass parameters instead of rendering templates.
  • On the flip side, the exec{} resource would be a PITA to write to pass in PowerShell parameters in the correct way
Reply all
Reply to author
Forward
0 new messages