Defined Type: hadoop::kdestroy

Defined in:
manifests/kdestroy.pp

Overview

Define hadoop::kdestroy

Destroy credentials. To be called after any hadoop::kinit() resource type call.

Requirements

Parameters:

  • touchfile (Any) (defaults to: $title)
  • touch (Any) (defaults to: true)


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
35
36
37
# File 'manifests/kdestroy.pp', line 9

define hadoop::kdestroy($touchfile = $title, $touch = true) {
  $env = [ "KRB5CCNAME=FILE:/tmp/krb5cc_nn_puppet_${touchfile}" ]
  $path = '/sbin:/usr/sbin:/bin:/usr/bin'
  $puppetfile = "/var/lib/hadoop-hdfs/.puppet-${touchfile}"

  if $hadoop::zookeeper_deployed {
    if $hadoop::realm and $hadoop::realm != '' and $hadoop::_keytab_hdfs_admin and $hadoop::_principal_hdfs_admin {
      exec { "kdestroy-${touchfile}":
        command     => 'kdestroy || true',
        path        => $path,
        environment => $env,
        onlyif      => "test -n \"${hadoop::realm}\"",
        provider    => 'shell',
        user        => 'hdfs',
        creates     => $puppetfile,
      }
    }

    if $touch {
      exec { "hadoop-touch-${touchfile}":
        command     => "touch ${puppetfile}",
        path        => $path,
        environment => $env,
        user        => 'hdfs',
        creates     => $puppetfile,
      }
    }
  }
}