Defined Type: aptly::snapshot

Defined in:
manifests/snapshot.pp

Summary

Create a snapshot using `aptly snapshot`.

Overview

Parameters:

  • repo (Optional[String[1]]) (defaults to: undef)

    Create snapshot from given repo.

  • mirror (Optional[String[1]]) (defaults to: undef)

    Create snapshot from given mirror.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'manifests/snapshot.pp', line 7

define aptly::snapshot (
  Optional[String[1]] $repo   = undef,
  Optional[String[1]] $mirror = undef,
) {
  include aptly

  $aptly_cmd = "${aptly::aptly_cmd} snapshot"

  if $repo and $mirror {
    fail('$repo and $mirror are mutually exclusive.')
  }
  elsif $repo {
    $aptly_args = "create ${title} from repo ${repo}"
  }
  elsif $mirror {
    $aptly_args = "create ${title} from mirror ${mirror}"
  }
  else {
    $aptly_args = "create ${title} empty"
  }

  exec { "aptly_snapshot_create-${title}":
    command => "${aptly_cmd} ${aptly_args}",
    unless  => "${aptly_cmd} show ${title} >/dev/null",
    user    => $aptly::user,
    require => Class['aptly'],
  }
}