X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=Rakefile;h=7e9a13d5df14cdfc0d62033bdb154801c4455120;hb=efbe46bbc12f6a8c78343d95713abaf895f6e5c7;hp=35ce31140e74ad5283bed49bb108d8cb6b29a87e;hpb=10a8e79e7fba1d0f3ae01eaf4439de32a92c2138;p=puppet-modules%2Fpuppetlabs-apt.git diff --git a/Rakefile b/Rakefile index 35ce311..7e9a13d 100644 --- a/Rakefile +++ b/Rakefile @@ -9,3 +9,34 @@ PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] + +desc 'Generate pooler nodesets' +task :gen_nodeset do + require 'beaker-hostgenerator' + require 'securerandom' + require 'fileutils' + + agent_target = ENV['TEST_TARGET'] + if ! agent_target + STDERR.puts 'TEST_TARGET environment variable is not set' + STDERR.puts 'setting to default value of "redhat-64default."' + agent_target = 'redhat-64default.' + end + + master_target = ENV['MASTER_TEST_TARGET'] + if ! master_target + STDERR.puts 'MASTER_TEST_TARGET environment variable is not set' + STDERR.puts 'setting to default value of "redhat7-64mdcl"' + master_target = 'redhat7-64mdcl' + end + + targets = "#{master_target}-#{agent_target}" + cli = BeakerHostGenerator::CLI.new([targets]) + nodeset_dir = "tmp/nodesets" + nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml" + FileUtils.mkdir_p(nodeset_dir) + File.open(nodeset, 'w') do |fh| + fh.print(cli.execute) + end + puts nodeset +end