Puppet Function: complyadm::images::inspect

Defined in:
functions/images/inspect.pp
Function type:
Puppet Language

Overview

complyadm::images::inspect(String[1] $image_name, TargetSpec $targets, Optional[Hash] $opts = undef, Optional[Complyadm::Runtime] $runtime = 'docker')ResultSet

Parameters:

  • image_name (String[1])

    The image name to inspect

  • target

    targets to run the image inspect command on

  • opts (Optional[Hash]) (defaults to: undef)

    Optional options if you need to override the defaults passed to run_command, for eample in when running against localhost

  • targets (TargetSpec)
  • runtime (Optional[Complyadm::Runtime]) (defaults to: 'docker')

Returns:

  • (ResultSet)

    ResultSet results per target, stdout will contain a json hash if the image exists, otherwise non-zero exit code.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'functions/images/inspect.pp', line 12

function complyadm::images::inspect(
  String[1] $image_name,
  TargetSpec $targets,
  Optional[Hash] $opts = undef,
  Optional[Complyadm::Runtime] $runtime = 'docker',
) >> ResultSet {
  $cmd_opts = $opts ? {
    undef   => { '_run_as' => 'root', '_catch_errors' => true, },
    default => $opts,
  }

  without_default_logging() || {
    $image_inspect_results = run_command(
      "${runtime} image inspect ${image_name} --format '{{ json . }}' 2> /dev/null",
      $targets,
      $cmd_opts,
    )
  }
}