installer/utils/nix_install_test.rb in rhoconnect-3.1.2 vs installer/utils/nix_install_test.rb in rhoconnect-3.2.0.beta1
- old
+ new
@@ -35,13 +35,13 @@
when 'test'
'test-packages'
when 'beta'
'beta-packages'
when 'release'
- 'release-packages'
+ 'packages'
else
- 'nightly-packages'
+ 'packages'
end #case
end #build_type
# compile_stack_info
# Fills in all necessary information which is stack specific
@@ -58,32 +58,32 @@
channel = build_type
# Append the rest of the file name according to distribution
if @user == 'ubuntu'
- @dist = { :flavor => "ubuntu",
- :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
- :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
- :pkg_mgr => 'dpkg',
- :pkg_type => 'DEB',
- :pkg_repo => 'apt-get',
- :deps => Constants::DEB_DEPS,
+ @dist = { :flavor => "ubuntu",
+ :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
+ :local_file => "#{local_file}rhoconnect_#{Constants::RC_VERSION}_all.deb",
+ :pkg_mgr => 'dpkg',
+ :pkg_type => 'DEB',
+ :pkg_repo => 'apt-get',
+ :deps => Constants::DEB_DEPS,
:repo_src_file => '/etc/apt/sources.list',
- :repo_str => '\n' +
- '# This is the repository for rhoconnect packages\n' +
+ :repo_str => '\n' +
+ '# This is the repository for rhoconnect packages\n' +
"deb http://#{BUCKET}.s3.amazonaws.com/#{channel}/deb rhoconnect main" }
elsif @user == 'root'
- @dist = { :flavor => "centos",
- :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
- :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
- :pkg_mgr => 'rpm',
- :pkg_type => 'RPM',
- :pkg_repo => 'yum',
- :deps => Constants::RPM_DEPS,
+ @dist = { :flavor => "centos",
+ :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
+ :local_file => "#{local_file}rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
+ :pkg_mgr => 'rpm',
+ :pkg_type => 'RPM',
+ :pkg_repo => 'yum',
+ :deps => Constants::RPM_DEPS,
:repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
- :repo_str => '[rhoconnect]\n' +
- 'name=Rhoconnect\n' +
+ :repo_str => '[rhoconnect]\n' +
+ 'name=Rhoconnect\n' +
"baseurl=http://#{BUCKET}.s3.amazonaws.com/#{channel}/rpm" +
'\nenabled=1\n' +
'gpgcheck=0\n' }
else
@@ -110,13 +110,13 @@
# make_fog
# Generates the Fog object used to create the new ec2 instance.
def make_fog
get_access_keys
@fog = Fog::Compute.new(
- :provider => 'AWS',
- :region => Constants::REGION,
- :aws_access_key_id => @access_key,
+ :provider => 'AWS',
+ :region => Constants::REGION,
+ :aws_access_key_id => @access_key,
:aws_secret_access_key => @secret_access_key
)
end #make_fog
# start_new_instance
@@ -136,11 +136,11 @@
STDOUT.flush
end #do
puts
# save important instance information
- @host = @server.dns_name
+ @host = @server.dns_name
@server_id = @server.id
else
puts "Server timed out."
exit 7
end #if
@@ -160,15 +160,15 @@
end #destroy_ec2_instance
# prepare_sources
# Prepares the remote machine's repo source list to be able to download rhoconnect
def prepare_sources
- puts "preparing sources..."
+ puts "preparing sources..."
ssh_cmd "sudo touch #{@dist[:repo_src_file]}" if @dist[:flavor] == 'centos'
filename = @dist[:repo_src_file]
- src_str = @dist[:repo_str]
+ src_str = @dist[:repo_str]
# Create file for yum rhoconnect sources
# Get current permissions of file
perms = @ssh.run("stat --format=%a #{filename}")[0].stdout.strip
@@ -184,22 +184,22 @@
# install_package
# Issues commands to the remote machine to start the installation
def install_package
prepare_sources
- puts "Installing rhoconnect package.\n" +
+ puts "Installing rhoconnect package.\n" +
"This may take a while...\n\n"
ssh_cmd "yes | sudo #{@dist[:pkg_repo]} install rhoconnect"
end #install_package
# start_servers
# Attempts to start redis and nginx servers
def start_servers
max_attempts = 100
puts
- ['Redis', 'Nginx'].each do |program|
+ ['Redis', 'Nginx', 'thin'].each do |program|
attempts = 0
while @ssh.run("pgrep #{program.downcase}")[0].stdout.strip == "" and
attempts < max_attempts
ssh_cmd "sudo /etc/init.d/#{program.downcase} start"
attempts += 1
@@ -219,18 +219,19 @@
# Makes an HTTP request to check that the rhoconnect service is working
def check_rc_service
puts "Host: #{@host}"
puts "Checking RC service."
- request = nil #Defined outside block as to not limit the scope of request to the do block.
+ request = nil #Defined outside block as to not limit the scope of request to the do block.
2.times do
request = Net::HTTP.get_response(@host, '/')
end #do
puts "Code: #{request.code} Message: #{request.message}"
- if request.code == '200'
+ if request.code == '200' or
+ request.code == '302'
puts "Rhoconnect service up!"
else
puts "Failed to connect to rhoconnect service."
exit 13
end #if
@@ -259,10 +260,10 @@
# Test Package installations
Constants::STACKS.each do |stack|
start_time = Time.now
begin
- @stack = stack
+ @stack = stack
compile_stack_info
puts "\n" +
"================================================\n" +
"Now starting test of #{@dist[:pkg_type]} package\n" +