puppet_litmus 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/puppet_litmus/inventory_manipulation.rb +2 -0
- data/lib/puppet_litmus/rake_helper.rb +19 -16
- data/lib/puppet_litmus/rake_tasks.rb +5 -5
- data/lib/puppet_litmus/util.rb +17 -0
- data/lib/puppet_litmus/version.rb +1 -1
- data/lib/puppet_litmus.rb +18 -8
- data/spec/lib/puppet_litmus/inventory_manipulation_spec.rb +6 -8
- data/spec/lib/puppet_litmus/puppet_helpers_spec.rb +4 -7
- data/spec/lib/puppet_litmus/rake_helper_spec.rb +0 -2
- data/spec/lib/puppet_litmus/rake_tasks_spec.rb +1 -3
- data/spec/lib/puppet_litmus/util_spec.rb +15 -0
- data/spec/lib/puppet_litmus/version_spec.rb +0 -3
- data/spec/spec_helper.rb +5 -0
- metadata +18 -21
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2e545da74266b708eae5c7cb6bab56480b78724ff51a9b8591943cfa98db3d7d
         | 
| 4 | 
            +
              data.tar.gz: fd3e61dbc511549ac3ab1c43d834b9fa8e729d5af4bb48a6b4fab50041539428
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 43adad4003cec09ff51204502f1f8f223c379ddd0c5ab93f38cb1285f0868ed965bbbc0117db72f022bc346f12315d9b9bfbb1deeed41c15467c17d2a86ebc43
         | 
| 7 | 
            +
              data.tar.gz: c8d670ec75ee889f29a02071be10574027a742575034f3666a348f2bbcb6dca85f5d748fe236a357ffff571eb4d3556d0c32140652d308fc765936b21c1cb8b7
         | 
| @@ -1,5 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            module PuppetLitmus; end # rubocop:disable Style/Documentation
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
            # helper functions for manipulating and reading a bolt inventory file
         | 
| 4 6 | 
             
            module PuppetLitmus::InventoryManipulation
         | 
| 5 7 | 
             
              # Creates an inventory hash from the inventory.yaml.
         | 
| @@ -68,18 +68,16 @@ module PuppetLitmus::RakeHelper | |
| 68 68 | 
             
                folder_list = Dir.entries(source_folder).reject { |f| File.directory? f }
         | 
| 69 69 | 
             
                module_tars = []
         | 
| 70 70 | 
             
                folder_list.each do |folder|
         | 
| 71 | 
            -
                   | 
| 72 | 
            -
                  next if File.symlink?( | 
| 71 | 
            +
                  folder_handle = Dir.open(File.join(source_folder, folder))
         | 
| 72 | 
            +
                  next if File.symlink?(folder_handle)
         | 
| 73 73 |  | 
| 74 | 
            -
                   | 
| 75 | 
            -
                   | 
| 76 | 
            -
                  opts[:'target-dir'] = File.join(Dir.pwd, 'pkg')
         | 
| 77 | 
            -
                  opts[:force] = true
         | 
| 74 | 
            +
                  module_dir = folder_handle.path
         | 
| 75 | 
            +
                  target_dir = File.join(Dir.pwd, 'pkg')
         | 
| 78 76 | 
             
                  # remove old build folder if exists, before we build afresh
         | 
| 79 | 
            -
                  FileUtils.rm_rf( | 
| 77 | 
            +
                  FileUtils.rm_rf(target_dir) if File.directory?(target_dir)
         | 
| 80 78 |  | 
| 81 79 | 
             
                  # build_module
         | 
| 82 | 
            -
                  module_tar = build_module( | 
| 80 | 
            +
                  module_tar = build_module(module_dir, target_dir)
         | 
| 83 81 | 
             
                  module_tars.push(File.new(module_tar))
         | 
| 84 82 | 
             
                end
         | 
| 85 83 | 
             
                module_tars
         | 
| @@ -164,15 +162,20 @@ module PuppetLitmus::RakeHelper | |
| 164 162 | 
             
                results
         | 
| 165 163 | 
             
              end
         | 
| 166 164 |  | 
| 167 | 
            -
               | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
             | 
| 171 | 
            -
             | 
| 172 | 
            -
                require ' | 
| 173 | 
            -
             | 
| 165 | 
            +
              # @param opts Hash of options to build the module
         | 
| 166 | 
            +
              # @param module_dir [String] The path of the module to build. If missing defaults to Dir.pwd
         | 
| 167 | 
            +
              # @param target_dir [String] The path the module will be built into. The default is <source_dir>/pkg
         | 
| 168 | 
            +
              # @return [String] The path to the built module
         | 
| 169 | 
            +
              def build_module(module_dir = nil, target_dir = nil)
         | 
| 170 | 
            +
                require 'puppet/modulebuilder'
         | 
| 171 | 
            +
             | 
| 172 | 
            +
                source_dir = module_dir || Dir.pwd
         | 
| 173 | 
            +
                dest_dir = target_dir || File.join(source_dir, 'pkg')
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                builder = Puppet::Modulebuilder::Builder.new(source_dir, dest_dir, nil)
         | 
| 176 | 
            +
                # Force the metadata to be read. Raises if metadata could not be found
         | 
| 177 | 
            +
                _metadata = builder.metadata
         | 
| 174 178 |  | 
| 175 | 
            -
                builder = PDK::Module::Build.new(opts)
         | 
| 176 179 | 
             
                builder.build
         | 
| 177 180 | 
             
              end
         | 
| 178 181 |  | 
| @@ -1,7 +1,11 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            +
            require 'rake'
         | 
| 4 | 
            +
             | 
| 3 5 | 
             
            namespace :litmus do
         | 
| 6 | 
            +
              require 'puppet_litmus/inventory_manipulation'
         | 
| 4 7 | 
             
              require 'puppet_litmus/rake_helper'
         | 
| 8 | 
            +
              include PuppetLitmus::InventoryManipulation
         | 
| 5 9 | 
             
              include PuppetLitmus::RakeHelper
         | 
| 6 10 | 
             
              # Prints all supported OSes from metadata.json file.
         | 
| 7 11 | 
             
              desc 'print all supported OSes from metadata'
         | 
| @@ -228,9 +232,7 @@ namespace :litmus do | |
| 228 232 | 
             
                  exit 0
         | 
| 229 233 | 
             
                end
         | 
| 230 234 |  | 
| 231 | 
            -
                 | 
| 232 | 
            -
                opts[:force] = true
         | 
| 233 | 
            -
                module_tar = build_module(opts)
         | 
| 235 | 
            +
                module_tar = build_module
         | 
| 234 236 | 
             
                puts 'Built'
         | 
| 235 237 |  | 
| 236 238 | 
             
                # module_tar = Dir.glob('pkg/*.tar.gz').max_by { |f| File.mtime(f) }
         | 
| @@ -324,8 +326,6 @@ namespace :litmus do | |
| 324 326 | 
             
              namespace :acceptance do
         | 
| 325 327 | 
             
                require 'rspec/core/rake_task'
         | 
| 326 328 | 
             
                if File.file?('inventory.yaml')
         | 
| 327 | 
            -
                  require 'puppet_litmus/inventory_manipulation'
         | 
| 328 | 
            -
                  include PuppetLitmus::InventoryManipulation
         | 
| 329 329 | 
             
                  inventory_hash = inventory_hash_from_inventory_file
         | 
| 330 330 | 
             
                  targets = find_targets(inventory_hash, nil)
         | 
| 331 331 |  | 
| @@ -0,0 +1,17 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            # Helper methods for testing puppet content
         | 
| 4 | 
            +
            module PuppetLitmus::Util
         | 
| 5 | 
            +
              # Ensure that a passed command is base 64 encoded and passed to PowerShell; this obviates the need to
         | 
| 6 | 
            +
              # carefully interpolate strings for passing to ruby which will then be passed to PowerShell/CMD which will
         | 
| 7 | 
            +
              # then be executed. This also ensures that a single PowerShell command may be specified for Windows targets
         | 
| 8 | 
            +
              # leveraging PowerShell as bolt run_shell will use PowerShell against a remote target but CMD against a
         | 
| 9 | 
            +
              # localhost target.
         | 
| 10 | 
            +
              #
         | 
| 11 | 
            +
              # @param :command [String] A PowerShell script block to be converted to base64
         | 
| 12 | 
            +
              # @return [String] An invocation for PowerShell with the encoded command which may be passed to run_shell
         | 
| 13 | 
            +
              def self.interpolate_powershell(command)
         | 
| 14 | 
            +
                encoded_command = Base64.strict_encode64(command.encode('UTF-16LE'))
         | 
| 15 | 
            +
                "powershell.exe -NoProfile -EncodedCommand #{encoded_command}"
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
            end
         | 
    
        data/lib/puppet_litmus.rb
    CHANGED
    
    | @@ -21,16 +21,26 @@ module PuppetLitmus | |
| 21 21 | 
             
              process_span = Honeycomb.start_span(name: 'Litmus Testing')
         | 
| 22 22 | 
             
              if ENV['CI'] == 'true' && ENV['TRAVIS'] == 'true'
         | 
| 23 23 | 
             
                process_span.add_field('module_name', ENV['TRAVIS_REPO_SLUG'])
         | 
| 24 | 
            -
                process_span.add_field(' | 
| 25 | 
            -
                process_span.add_field(' | 
| 26 | 
            -
                process_span.add_field(' | 
| 27 | 
            -
                process_span.add_field(' | 
| 24 | 
            +
                process_span.add_field('ci.provider', 'travis')
         | 
| 25 | 
            +
                process_span.add_field('ci.build_id', ENV['TRAVIS_BUILD_ID'])
         | 
| 26 | 
            +
                process_span.add_field('ci.build_url', ENV['TRAVIS_BUILD_WEB_URL'])
         | 
| 27 | 
            +
                process_span.add_field('ci.job_url', ENV['TRAVIS_JOB_WEB_URL'])
         | 
| 28 | 
            +
                process_span.add_field('ci.commit_message', ENV['TRAVIS_COMMIT_MESSAGE'])
         | 
| 29 | 
            +
                process_span.add_field('ci.sha', ENV['TRAVIS_PULL_REQUEST_SHA'] || ENV['TRAVIS_COMMIT'])
         | 
| 28 30 | 
             
              elsif ENV['CI'] == 'True' && ENV['APPVEYOR'] == 'True'
         | 
| 29 31 | 
             
                process_span.add_field('module_name', ENV['APPVEYOR_PROJECT_SLUG'])
         | 
| 30 | 
            -
                process_span.add_field(' | 
| 31 | 
            -
                process_span.add_field(' | 
| 32 | 
            -
                process_span.add_field(' | 
| 33 | 
            -
                process_span.add_field(' | 
| 32 | 
            +
                process_span.add_field('ci.provider', 'appveyor')
         | 
| 33 | 
            +
                process_span.add_field('ci.build_id', ENV['APPVEYOR_BUILD_ID'])
         | 
| 34 | 
            +
                process_span.add_field('ci.build_url', "https://ci.appveyor.com/project/#{ENV['APPVEYOR_REPO_NAME']}/builds/#{ENV['APPVEYOR_BUILD_ID']}")
         | 
| 35 | 
            +
                process_span.add_field('ci.job_url', "https://ci.appveyor.com/project/#{ENV['APPVEYOR_REPO_NAME']}/build/job/#{ENV['APPVEYOR_JOB_ID']}")
         | 
| 36 | 
            +
                process_span.add_field('ci.commit_message', ENV['APPVEYOR_REPO_COMMIT_MESSAGE'])
         | 
| 37 | 
            +
                process_span.add_field('ci.sha', ENV['APPVEYOR_PULL_REQUEST_HEAD_COMMIT'] || ENV['APPVEYOR_REPO_COMMIT'])
         | 
| 38 | 
            +
              elsif ENV['GITHUB_ACTIONS'] == 'true'
         | 
| 39 | 
            +
                process_span.add_field('module_name', ENV['GITHUB_REPOSITORY'])
         | 
| 40 | 
            +
                process_span.add_field('ci.provider', 'github')
         | 
| 41 | 
            +
                process_span.add_field('ci.build_id', ENV['GITHUB_RUN_ID'])
         | 
| 42 | 
            +
                process_span.add_field('ci.build_url', "https://github.com/#{ENV['GITHUB_REPOSITORY']}/actions/runs/#{ENV['GITHUB_RUN_ID']}")
         | 
| 43 | 
            +
                process_span.add_field('ci.sha', ENV['GITHUB_SHA'])
         | 
| 34 44 | 
             
              end
         | 
| 35 45 | 
             
              at_exit do
         | 
| 36 46 | 
             
                process_span.send
         | 
| @@ -1,8 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 | 
            -
            load File.expand_path('../../../lib/puppet_litmus/inventory_manipulation.rb', __dir__)
         | 
| 5 | 
            -
            include PuppetLitmus::InventoryManipulation # rubocop:disable Style/MixinUsage
         | 
| 6 4 |  | 
| 7 5 | 
             
            RSpec.describe PuppetLitmus::InventoryManipulation do
         | 
| 8 6 | 
             
              context 'with config_from_node' do
         | 
| @@ -115,11 +113,11 @@ RSpec.describe PuppetLitmus::InventoryManipulation do | |
| 115 113 | 
             
                end
         | 
| 116 114 |  | 
| 117 115 | 
             
                it 'no feature exists for the group, and returns hash with feature added' do
         | 
| 118 | 
            -
                  expect(described_class.add_feature_to_group(no_feature_hash, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 116 | 
            +
                  expect(described_class.add_feature_to_group(no_feature_hash, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 119 117 | 
             
                end
         | 
| 120 118 |  | 
| 121 119 | 
             
                it 'feature exists for the group, and returns hash with feature removed' do
         | 
| 122 | 
            -
                  expect(described_class.remove_feature_from_group(feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => [], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 120 | 
            +
                  expect(described_class.remove_feature_from_group(feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => [], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 123 121 | 
             
                end
         | 
| 124 122 |  | 
| 125 123 | 
             
                it 'write from inventory_hash to inventory_yaml file feature_hash_group' do
         | 
| @@ -127,15 +125,15 @@ RSpec.describe PuppetLitmus::InventoryManipulation do | |
| 127 125 | 
             
                end
         | 
| 128 126 |  | 
| 129 127 | 
             
                it 'empty feature exists for the group, and returns hash with feature added' do
         | 
| 130 | 
            -
                  expect(described_class.add_feature_to_group(empty_feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 128 | 
            +
                  expect(described_class.add_feature_to_group(empty_feature_hash_group, 'puppet-agent', 'ssh_nodes')).to eq('groups' => [{ 'features' => ['puppet-agent'], 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net' }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 131 129 | 
             
                end
         | 
| 132 130 |  | 
| 133 131 | 
             
                it 'no feature exists for the node, and returns hash with feature added' do
         | 
| 134 | 
            -
                  expect(described_class.add_feature_to_node(no_feature_hash, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 132 | 
            +
                  expect(described_class.add_feature_to_node(no_feature_hash, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 135 133 | 
             
                end
         | 
| 136 134 |  | 
| 137 135 | 
             
                it 'feature exists for the node, and returns hash with feature removed' do
         | 
| 138 | 
            -
                  expect(described_class.remove_feature_from_node(feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => [] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 136 | 
            +
                  expect(described_class.remove_feature_from_node(feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => [] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 139 137 | 
             
                end
         | 
| 140 138 |  | 
| 141 139 | 
             
                it 'write from inventory_hash to inventory_yaml file feature_hash_node' do
         | 
| @@ -143,7 +141,7 @@ RSpec.describe PuppetLitmus::InventoryManipulation do | |
| 143 141 | 
             
                end
         | 
| 144 142 |  | 
| 145 143 | 
             
                it 'empty feature exists for the node, and returns hash with feature added' do
         | 
| 146 | 
            -
                  expect(described_class.add_feature_to_node(empty_feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable  | 
| 144 | 
            +
                  expect(described_class.add_feature_to_node(empty_feature_hash_node, 'puppet-agent', 'test.delivery.puppetlabs.net')).to eq('groups' => [{ 'name' => 'ssh_nodes', 'targets' => [{ 'config' => { 'ssh' => { 'host-key-check' => false, 'password' => 'Qu@lity!', 'user' => 'root' }, 'transport' => 'ssh' }, 'facts' => { 'platform' => 'centos-5-x86_64', 'provisioner' => 'vmpooler' }, 'uri' => 'test.delivery.puppetlabs.net', 'features' => ['puppet-agent'] }] }, { 'name' => 'winrm_nodes', 'targets' => [] }]) # rubocop:disable Layout/LineLength: Line is too long
         | 
| 147 145 | 
             
                end
         | 
| 148 146 |  | 
| 149 147 | 
             
                it 'write from inventory_hash to inventory_yaml file no feature_hash' do
         | 
| @@ -1,9 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 | 
            -
            load File.expand_path('../../../lib/puppet_litmus/puppet_helpers.rb', __dir__)
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            include PuppetLitmus::PuppetHelpers # rubocop:disable Style/MixinUsage
         | 
| 7 4 |  | 
| 8 5 | 
             
            RSpec.describe PuppetLitmus::PuppetHelpers do
         | 
| 9 6 | 
             
              context 'with idempotent_apply' do
         | 
| @@ -122,10 +119,10 @@ RSpec.describe PuppetLitmus::PuppetHelpers do | |
| 122 119 | 
             
                let(:local) { '/tmp' }
         | 
| 123 120 | 
             
                let(:remote) { '/remote_tmp' }
         | 
| 124 121 | 
             
                # Ignore rubocop because these hashes are representative of output from an external method and editing them leads to test failures.
         | 
| 125 | 
            -
                # rubocop:disable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators,  | 
| 122 | 
            +
                # rubocop:disable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators, Layout/LineLength, Layout/SpaceAfterComma
         | 
| 126 123 | 
             
                let(:result_success) {[{'node'=>'some.host','target'=>'some.host','action'=>'upload','object'=>'C:\foo\bar.ps1','status'=>'success','result'=>{'_output'=>'Uploaded \'C:\foo\bar.ps1\' to \'some.host:C:\bar\''}}]}
         | 
| 127 124 | 
             
                let(:result_failure) {[{'node'=>'some.host','target'=>'some.host','action'=>nil,'object'=>nil,'status'=>'failure','result'=>{'_error'=>{'kind'=>'puppetlabs.tasks/task_file_error','msg'=>'No such file or directory @ rb_sysopen - /nonexistant/file/path','details'=>{},'issue_code'=>'WRITE_ERROR'}}}]}
         | 
| 128 | 
            -
                # rubocop:enable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators,  | 
| 125 | 
            +
                # rubocop:enable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators, Layout/LineLength, Layout/SpaceAfterComma
         | 
| 129 126 | 
             
                let(:inventory_hash) { { 'groups' => [{ 'name' => 'local', 'nodes' => [{ 'name' => 'some.host', 'config' => { 'transport' => 'local' } }] }] } }
         | 
| 130 127 | 
             
                let(:localhost_inventory_hash) { { 'groups' => [{ 'name' => 'local', 'nodes' => [{ 'name' => 'litmus_localhost', 'config' => { 'transport' => 'local' } }] }] } }
         | 
| 131 128 |  | 
| @@ -228,11 +225,11 @@ RSpec.describe PuppetLitmus::PuppetHelpers do | |
| 228 225 | 
             
                let(:params) { { 'action' => 'install', 'name' => 'foo' } }
         | 
| 229 226 | 
             
                let(:config_data) { { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') } }
         | 
| 230 227 | 
             
                # Ignore rubocop because these hashes are representative of output from an external method and editing them leads to test failures.
         | 
| 231 | 
            -
                # rubocop:disable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceBeforeBlockBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators,  | 
| 228 | 
            +
                # rubocop:disable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceBeforeBlockBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators, Layout/LineLength, Layout/SpaceAfterComma
         | 
| 232 229 | 
             
                let(:result_unstructured_task_success){ [{'node'=>'some.host','target'=>'some.host','action'=>'task','object'=>'testtask::unstructured','status'=>'success','result'=>{'_output'=>'SUCCESS!'}}]}
         | 
| 233 230 | 
             
                let(:result_structured_task_success){ [{'node'=>'some.host','target'=>'some.host','action'=>'task','object'=>'testtask::structured','status'=>'success','result'=>{'key1'=>'foo','key2'=>'bar'}}]}
         | 
| 234 231 | 
             
                let(:result_failure) {[{'node'=>'some.host','target'=>'some.host','action'=>'task','object'=>'testtask::unstructured','status'=>'failure','result'=>{'_error'=>{'msg'=>'FAILURE!','kind'=>'puppetlabs.tasks/task-error','details'=>{'exitcode'=>123}}}}]}
         | 
| 235 | 
            -
                # rubocop:enable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceBeforeBlockBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators,  | 
| 232 | 
            +
                # rubocop:enable Layout/SpaceInsideHashLiteralBraces, Layout/SpaceBeforeBlockBraces, Layout/SpaceInsideBlockBraces, Layout/SpaceAroundOperators, Layout/LineLength, Layout/SpaceAfterComma
         | 
| 236 233 | 
             
                let(:inventory_hash) { { 'groups' => [{ 'name' => 'local', 'nodes' => [{ 'name' => 'some.host', 'config' => { 'transport' => 'local' } }] }] } }
         | 
| 237 234 |  | 
| 238 235 | 
             
                it 'responds to bolt_run_task' do
         | 
| @@ -2,8 +2,6 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 4 |  | 
| 5 | 
            -
            load File.expand_path('../../../lib/puppet_litmus/rake_helper.rb', __dir__)
         | 
| 6 | 
            -
             | 
| 7 5 | 
             
            RSpec.describe PuppetLitmus::RakeHelper do
         | 
| 8 6 | 
             
              context 'with provision_list' do
         | 
| 9 7 | 
             
                let(:provision_hash) { { 'default' => { 'provisioner' => 'docker', 'images' => ['waffleimage/centos7'] } } }
         | 
| @@ -1,9 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require 'spec_helper'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            load File.expand_path('../../../lib/puppet_litmus/inventory_manipulation.rb', __dir__)
         | 
| 6 | 
            -
            include PuppetLitmus::InventoryManipulation # rubocop:disable Style/MixinUsage
         | 
| 4 | 
            +
             | 
| 7 5 | 
             
            describe 'litmus rake tasks' do
         | 
| 8 6 | 
             
              before(:all) do # rubocop:disable RSpec/BeforeAfterAll
         | 
| 9 7 | 
             
                load File.expand_path('../../../lib/puppet_litmus/rake_tasks.rb', __dir__)
         | 
| @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'spec_helper'
         | 
| 4 | 
            +
            load File.expand_path('../../../lib/puppet_litmus/util.rb', __dir__)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            RSpec.describe PuppetLitmus::Util do
         | 
| 7 | 
            +
              context 'when using interpolate_powershell' do
         | 
| 8 | 
            +
                it 'interpolates the command' do
         | 
| 9 | 
            +
                  expect(described_class.interpolate_powershell('foo')).to match(%r{powershell\.exe})
         | 
| 10 | 
            +
                  expect(described_class.interpolate_powershell('foo')).to match(%r{NoProfile})
         | 
| 11 | 
            +
                  expect(described_class.interpolate_powershell('foo')).to match(%r{EncodedCommand})
         | 
| 12 | 
            +
                  expect(described_class.interpolate_powershell('foo')).not_to match(%r{foo})
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -3,6 +3,11 @@ | |
| 3 3 | 
             
            require 'rspec'
         | 
| 4 4 | 
             
            require 'puppet_litmus'
         | 
| 5 5 |  | 
| 6 | 
            +
            # Unfortunately this needs to be included as this is
         | 
| 7 | 
            +
            # how Litmus functions. We only include once here instead
         | 
| 8 | 
            +
            # of including for every single spec file.
         | 
| 9 | 
            +
            include PuppetLitmus # rubocop:disable Style/MixinUsage
         | 
| 10 | 
            +
             | 
| 6 11 | 
             
            if ENV['COVERAGE'] == 'yes'
         | 
| 7 12 | 
             
              require 'simplecov'
         | 
| 8 13 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: puppet_litmus
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.16.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Puppet, Inc.
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 11 | 
            +
            date: 2020-03-09 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bolt
         | 
| @@ -31,25 +31,19 @@ dependencies: | |
| 31 31 | 
             
                  - !ruby/object:Gem::Version
         | 
| 32 32 | 
             
                    version: 2.0.0
         | 
| 33 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 | 
            -
              name:  | 
| 34 | 
            +
              name: puppet-modulebuilder
         | 
| 35 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 36 36 | 
             
                requirements:
         | 
| 37 | 
            -
                - - " | 
| 38 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            -
                    version: 1.10.0
         | 
| 40 | 
            -
                - - "<"
         | 
| 37 | 
            +
                - - "~>"
         | 
| 41 38 | 
             
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            -
                    version:  | 
| 39 | 
            +
                    version: '0.1'
         | 
| 43 40 | 
             
              type: :runtime
         | 
| 44 41 | 
             
              prerelease: false
         | 
| 45 42 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 46 43 | 
             
                requirements:
         | 
| 47 | 
            -
                - - " | 
| 44 | 
            +
                - - "~>"
         | 
| 48 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            -
                    version: 1 | 
| 50 | 
            -
                - - "<"
         | 
| 51 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 52 | 
            -
                    version: 2.0.0
         | 
| 46 | 
            +
                    version: '0.1'
         | 
| 53 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 54 48 | 
             
              name: tty-spinner
         | 
| 55 49 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -148,6 +142,7 @@ files: | |
| 148 142 | 
             
            - lib/puppet_litmus/rake_helper.rb
         | 
| 149 143 | 
             
            - lib/puppet_litmus/rake_tasks.rb
         | 
| 150 144 | 
             
            - lib/puppet_litmus/spec_helper_acceptance.rb
         | 
| 145 | 
            +
            - lib/puppet_litmus/util.rb
         | 
| 151 146 | 
             
            - lib/puppet_litmus/version.rb
         | 
| 152 147 | 
             
            - spec/data/doot.tar.gz
         | 
| 153 148 | 
             
            - spec/data/inventory.yaml
         | 
| @@ -156,6 +151,7 @@ files: | |
| 156 151 | 
             
            - spec/lib/puppet_litmus/puppet_helpers_spec.rb
         | 
| 157 152 | 
             
            - spec/lib/puppet_litmus/rake_helper_spec.rb
         | 
| 158 153 | 
             
            - spec/lib/puppet_litmus/rake_tasks_spec.rb
         | 
| 154 | 
            +
            - spec/lib/puppet_litmus/util_spec.rb
         | 
| 159 155 | 
             
            - spec/lib/puppet_litmus/version_spec.rb
         | 
| 160 156 | 
             
            - spec/spec_helper.rb
         | 
| 161 157 | 
             
            homepage: https://github.com/puppetlabs/puppet_litmus
         | 
| @@ -177,18 +173,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 177 173 | 
             
                - !ruby/object:Gem::Version
         | 
| 178 174 | 
             
                  version: '0'
         | 
| 179 175 | 
             
            requirements: []
         | 
| 180 | 
            -
            rubygems_version: 3. | 
| 176 | 
            +
            rubygems_version: 3.1.2
         | 
| 181 177 | 
             
            signing_key: 
         | 
| 182 178 | 
             
            specification_version: 4
         | 
| 183 179 | 
             
            summary: Providing a simple command line tool for puppet content creators, to enable
         | 
| 184 180 | 
             
              simple and complex test deployments.
         | 
| 185 181 | 
             
            test_files:
         | 
| 186 | 
            -
            - spec/ | 
| 187 | 
            -
            - spec/data/inventory.yaml
         | 
| 188 | 
            -
            - spec/data/jim.yaml
         | 
| 189 | 
            -
            - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
         | 
| 190 | 
            -
            - spec/lib/puppet_litmus/puppet_helpers_spec.rb
         | 
| 191 | 
            -
            - spec/lib/puppet_litmus/rake_helper_spec.rb
         | 
| 182 | 
            +
            - spec/spec_helper.rb
         | 
| 192 183 | 
             
            - spec/lib/puppet_litmus/rake_tasks_spec.rb
         | 
| 193 184 | 
             
            - spec/lib/puppet_litmus/version_spec.rb
         | 
| 194 | 
            -
            - spec/ | 
| 185 | 
            +
            - spec/lib/puppet_litmus/util_spec.rb
         | 
| 186 | 
            +
            - spec/lib/puppet_litmus/inventory_manipulation_spec.rb
         | 
| 187 | 
            +
            - spec/lib/puppet_litmus/rake_helper_spec.rb
         | 
| 188 | 
            +
            - spec/lib/puppet_litmus/puppet_helpers_spec.rb
         | 
| 189 | 
            +
            - spec/data/doot.tar.gz
         | 
| 190 | 
            +
            - spec/data/jim.yaml
         | 
| 191 | 
            +
            - spec/data/inventory.yaml
         |