Puppet Plan: choria::tasks::download_files

Defined in:
plans/tasks/download_files.pp

Overview

Download the files of associated with a task onto the nodes

Parameters:

  • nodes (Choria::Nodes)

    The nodes to download onto

  • files (Array[Hash])

    The files section of the task metadata

  • task (String)

    The name of the task

  • tasks_environment (String[1]) (defaults to: "production")

    The environment to find tasks

  • catch_errors (Optional[Boolean]) (defaults to: undef)

    Whether to catch errors

Returns:

  • (Choria::TaskResults)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'plans/tasks/download_files.pp', line 9

plan choria::tasks::download_files(
  String $task,
  Array[Hash] $files,
  Choria::Nodes $nodes,
  String[1] $tasks_environment = "production",
  Optional[Boolean] $catch_errors = undef,
) {
  info("Downloading files for task '${task}' onto ${nodes.size} nodes")

  choria::task(
    "nodes"            => $nodes,
    "action"           => "bolt_tasks.download",
    "batch_size"       => 50,
    "batch_sleep_time" => 1,
    "silent"           => true,
    "_catch_errors"    => $catch_errors,
    "properties"       => {
      "environment"    => $tasks_environment,
      "task"           => $task,
      "files"          => $files.stdlib::to_json
    }
  )
}