Greetings!
Please review the pull request #14: Ec2 support opened by (bodepd)
Some more information about the pull request:
- Opened: Wed Sep 14 22:01:24 UTC 2011
- Based on: puppetlabs:master (3eb4bd61f922da01eee5b72b0a5d41cbe88fa9e4)
- Requested merge: bodepd:ec2_support (08ffc23cab3b440a829d5002476502d62f21bf8e)
Description:
All of the fixes were required for ec2 support of the test harness and to test cloud provisioner
Thanks!
The Pull Request Bot
Diff follows:
diff --git a/lib/test_case.rb b/lib/test_case.rb
index 00d231b..f45e3dc 100644
--- a/lib/test_case.rb
+++ b/lib/test_case.rb
@@ -42,6 +42,16 @@ class TestCase
end
end
end
+
+ def to_hash
+ hash = {}
+ hash['HOSTS'] = {}
+ hash['CONFIG'] = @config
+ @hosts.each do |host|
+ hash['HOSTS'][host.name] = host.overrides
+ end
+ hash
+ end
#
# Identify hosts
#
diff --git a/lib/test_case/host.rb b/lib/test_case/host.rb
index f99b5c3..ab584af 100644
--- a/lib/test_case/host.rb
+++ b/lib/test_case/host.rb
@@ -20,7 +20,7 @@ class TestCase
@name+other
end
- attr_reader :name
+ attr_reader :name, :overrides
# Wrap up the SSH connection process; this will cache the connection and
# allow us to reuse it for each operation without needing to reauth every
diff --git a/setup/cp_pe/01_setup_cloudmaster.rb b/setup/cp_pe/01_setup_cloudmaster.rb
new file mode 100644
index 0000000..df7d302
--- /dev/null
+++ b/setup/cp_pe/01_setup_cloudmaster.rb
@@ -0,0 +1,39 @@
+require 'yaml'
+keypair='dans-new-key'
+host_config_file='tmp/host_config.yaml'
+save_config_file='tmp/host_save_config.yaml'
+# why does it allow multiple keys
+keyfile=@config['ssh'][:keys].first
+
+# sets up a cloud master
+# requies that pe-build is in the $PATH
+controller = nil
+hosts.each do |host|
+ if host['roles'].include? 'controller'
+ controller = host
+ end
+end
+
+skip_test 'not running test if there is no controller' and break unless controller
+
+my_master = nil
+hosts.each do |host|
+ my_master = host if host['roles'].include? 'master'
+end
+
+skip_test 'we don\'t need to create a master if one was specified. Its up to the user to be sure that the hostname of their master is accessible from ec2' and break if my_master
+
+step 'creating a puppetmaster node in ec2'
+
+# create ec2 instances for master and dashboard
+puts `pe-builder --type t1.micro --keypair #{keypair} --keyfile #{keyfile} --os rhel5 --number 1 --cfgfile #{host_config_file} --verbose`
+
+# add the host entries to current list of hosts
+host_config = YAML.load_file(host_config_file)['HOSTS']
+host_config.collect { |name,overrides| @hosts.push(Host.new(name,overrides,@config)) }
+
+
+# save the current configuration
+File.open(save_config_file, 'w') do |fh|
+ fh.write YAML.dump(self.to_hash)
+end
diff --git a/setup/early/02-gen-answer-file.rb b/setup/early/02-gen-answer-file.rb
index 9feaadc..2443899 100644
--- a/setup/early/02-gen-answer-file.rb
+++ b/setup/early/02-gen-answer-file.rb
@@ -14,8 +14,8 @@ q_puppetagent_server=MASTER
]
# Master base answers
-master_a = %q[
-q_puppetmaster_certdnsnames=puppet:`uname | grep -i sunos > /dev/null && hostname || hostname -s`
+master_a = %Q[
+q_puppetmaster_certdnsnames=puppet:`uname | grep -i sunos > /dev/null && hostname || hostname -s`:#{master}
q_puppetmaster_certname=`uname | grep -i sunos > /dev/null && hostname || hostname -s`
q_puppetmaster_dashboard_hostname=DASHBOARDHOST
q_puppetmaster_dashboard_port=3000
@@ -25,7 +25,7 @@ q_puppetmaster_forward_facts=y
]
# Dashboard only answers
-dashboard_a = %q[
+dashboard_a = %Q[
q_puppetdashboard_database_install='y'
q_puppetdashboard_database_name='dashboard'
q_puppetdashboard_database_password='puppet'
@@ -34,7 +34,7 @@ q_puppetdashboard_database_user='dashboard'
q_puppetdashboard_httpd_port='3000'
q_puppetdashboard_master_hostname=MASTER
q_puppetdashboard_inventory_certname=`uname | grep -i sunos > /dev/null && hostname || hostname -s`
-q_puppetdashboard_inventory_certdnsnames=`uname | grep -i sunos > /dev/null && hostname || hostname -s`
+q_puppetdashboard_inventory_certdnsnames=`uname | grep -i sunos > /dev/null && hostname || hostname -s`:#{dashboard}
]
test_name="Generate Puppet Enterprise answer files"
diff --git a/setup/pe/01_PE-InstallPuppet.rb b/setup/pe/01_PE-InstallPuppet.rb
index 061fe3f..cf8dcdf 100755
--- a/setup/pe/01_PE-InstallPuppet.rb
+++ b/setup/pe/01_PE-InstallPuppet.rb
@@ -29,6 +29,7 @@ hosts.each do |host|
scp_to host, "tmp/answers.#{host}", "/tmp/#{host['dist']}"
step "Install Puppet Master"
on host,"cd /tmp/#{host['dist']} && ./puppet-enterprise-installer -a answers.#{host}"
+ on host, 'chown -Rvf pe-puppet:pe-puppet /var/opt/lib/pe-puppet/reports'
end
# Install Puppet Agents
diff --git a/systest.rb b/systest.rb
index 0aa420f..eef0e18 100755
--- a/systest.rb
+++ b/systest.rb
@@ -36,6 +36,9 @@ if options[:noinstall]
elsif options[:upgrade]
setup_options = options.merge({ :random => false,
:tests => ["setup/early", "setup/pe_upgrade", "setup/post"] })
+elsif options[:type] == 'cp_pe'
+ setup_options = options.merge({ :random => false,
+ :tests => [ 'setup/cp_pe' ] })
else
setup_options = options.merge({ :random => false,
:tests => ["setup/early", "setup/#{options[:type]}", "setup/post"] })
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
