Puppet Plan: peadm::util::code_sync_status

Defined in:
plans/util/code_sync_status.pp

Overview

Parameters:

  • targets (Peadm::SingleTargetSpec)


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'plans/util/code_sync_status.pp', line 2

plan peadm::util::code_sync_status (
  Peadm::SingleTargetSpec $targets,
) {
  $data = run_task('peadm::code_sync_status', $targets).first.value

  # Print a table of summary status
  out::message(
    format::table({
        title => 'Summary',
        rows  => $data['environments'].reduce([['Overall sync status', $data['sync']]]) |$memo, $val| {
  $memo << ["${val[0]} environment in sync", $val[1]['sync']] } }))

  # Print a server status table, one for each environment
  $data['environments'].each |$env, $_| {
    out::message(
      format::table({
          title => "Server sync status - ${env}",
          head  => ['Server', 'In Sync', 'Commit'],
          rows  => $data['environments'][$env]['servers'].reduce([]) |$memo, $val| {
    $memo << [$val[0], $val[1]['sync'], $val[1]['commit']] } }))
  }

  return('Done')
}