Sha256: 2447a345247040357ef62e5055a3f7a6df84c2147c8d68fba97d340f5e6a87b6

Contents?: true

Size: 810 Bytes

Versions: 5

Compression:

Stored size: 810 Bytes

Contents

plan aggregate::nodes(
  Optional[String[0]] $task = undef,
  Optional[String[0]] $command = undef,
  Optional[String[0]] $script = undef,
  TargetSpec $nodes,
  Hash[String, Data] $params = {}
) {

  # Validation
  $type_count = [$task, $command, $script].reduce(0) |$acc, $v| {
    if ($v) {
      $acc + 1
    } else {
      $acc
    }
  }

  if ($type_count == 0) {
    fail_plan("Must specify a command, script, or task to run", 'canary/invalid-params')
  }

  if ($type_count > 1) {
    fail_plan("Must specify only one command, script, or task to run", 'canary/invalid-params')
  }

  $res = if ($task) {
    run_task($task, $nodes, $params)
  } elsif ($command) {
    run_command($command, $nodes, $params)
  } elsif ($script) {
    run_script($script, $nodes, $params)
  }

  aggregate::nodes($res)
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bolt-0.18.1 modules/aggregate/plans/nodes.pp
bolt-0.18.0 modules/aggregate/plans/nodes.pp
bolt-0.17.2 modules/aggregate/plans/nodes.pp
bolt-0.17.1 modules/aggregate/plans/nodes.pp
bolt-0.17.0 modules/aggregate/plans/nodes.pp