Method: Unix::Exec#clear_env_var

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

#clear_env_var(key) ⇒ Object

Delete the environment variable from the current ssh environment

Examples:

host.clear_env_var('PATH')

Parameters:

  • key (String)

    The key to delete



266
267
268
269
270
271
272
273
274
# File 'lib/beaker/host/unix/exec.rb', line 266

def clear_env_var key
  key = key.to_s
  env_file = self[:ssh_env_file]
  # remove entire line
  exec(Beaker::SedCommand.new(self['platform'], "/^#{key}=.*$/d", env_file))
  # update the profile.d to current state
  # match it to the contents of ssh_env_file
  mirror_env_to_profile_d(env_file)
end