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.42.0 modules/aggregate/plans/count.pp
bolt-1.41.0 modules/aggregate/plans/count.pp
bolt-1.40.0 modules/aggregate/plans/count.pp
bolt-1.39.0 modules/aggregate/plans/count.pp
bolt-1.38.0 modules/aggregate/plans/count.pp
bolt-1.37.0 modules/aggregate/plans/count.pp
bolt-1.36.0 modules/aggregate/plans/count.pp
bolt-1.35.0 modules/aggregate/plans/count.pp
bolt-1.34.0 modules/aggregate/plans/count.pp
bolt-1.33.0 modules/aggregate/plans/count.pp
bolt-1.32.0 modules/aggregate/plans/count.pp
bolt-1.31.1 modules/aggregate/plans/count.pp
bolt-1.31.0 modules/aggregate/plans/count.pp
bolt-1.30.1 modules/aggregate/plans/count.pp
bolt-1.30.0 modules/aggregate/plans/count.pp
bolt-1.29.1 modules/aggregate/plans/count.pp
bolt-1.29.0 modules/aggregate/plans/count.pp
bolt-1.28.0 modules/aggregate/plans/count.pp
bolt-1.27.1 modules/aggregate/plans/count.pp
bolt-1.27.0 modules/aggregate/plans/count.pp