aboutsummaryrefslogtreecommitdiff
path: root/manifests/owner_trust.pp
blob: 0e0af7f27650184e52a6a671eae384bd6409549f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
define monkeysphere::owner_trust (
  $fingerprint,
  $user = 'root',
  $level = 6 ) {

  $keyserver_arg = $monkeysphere_keyserver ? {
    '' => '',
    default => "--keyserver $monkeysphere_keyserver"
  }

  # ensure the key is in the key ring
  exec { "monkeysphere-gpg-recv-key-$user-$fingerprint":
    command => "gpg $keyserver_arg --recv-key $fingerprint",
    require => [ Package["monkeysphere"] ],
    user => $user,
    unless => "gpg --list-key $fingerprint 2>&1 >/dev/null"
  }
  # provide ownertrust
  exec { "monkeysphere-gpg-ownertrust-$user-$fingerprint":
    command => "printf '$fingerprint:$level\n'\$(gpg --export-ownertrust) | gpg --import-ownertrust",
    require => [ Package["monkeysphere"] ],
    user => $user,
    unless => "gpg --export-ownertrust | grep $fingerprint >/dev/null"
  }
}