Module: Beaker::DSL::InstallUtils::PuppetUtils

Included in:
Beaker::DSL::InstallUtils, FOSSUtils, PEUtils
Defined in:
lib/beaker/dsl/install_utils/puppet_utils.rb

Overview

This module contains methods useful for both foss and pe installs

Instance Method Summary collapse

Instance Method Details

#add_puppet_paths_on(hosts) ⇒ Object

Append puppetbindir, facterbindir and hierabindir to the PATH for each host

Parameters:

  • hosts (Host, Array<Host>, String, Symbol)

    One or more hosts to act upon, or a role (String or Symbol) that identifies one or more hosts.



29
30
31
32
33
# File 'lib/beaker/dsl/install_utils/puppet_utils.rb', line 29

def add_puppet_paths_on(hosts)
  block_on hosts do | host |
    host.add_env_var('PATH', construct_puppet_path(host))
  end
end

#construct_puppet_path(host) ⇒ Object

Given a host construct a PATH that includes puppetbindir, facterbindir and hierabindir

Parameters:

  • host (Host)

    A single host to construct pathing for



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/beaker/dsl/install_utils/puppet_utils.rb', line 11

def construct_puppet_path(host)
  path = (%w(puppetbindir facterbindir hierabindir)).compact.reject(&:empty?)
  #get the PATH defaults
  path.map! { |val| host[val] }
  path = path.compact.reject(&:empty?)
  #run the paths through echo to see if they have any subcommands that need processing
  path.map! { |val| echo_on(host, val) }

  separator = host['pathseparator']
  if not host.is_powershell?
    separator = ':'
  end
  path.join(separator)
end

#remove_puppet_paths_on(hosts) ⇒ Object

Remove puppetbindir, facterbindir and hierabindir to the PATH for each host

Parameters:

  • hosts (Host, Array<Host>, String, Symbol)

    One or more hosts to act upon, or a role (String or Symbol) that identifies one or more hosts.



39
40
41
42
43
# File 'lib/beaker/dsl/install_utils/puppet_utils.rb', line 39

def remove_puppet_paths_on(hosts)
  block_on hosts do | host |
    host.delete_env_var('PATH', construct_puppet_path(host))
  end
end