lib/beaker/host/unix/exec.rb
# Converts the provided environment file to a new shell script in /etc/profile.d, then sources that file.
# This is for sles based hosts.
# @param [String] env_file The ssh environment file to read from
Converts the provided environment file to a new shell script in /etc/profile.d, then sources that file.
This is for sles based hosts.
Converts the provided environment file to a new shell script in / etc / profile . d then sources that file . This is for sles based hosts .
def mirror_env_to_profile_d env_file
    if self[:platform] =~ /opensuse|sles-/
      @logger.debug("mirroring environment to /etc/profile.d on opensuse/sles platform host")
      cur_env = exec(Beaker::Command.new("cat #{env_file}")).stdout
      shell_env = ''
      cur_env.each_line do |env_line|
        shell_env << "export #{env_line}"
      end
      exec(Beaker::Command.new("cat << EOF > #{self[:profile_d_env_file]}\n#{shell_env}EOF"))
      exec(Beaker::Command.new("chmod +x #{self[:profile_d_env_file]}"))
      exec(Beaker::Command.new("source #{self[:profile_d_env_file]}"))
    else
      @logger.debug("will not mirror environment to /etc/profile.d on non-sles platform host")
    end
  end
def mirror_env_to_profile_d env_file if self [ :platform ] =~ / opensuse|sles- / @logger . debug ( "mirroring environment to /etc/profile.d on opensuse/sles platform host" ) cur_env = exec ( Beaker :: Command . new ( "cat #{env_file}" ) ) . stdout shell_env = '' cur_env . each_line do | env_line | shell_env << "export #{env_line}" end exec ( Beaker :: Command . new ( "cat << EOF > #{self[:profile_d_env_file]}\n#{shell_env}EOF" ) ) exec ( Beaker :: Command . new ( "chmod +x #{self[:profile_d_env_file]}" ) ) exec ( Beaker :: Command . new ( "source #{self[:profile_d_env_file]}" ) ) else @logger . debug ( "will not mirror environment to /etc/profile.d on non-sles platform host" ) end end
Converts the provided environment file to a new shell script in /etc/profile.d, then sources that file.
Converts the provided environment file to a new shell script in / etc / profile . d then sources that file .
#here doc it over #set permissions #keep it current #noop
env_file
env_file The ssh environment file to read from
env_file The ssh environment file to read from