| 1 | require 'puppet_blacksmith/rake_tasks'
|
|---|
| 2 | require 'puppet-lint/tasks/puppet-lint'
|
|---|
| 3 | require 'puppetlabs_spec_helper/rake_tasks'
|
|---|
| 4 |
|
|---|
| 5 | PuppetLint.configuration.fail_on_warnings = true
|
|---|
| 6 | PuppetLint.configuration.send('relative')
|
|---|
| 7 | PuppetLint.configuration.send('disable_80chars')
|
|---|
| 8 | PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
|---|
| 9 | PuppetLint.configuration.send('disable_documentation')
|
|---|
| 10 | PuppetLint.configuration.send('disable_single_quote_string_with_variables')
|
|---|
| 11 | PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
|
|---|
| 12 |
|
|---|
| 13 | desc 'Generate pooler nodesets'
|
|---|
| 14 | task :gen_nodeset do
|
|---|
| 15 | require 'beaker-hostgenerator'
|
|---|
| 16 | require 'securerandom'
|
|---|
| 17 | require 'fileutils'
|
|---|
| 18 |
|
|---|
| 19 | agent_target = ENV['TEST_TARGET']
|
|---|
| 20 | if ! agent_target
|
|---|
| 21 | STDERR.puts 'TEST_TARGET environment variable is not set'
|
|---|
| 22 | STDERR.puts 'setting to default value of "redhat-64default."'
|
|---|
| 23 | agent_target = 'redhat-64default.'
|
|---|
| 24 | end
|
|---|
| 25 |
|
|---|
| 26 | master_target = ENV['MASTER_TEST_TARGET']
|
|---|
| 27 | if ! master_target
|
|---|
| 28 | STDERR.puts 'MASTER_TEST_TARGET environment variable is not set'
|
|---|
| 29 | STDERR.puts 'setting to default value of "redhat7-64mdcl"'
|
|---|
| 30 | master_target = 'redhat7-64mdcl'
|
|---|
| 31 | end
|
|---|
| 32 |
|
|---|
| 33 | targets = "#{master_target}-#{agent_target}"
|
|---|
| 34 | cli = BeakerHostGenerator::CLI.new([targets])
|
|---|
| 35 | nodeset_dir = "tmp/nodesets"
|
|---|
| 36 | nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml"
|
|---|
| 37 | FileUtils.mkdir_p(nodeset_dir)
|
|---|
| 38 | File.open(nodeset, 'w') do |fh|
|
|---|
| 39 | fh.print(cli.execute)
|
|---|
| 40 | end
|
|---|
| 41 | puts nodeset
|
|---|
| 42 | end
|
|---|