Puppet Plan: complyadm::preflight::runtime::conflict

Defined in:
plans/preflight/runtime/conflict.pp

Overview

Docker and podman don’t necessarily play very nicely together when run on the same system, so this plan looks for the ‘other’ container runtime (the one the customer has not specified as theirs) and returns a failure result if it is found on the target.

Parameters:

  • config (Complyadm::Config) (defaults to: complyadm::config())

    Complyadm::Config object with all config options



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'plans/preflight/runtime/conflict.pp', line 10

plan complyadm::preflight::runtime::conflict(
  Complyadm::Config $config = complyadm::config()
) {
  $desired_runtime = $config['runtime']
  $conflicting_runtime = $desired_runtime ? {
    'podman' => 'docker',
    default => 'podman'
  }

  $all_targets = $config['all_targets']

  $results = $all_targets.reduce({ 'passed' => [], 'failed' => [] }) |$memo, $target| {
    $runtime_results = complyadm::runtime::version($target, $conflicting_runtime)
    $passed_targets = $runtime_results.error_set.map() |$result| {
      "${result.target.name} : No conflicting runtimes found"
    } + $memo['passed']
    $failed_targets = $runtime_results.ok_set.map() |$result| {
      "${result.target.name} : found conflicting runtime ${conflicting_runtime}"
    } + $memo['failed']
    $memo + { 'passed' => $passed_targets, 'failed' => $failed_targets }
  }

  return $results
}