Method: Unix::Exec#environment_string

Defined in:
lib/beaker/host/unix/exec.rb

#environment_string(env) ⇒ String

Construct the environment string for this command

Parameters:

  • env (Hash{String=>String})

    An optional Hash containing key-value pairs to be treated as environment variables that should be set for the duration of the puppet command.

Returns:

  • (String)

    Returns a string containing command line arguments that will ensure the environment is correctly set for the given host.



328
329
330
331
332
333
334
# File 'lib/beaker/host/unix/exec.rb', line 328

def environment_string env
  return '' if env.empty?

  env_array = self.environment_variable_string_pair_array(env)
  environment_string = env_array.join(' ')
  "env #{environment_string}"
end