summaryrefslogtreecommitdiff
path: root/code/environments/production/modules/certregen/Rakefile
diff options
context:
space:
mode:
Diffstat (limited to 'code/environments/production/modules/certregen/Rakefile')
-rw-r--r--code/environments/production/modules/certregen/Rakefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/code/environments/production/modules/certregen/Rakefile b/code/environments/production/modules/certregen/Rakefile
new file mode 100644
index 0000000..f0adad3
--- /dev/null
+++ b/code/environments/production/modules/certregen/Rakefile
@@ -0,0 +1,39 @@
+require 'puppetlabs_spec_helper/rake_tasks'
+require 'puppet-lint/tasks/puppet-lint'
+require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
+
+PuppetLint.configuration.fail_on_warnings = true
+PuppetLint.configuration.send('relative')
+MetadataJsonLint.options.strict_dependencies = false
+MetadataJsonLint.options.fail_on_warnings = false
+
+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