dev/provisioning/modules/mysql/Rakefile
author ymh <ymh.work@gmail.com>
Fri, 17 Nov 2017 18:02:24 +0100
changeset 568 fd2a9b706231
parent 146 dc4d1cdc47e0
permissions -rw-r--r--
Added tag 0.0.24 for changeset 271e2afbf830
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
146
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
     1
require 'puppet_blacksmith/rake_tasks'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
     2
require 'puppet-lint/tasks/puppet-lint'
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
require 'puppetlabs_spec_helper/rake_tasks'
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
PuppetLint.configuration.fail_on_warnings = true
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
PuppetLint.configuration.send('relative')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
PuppetLint.configuration.send('disable_80chars')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
PuppetLint.configuration.send('disable_documentation')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
146
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    12
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    13
desc 'Generate pooler nodesets'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    14
task :gen_nodeset do
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    15
  require 'beaker-hostgenerator'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    16
  require 'securerandom'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    17
  require 'fileutils'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    18
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    19
  agent_target = ENV['TEST_TARGET']
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    20
  if ! agent_target
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    21
    STDERR.puts 'TEST_TARGET environment variable is not set'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    22
    STDERR.puts 'setting to default value of "redhat-64default."'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    23
    agent_target = 'redhat-64default.'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    24
  end
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    25
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    26
  master_target = ENV['MASTER_TEST_TARGET']
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    27
  if ! master_target
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    28
    STDERR.puts 'MASTER_TEST_TARGET environment variable is not set'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    29
    STDERR.puts 'setting to default value of "redhat7-64mdcl"'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    30
    master_target = 'redhat7-64mdcl'
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    31
  end
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    32
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    33
  targets = "#{master_target}-#{agent_target}"
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    34
  cli = BeakerHostGenerator::CLI.new([targets])
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    35
  nodeset_dir = "tmp/nodesets"
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    36
  nodeset = "#{nodeset_dir}/#{targets}-#{SecureRandom.uuid}.yaml"
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    37
  FileUtils.mkdir_p(nodeset_dir)
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    38
  File.open(nodeset, 'w') do |fh|
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    39
    fh.print(cli.execute)
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    40
  end
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    41
  puts nodeset
dc4d1cdc47e0 first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    42
end