Skip to content

Commit 866be4a

Browse files
authored
Merge pull request #184 from glennsarti/ticket/master/MODULES-3256-fix-login
(BKR-914) Add workaround for beaker bug BKR-914
2 parents 482dc49 + 200b862 commit 866be4a

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

spec/spec_helper_acceptance.rb

+24-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,30 @@
2727
unless ENV['MODULE_provision'] == 'no'
2828
agents.each do |agent|
2929
# Emit CommonProgramFiles environment variable
30-
program_files = agent.get_env_var('ProgramFiles').split('=')[1]
31-
agent.add_env_var('CommonProgramFiles', "#{program_files}\\Common Files")
30+
common_program_files = agent.get_env_var('CommonProgramFiles')
31+
32+
# Workarounds due to BKR-914
33+
# - newline chars indicate matching more than one env var
34+
# - env var key matching is very loose. e.g. CommonProgramFiles(x86) can be returned
35+
common_program_files = "" if common_program_files.include?("\n")
36+
common_program_files = "" unless common_program_files.start_with?("CommonProgramFiles=")
37+
# If the env var is not found use a workaround to inject regex into the grep call
38+
common_program_files = agent.get_env_var('^CommonProgramFiles=') if common_program_files == ""
39+
40+
if common_program_files == ""
41+
program_files = agent.get_env_var('PROGRAMFILES')
42+
43+
# Workarounds due to BKR-914
44+
# - newline chars indicate matching more than one env var
45+
# - env var key matching is very loose. e.g. ProgramFiles(x86) can be returned
46+
program_files = "" if program_files.include?("\n")
47+
program_files = "" unless program_files.start_with?("PROGRAMFILES=")
48+
# If the env var is not found use a workaround to inject regex into the grep call
49+
program_files = agent.get_env_var('^PROGRAMFILES=') if program_files == ""
50+
51+
program_files = program_files.split('=')[1]
52+
agent.add_env_var('CommonProgramFiles', "#{program_files}\\Common Files")
53+
end
3254

3355
# Install Forge certs to allow for PMT installation.
3456
install_ca_certs(agent)

0 commit comments

Comments
 (0)