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Uc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
|
|
|
|
1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
|
|
|
|
snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
|
|
|
|
U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
|
|
|
|
9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
|
|
|
|
BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
|
|
|
|
AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
|
|
|
|
yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
|
|
|
|
38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
|
|
|
|
AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
|
|
|
|
DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
|
|
|
|
HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
|
|
|
|
-----END CERTIFICATE-----
|
|
|
|
EOM
|
|
|
|
|
2016-09-30 23:28:57 +00:00
|
|
|
def read_file_on(host, filename)
|
|
|
|
on(host, "cat #{filename}").stdout
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_test_module_path(host, module_regex)
|
|
|
|
modules = JSON.parse(on(host, puppet('module', 'list', '--render-as', 'json')).stdout)
|
|
|
|
test_module_info = modules['modules_by_path'].values.flatten.find { |mod_info| mod_info =~ module_regex }
|
|
|
|
test_module_info.match(/\(([^)]*)\)/)[1]
|
|
|
|
end
|
2017-02-07 00:35:33 +00:00
|
|
|
|
|
|
|
def install_ca_certs(host)
|
|
|
|
return unless host.platform =~ /windows/
|
|
|
|
|
|
|
|
step "Installing Geotrust CA cert"
|
|
|
|
create_remote_file(host, "geotrustglobal.pem", GEOTRUST_GLOBAL_CA)
|
|
|
|
on host, "chmod 644 geotrustglobal.pem"
|
|
|
|
on host, "cmd /c certutil -v -addstore Root `cygpath -w geotrustglobal.pem`"
|
|
|
|
|
|
|
|
step "Installing Usertrust Network CA cert"
|
|
|
|
create_remote_file(host, "usertrust-network.pem", USERTRUST_NETWORK_CA)
|
|
|
|
on host, "chmod 644 usertrust-network.pem"
|
|
|
|
on host, "cmd /c certutil -v -addstore Root `cygpath -w usertrust-network.pem`"
|
|
|
|
|
|
|
|
step "Installing Equifax CA cert"
|
|
|
|
create_remote_file(host, "equifax.pem", EQUIFAX_CA)
|
|
|
|
on host, "chmod 644 equifax.pem"
|
|
|
|
on host, "cmd /c certutil -v -addstore Root `cygpath -w equifax.pem`"
|
|
|
|
|
|
|
|
step "Installing Globalsign CA cert"
|
|
|
|
create_remote_file(host, "globalsign.pem", GLOBALSIGN_CA)
|
|
|
|
on host, "chmod 644 globalsign.pem"
|
|
|
|
on host, "cmd /c certutil -v -addstore Root `cygpath -w globalsign.pem`"
|
|
|
|
on host, "cp globalsign.pem \"$(cygpath \"#{find_windows_rubygems_ssl_certs_dir(host)}\")\""
|
|
|
|
end
|
|
|
|
|
|
|
|
def find_windows_rubygems_ssl_certs_dir(host)
|
|
|
|
return unless host.platform =~ /windows/
|
|
|
|
ssl_certs_dir = File.dirname(on(host, "#{gem_command(host)} which rubygems").stdout.strip) << '/rubygems/ssl_certs'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module CommandUtils
|
|
|
|
def ruby_command(host)
|
|
|
|
"env PATH=\"#{host['privatebindir']}:${PATH}\" ruby"
|
|
|
|
end
|
|
|
|
module_function :ruby_command
|
|
|
|
|
|
|
|
def gem_command(host, type='aio')
|
|
|
|
if type == 'aio'
|
|
|
|
if host['platform'] =~ /windows/
|
|
|
|
"PATH=\"#{host['privatebindir']}:${PATH}\" cmd /c gem"
|
|
|
|
else
|
|
|
|
"PATH=\"#{host['privatebindir']}:${PATH}\" gem"
|
|
|
|
end
|
|
|
|
else
|
|
|
|
on(host, 'which gem').stdout.chomp
|
|
|
|
end
|
|
|
|
end
|
|
|
|
module_function :gem_command
|
2016-09-30 23:28:57 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|