Sha256: cfbc70b67a6e92906544686f52e733f413209c43f495d7cb70af495c9e701839

Contents?: true

Size: 823 Bytes

Versions: 70

Compression:

Stored size: 823 Bytes

Contents

plan aggregate::count(
  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", 'aggregate/invalid-params')
  }

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

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

  return aggregate::count($res)
}

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
bolt-1.26.0 modules/aggregate/plans/count.pp
bolt-1.25.0 modules/aggregate/plans/count.pp
bolt-1.24.0 modules/aggregate/plans/count.pp
bolt-1.23.0 modules/aggregate/plans/count.pp
bolt-1.22.0 modules/aggregate/plans/count.pp
bolt-1.21.0 modules/aggregate/plans/count.pp
bolt-1.20.0 modules/aggregate/plans/count.pp
bolt-1.19.0 modules/aggregate/plans/count.pp
bolt-1.18.0 modules/aggregate/plans/count.pp
bolt-1.17.0 modules/aggregate/plans/count.pp
bolt-1.16.0 modules/aggregate/plans/count.pp
bolt-1.15.0 modules/aggregate/plans/count.pp
bolt-1.14.0 modules/aggregate/plans/count.pp
bolt-1.13.1 modules/aggregate/plans/count.pp
bolt-1.13.0 modules/aggregate/plans/count.pp
bolt-1.12.0 modules/aggregate/plans/count.pp
bolt-1.11.0 modules/aggregate/plans/count.pp
bolt-1.10.0 modules/aggregate/plans/count.pp
bolt-1.9.0 modules/aggregate/plans/count.pp
bolt-1.8.1 modules/aggregate/plans/count.pp