Greetings!

Please review the pull request #21: (#9538) Do not generate PE answers arrays on non-PE tests opened by (bodepd)

Some more information about the pull request:

  • Opened: Fri Sep 16 16:01:38 UTC 2011
  • Based on: puppetlabs:master (81a9444f55589d9c5b8932b52d89c22cb92ac6f4)
  • Requested merge: bodepd:9538_skip_answers_generation_for_non-pe_tests (3020c1ca4108ec515e687c8325a34da4a6872bf5)

Description:

Previously, the answers files templates were being generated on
non-PE tests. This makes it hard to make changes to the
answers generation and understand the tests that it may imact.

Thanks!
The Pull Request Bot

Diff follows:

diff --git a/setup/early/02-gen-answer-file.rb b/setup/early/02-gen-answer-file.rb
index be61a94..ed4ea59 100644
--- a/setup/early/02-gen-answer-file.rb
+++ b/setup/early/02-gen-answer-file.rb
@@ -1,4 +1,7 @@
 
+test_name="Generate Puppet Enterprise answer files"
+skip_test "Skipping answers file generation for non PE tests" and break unless ( options[:type] =~ /pe/ )
+
 common_a = %q[
 q_install=y
 q_puppet_symlinks_install=y
@@ -37,63 +40,55 @@ q_puppetdashboard_inventory_certname=`uname | grep -i sunos > /dev/null && hostn
 q_puppetdashboard_inventory_certdnsnames=`uname | grep -i sunos > /dev/null && hostname || hostname -s`
 ]
 
-test_name="Generate Puppet Enterprise answer files"
-puts "Skipping #{test_name}" unless ( options[:type] =~ /pe/ )
+dashboardhost = 'undefined'
+FileUtils.rm Dir.glob('tmp/answers.*')  # Clean up all answer files
+FileUtils.rm("tmp/answers.tar") if File::exists?("tmp/answers.tar")
 
-if ( options[:type] =~ /pe/ ) then
-  dashboardhost = 'undefined'
-  FileUtils.rm Dir.glob('tmp/answers.*')  # Clean up all answer files
-  FileUtils.rm("tmp/answers.tar") if File::exists?("tmp/answers.tar")
+hosts.each do |host|   # find our dashboard host for laster use
+  dashboardhost = host if host['roles'].include? 'dashboard'
+end
+# For all defined hosts...
+hosts.each do |host|
+  answers=''
+  role_agent=FALSE
+  role_master=FALSE
+  role_dashboard=FALSE
+  role_agent=TRUE     if host['roles'].include? 'agent'
+  role_master=TRUE    if host['roles'].include? 'master'
+  role_dashboard=TRUE if host['roles'].include? 'dashboard'
 
-  hosts.each do |host|   # find our dashboard host for laster use
-    dashboardhost = host if host['roles'].include? 'dashboard'
+  answers=common_a
+  if role_agent  
+    answers=answers + agent_a + 'q_puppetagent_install=\'y\'' + "\n" 
+  else 
+    answers=answers + 'q_puppetagent_install=\'n\'' + "\n"
   end
-  # For all defined hosts...
-  hosts.each do |host|
-    answers=''
-    role_agent=FALSE
-    role_master=FALSE
-    role_dashboard=FALSE
-    role_agent=TRUE     if host['roles'].include? 'agent'
-    role_master=TRUE    if host['roles'].include? 'master'
-    role_dashboard=TRUE if host['roles'].include? 'dashboard'
-
-    answers=common_a
-    if role_agent  
-      answers=answers + agent_a + 'q_puppetagent_install=\'y\'' + "\n" 
-    else 
-      answers=answers + 'q_puppetagent_install=\'n\'' + "\n"
-    end
-    
-    if role_master
-      answers=answers + master_a + 'q_puppetmaster_install=\'y\'' + "\n"
-    else
-      answers=answers + 'q_puppetmaster_install=\'n\'' + "\n"
-    end
-    
-    if role_dashboard
-      answers=answers + dashboard_a + 'q_puppetdashboard_install=\'y\'' + "\n"
-    else
-      answers=answers + 'q_puppetdashboard_install=\'n\'' + "\n"
-    end
-    
-    File.open("tmp/answers.#{host}", 'w') do |fh|
-      answers.split(/\n/).each do |line| 
-        if line =~ /(q_puppetagent_server=)MASTER/ then
-          line = $1+master
-        end
-        if line =~ /(q_puppetmaster_dashboard_hostname=)DASHBOARDHOST/ then
-          line = $1+dashboardhost
-        end
-        if line =~ /(q_puppetdashboard_master_hostname=)MASTER/ then
-          line = $1+master
-        end
-        fh.puts line
+  
+  if role_master
+    answers=answers + master_a + 'q_puppetmaster_install=\'y\'' + "\n"
+  else
+    answers=answers + 'q_puppetmaster_install=\'n\'' + "\n"
+  end
+  
+  if role_dashboard
+    answers=answers + dashboard_a + 'q_puppetdashboard_install=\'y\'' + "\n"
+  else
+    answers=answers + 'q_puppetdashboard_install=\'n\'' + "\n"
+  end
+  
+  File.open("tmp/answers.#{host}", 'w') do |fh|
+    answers.split(/\n/).each do |line| 
+      if line =~ /(q_puppetagent_server=)MASTER/ then
+        line = $1+master
+      end
+      if line =~ /(q_puppetmaster_dashboard_hostname=)DASHBOARDHOST/ then
+        line = $1+dashboardhost
+      end
+      if line =~ /(q_puppetdashboard_master_hostname=)MASTER/ then
+        line = $1+master
       end
+      fh.puts line
     end
   end
-  #system("tar cf tmp/answers.tar tmp/answers.*")
-else 
-  Log.notify "Non-PE based install, skipping answer file generation"
-  skip_test "Non-PE based install, skipping answer file generation"
-end #end if
+end
+#system("tar cf tmp/answers.tar tmp/answers.*")

    

--
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.

Reply via email to