inspec 0.9.9 → 0.9.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -2
- data/README.md +5 -1
- data/bin/os +23 -0
- data/examples/kitchen-ansible/.kitchen/default-centos-71.yml +6 -0
- data/examples/kitchen-ansible/.kitchen/default-ubuntu-1204.yml +6 -0
- data/examples/kitchen-ansible/.kitchen/default-ubuntu-1404.yml +6 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-centos-71/Vagrantfile +9 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1204/Vagrantfile +9 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-ansible/.kitchen/kitchen-vagrant/kitchen-kitchen-ansible-default-ubuntu-1404/Vagrantfile +9 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-centos-71.log +4 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1204.log +4 -0
- data/examples/kitchen-ansible/.kitchen/logs/default-ubuntu-1404.log +4 -0
- data/examples/kitchen-ansible/.kitchen/logs/kitchen.log +8 -0
- data/examples/kitchen-ansible/Gemfile.lock +154 -0
- data/examples/kitchen-chef/.kitchen/default-centos-71.yml +6 -0
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1204.yml +6 -0
- data/examples/kitchen-chef/.kitchen/default-ubuntu-1404.yml +6 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-centos-71/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1204/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/examples/kitchen-chef/.kitchen/kitchen-vagrant/kitchen-kitchen-chef-default-ubuntu-1404/Vagrantfile +9 -0
- data/examples/kitchen-chef/.kitchen/logs/default-centos-71.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1204.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/default-ubuntu-1404.log +4 -0
- data/examples/kitchen-chef/.kitchen/logs/kitchen.log +8 -0
- data/examples/kitchen-chef/Berksfile.lock +11 -0
- data/examples/kitchen-chef/Gemfile.lock +223 -0
- data/examples/kitchen-puppet/.bundle/config +2 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-centos-71.log +5 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1204.log +5 -0
- data/examples/kitchen-puppet/.kitchen/logs/default-ubuntu-1404.log +5 -0
- data/examples/kitchen-puppet/.kitchen/logs/kitchen.log +5 -0
- data/examples/kitchen-puppet/.librarian/puppet/config +2 -0
- data/examples/kitchen-puppet/Gemfile.lock +174 -0
- data/examples/kitchen-puppet/Puppetfile.lock +2 -0
- data/examples/profile/libraries/.DS_Store +0 -0
- data/examples/test-kitchen/.kitchen/logs/default-centos-71.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1204.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/default-ubuntu-1404.log +5 -0
- data/examples/test-kitchen/.kitchen/logs/kitchen.log +5 -0
- data/examples/test-kitchen/Berksfile.lock +11 -0
- data/examples/test-kitchen/Gemfile.lock +233 -0
- data/inspec.gemspec +2 -2
- data/lib/.DS_Store +0 -0
- data/lib/extras/compliance/README.md +15 -0
- data/lib/extras/compliance/compliance.rb +245 -0
- data/lib/inspec/metadata.rb +3 -1
- data/lib/inspec/profile.rb +2 -0
- data/lib/inspec/profile_context.rb +34 -63
- data/lib/inspec/resource.rb +23 -0
- data/lib/inspec/runner.rb +17 -35
- data/lib/inspec/runner_mock.rb +31 -0
- data/lib/inspec/runner_rspec.rb +94 -0
- data/lib/inspec/targets/dir.rb +2 -4
- data/lib/inspec/version.rb +1 -1
- data/{test/unit/mock/profiles/complete-meta/test/.gitkeep → lib/resources/certificate.rb} +0 -0
- data/lib/resources/command.rb +1 -1
- data/lib/resources/postgres_session.rb +10 -15
- data/{test/unit/mock/profiles/custom-resource/test/.gitkeep → lib/resources/private_key.rb} +0 -0
- data/lib/resources/registry_key.rb +10 -6
- data/lib/resources/service.rb +232 -63
- data/test/chefdk/.gitignore +16 -0
- data/test/chefdk/.kitchen.yml +27 -0
- data/test/chefdk/Policyfile.rb +16 -0
- data/test/chefdk/README.md +4 -0
- data/test/chefdk/chefignore +100 -0
- data/test/chefdk/metadata.rb +7 -0
- data/test/chefdk/recipes/default.rb +5 -0
- data/test/chefdk/spec/spec_helper.rb +2 -0
- data/test/chefdk/spec/unit/recipes/default_spec.rb +20 -0
- data/test/chefdk/test/integration/default/serverspec/default_spec.rb +9 -0
- data/test/chefdk/test/integration/helpers/serverspec/spec_helper.rb +8 -0
- data/test/docker_run.rb +5 -1
- data/test/docker_test.rb +1 -2
- data/test/helper.rb +1 -0
- data/test/integration/.kitchen/default-aws-linux.yml +4 -0
- data/test/integration/.kitchen/default-centos-7.yml +4 -0
- data/test/integration/.kitchen/default-debian-8.yml +4 -0
- data/test/integration/.kitchen/default-fedora-22.yml +4 -0
- data/test/integration/.kitchen/default-redhat-65.yml +4 -0
- data/test/integration/.kitchen/default-redhat-71.yml +4 -0
- data/test/integration/.kitchen/default-suse-11sp3.yml +4 -0
- data/test/integration/.kitchen/default-suse-12.yml +4 -0
- data/test/integration/.kitchen/default-ubuntu-1204.yml +3 -0
- data/test/integration/.kitchen/default-ubuntu-1404.yml +4 -0
- data/test/integration/.kitchen/default-windows-2012.yml +1 -0
- data/test/integration/.kitchen/default-windows-2012r2.yml +2 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-centos-67-i386/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-fedora-22/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-modernIE-w10-edge/Vagrantfile +8 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1204/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-ubuntu-1404/Vagrantfile +9 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-default-windows-2012R2-matt/Vagrantfile +8 -0
- data/test/integration/.kitchen/kitchen-vagrant/kitchen-integration-new-ubuntu-1404/Vagrantfile +9 -0
- data/test/{unit/mock/profiles/empty/metadata.rb → integration/.kitchen/logs/default-aws-linux.log} +0 -0
- data/test/integration/.kitchen/logs/default-centos-511-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-centos-511.log +2 -0
- data/test/integration/.kitchen/logs/default-centos-67-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-centos-67.log +2 -0
- data/test/integration/.kitchen/logs/default-centos-7.log +0 -0
- data/test/integration/.kitchen/logs/default-centos-71.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-6010-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-6010.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-78-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-78.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-8.log +0 -0
- data/test/integration/.kitchen/logs/default-debian-81-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-debian-81.log +2 -0
- data/test/integration/.kitchen/logs/default-fedora-21-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-fedora-21.log +2 -0
- data/test/integration/.kitchen/logs/default-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/default-freebsd-102.log +2 -0
- data/test/integration/.kitchen/logs/default-freebsd-93.log +2 -0
- data/test/integration/.kitchen/logs/default-mint-172-cinnamon.log +2 -0
- data/test/integration/.kitchen/logs/default-modernIE-w10-edge.log +2 -0
- data/test/integration/.kitchen/logs/default-modernIE-w7-ie11.log +2 -0
- data/test/integration/.kitchen/logs/default-modernIE-w81-ie11.log +2 -0
- data/test/integration/.kitchen/logs/default-opensuse-132-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-opensuse-132-x86-64.log +2 -0
- data/test/integration/.kitchen/logs/default-opentable-win-2008r2-standard-amd64-nocm.log +0 -0
- data/test/integration/.kitchen/logs/default-opentable-win-2012r2-standard-amd64-nocm.log +0 -0
- data/test/integration/.kitchen/logs/default-redhat-65.log +0 -0
- data/test/integration/.kitchen/logs/default-redhat-71.log +0 -0
- data/test/integration/.kitchen/logs/default-suse-11sp3.log +0 -0
- data/test/integration/.kitchen/logs/default-suse-12.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1004-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1004.log +2 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1204-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1204.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1404-i386.log +2 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1404.log +0 -0
- data/test/integration/.kitchen/logs/default-ubuntu-1510.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2008-opentable.log +2 -0
- data/test/integration/.kitchen/logs/default-windows-2008.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012.log +0 -0
- data/test/integration/.kitchen/logs/default-windows-2012R2-matt.log +2 -0
- data/test/integration/.kitchen/logs/default-windows-2012r2-opentable.log +2 -0
- data/test/integration/.kitchen/logs/default-windows-2012r2.log +41 -0
- data/test/integration/.kitchen/logs/kitchen.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-511-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-511.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-67-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-67.log +0 -0
- data/test/integration/.kitchen/logs/new-centos-71.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-6010-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-6010.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-78-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-78.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-81-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-debian-81.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-21-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-21.log +0 -0
- data/test/integration/.kitchen/logs/new-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/new-freebsd-102.log +0 -0
- data/test/integration/.kitchen/logs/new-freebsd-93.log +0 -0
- data/test/integration/.kitchen/logs/new-opensuse-132-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-opensuse-132-x86-64.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1004-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1004.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1204-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1204.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1404-i386.log +0 -0
- data/test/integration/.kitchen/logs/new-ubuntu-1404.log +3 -0
- data/test/integration/.kitchen/logs/test-centos-511-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-511.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-67-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-67.log +0 -0
- data/test/integration/.kitchen/logs/test-centos-71.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-6010-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-6010.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-78-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-78.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-81-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-debian-81.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-21-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-21.log +0 -0
- data/test/integration/.kitchen/logs/test-fedora-22.log +0 -0
- data/test/integration/.kitchen/logs/test-freebsd-102.log +0 -0
- data/test/integration/.kitchen/logs/test-freebsd-93.log +0 -0
- data/test/integration/.kitchen/logs/test-opensuse-132-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-opensuse-132-x86-64.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1004-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1004.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1204-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1204.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1404-i386.log +0 -0
- data/test/integration/.kitchen/logs/test-ubuntu-1404.log +0 -0
- data/test/integration/.kitchen/new-ubuntu-1404.yml +1 -0
- data/test/integration/Berksfile +1 -0
- data/test/integration/Berksfile.lock +27 -0
- data/test/integration/TODO.md +15 -0
- data/test/integration/cookbooks/os_prepare/files/empty.iso +0 -0
- data/test/integration/cookbooks/os_prepare/metadata.rb +2 -0
- data/test/integration/cookbooks/os_prepare/recipes/_runit_service_centos.rb +34 -0
- data/test/integration/cookbooks/os_prepare/recipes/default.rb +1 -0
- data/test/integration/cookbooks/os_prepare/recipes/mount.rb +5 -5
- data/test/integration/cookbooks/os_prepare/recipes/postgres.rb +12 -0
- data/test/integration/cookbooks/os_prepare/recipes/service.rb +6 -2
- data/test/integration/cookbooks/os_prepare/templates/default/sv-default-svlog-run.erb +3 -0
- data/test/integration/test/.DS_Store +0 -0
- data/test/integration/test/integration/.DS_Store +0 -0
- data/test/integration/test/integration/default/.DS_Store +0 -0
- data/test/integration/test/integration/default/certificate_spec.rb +7 -0
- data/test/integration/test/integration/default/file_spec.rb +2 -2
- data/test/integration/test/integration/default/mount_spec.rb +1 -1
- data/test/integration/test/integration/default/postgres_session_spec.rb +9 -0
- data/test/integration/test/integration/default/service_spec.rb +34 -0
- data/test/mac/service_spec.rb +5 -0
- data/test/serverspec/.kitchen.yml +18 -0
- data/test/serverspec/.kitchen/default-ubuntu-1404.yml +6 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/action_set_name +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/creator_uid +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/id +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/index_uuid +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key +27 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/.vagrant/machines/default/virtualbox/synced_folders +1 -0
- data/test/serverspec/.kitchen/kitchen-vagrant/kitchen-serverspec-default-ubuntu-1404/Vagrantfile +9 -0
- data/test/serverspec/.kitchen/logs/default-ubuntu-1404.log +2 -0
- data/test/serverspec/.kitchen/logs/kitchen.log +3 -0
- data/test/serverspec/Berksfile +3 -0
- data/test/serverspec/Berksfile.lock +5 -0
- data/test/serverspec/TODO.md +2 -0
- data/test/serverspec/test/integration/default/serverspec/os_spec.rb +25 -0
- data/test/serverspec/test/integration/default/serverspec/spec_helper.rb +48 -0
- data/test/serverspec/test/integration/default/serverspec/sysctl_spec.rb +37 -0
- data/test/unit/metadata_test.rb +13 -1
- data/test/unit/mock/profiles/complete-metadata/inspec.yml +7 -0
- data/test/unit/mock/profiles/empty-metadata/inspec.yml +0 -0
- data/test/unit/mock/profiles/{complete-meta → legacy-complete-metadata}/metadata.rb +0 -0
- data/test/unit/mock/profiles/legacy-complete-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/controls/.gitkeep +0 -0
- data/test/unit/mock/profiles/legacy-empty-metadata/metadata.rb +0 -0
- data/test/unit/mock/profiles/{metadata → legacy-simple-metadata}/metadata.rb +0 -0
- data/test/unit/mock/profiles/legacy-simple-metadata/test/.gitkeep +0 -0
- data/test/unit/mock/profiles/simple-metadata/inspec.yml +1 -0
- data/test/unit/profile_test.rb +82 -31
- data/test/unit/resources/service_test.rb +67 -3
- metadata +466 -23
- data/examples/resource/controls/tiny.rb +0 -3
- data/examples/resource/inspec.yml +0 -10
- data/examples/resource/libraries/tiny.rb +0 -3
- data/lib/inspec/targets/url.rb.orig +0 -87
- data/test/unit/mock/profiles/custom-resource/libraries/resource.rb +0 -3
- data/test/unit/mock/profiles/custom-resource/metadata.rb +0 -7
data/inspec.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Inspec::VERSION
|
9
9
|
spec.authors = ['Dominik Richter']
|
10
10
|
spec.email = ['dominik.richter@gmail.com']
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Infrastructure and compliance testing.'
|
12
|
+
spec.description = 'InSpec provides a framework for creating end-to-end infrastructure tests. You can use it for integration or even compliance testing. Create fully portable test profiles and use them in your workflow to ensure stability and security. Integrate InSpec in your change lifecycle for local testing, CI/CD, and deployment verification.'
|
13
13
|
spec.homepage = 'https://github.com/chef/inspec'
|
14
14
|
spec.license = 'Apache 2.0'
|
15
15
|
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# InSpec Extension for Chef Compliance
|
2
|
+
|
3
|
+
This extensions offers the following features:
|
4
|
+
|
5
|
+
- list profiles available in Chef Compliance
|
6
|
+
- execute profiles from Chef Compliance
|
7
|
+
- upload a local profile to Chef Compliance
|
8
|
+
|
9
|
+
To use the CLI, this extra package adds the following commands:
|
10
|
+
|
11
|
+
* `$ inspec compliance login user password` - retieves a authentication token from Chef Compliance
|
12
|
+
* `$ inspec compliance list` - list all available profiles in Chef Compliance
|
13
|
+
* `$ inspec exec profile` - runs a profile that is stored on Chef Compliance
|
14
|
+
* `$ inspec compliance upload path/to/local/profile` - uploads a local command to Chef Compliance
|
15
|
+
* `$ inspec compliance logout` - removes the authentication token from the local cache and logs out of the Chef Compliance server
|
@@ -0,0 +1,245 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
# author: Christoph Hartmann
|
4
|
+
|
5
|
+
require 'thor'
|
6
|
+
require 'net/http'
|
7
|
+
require 'uri'
|
8
|
+
|
9
|
+
# TODO:
|
10
|
+
# - invalidate token
|
11
|
+
# - fix file upload and genereate tar if required
|
12
|
+
# - hook into exec with a new target helper
|
13
|
+
|
14
|
+
class ComplianceCLI < Thor
|
15
|
+
namespace 'compliance'
|
16
|
+
|
17
|
+
desc 'login SERVER', 'Log in to a Chef Compliance SERVER'
|
18
|
+
options :username => :required, :password => :required
|
19
|
+
def login(server)
|
20
|
+
config = Compliance::Configuration.new
|
21
|
+
config['server'] = server
|
22
|
+
url = "#{server}/oauth/token"
|
23
|
+
|
24
|
+
data = post(url, options['username'], options['password'])
|
25
|
+
if !data.nil?
|
26
|
+
tokendata = JSON.parse(data)
|
27
|
+
if tokendata['access_token']
|
28
|
+
config['token'] = tokendata['access_token']
|
29
|
+
puts "Successfully authenticated"
|
30
|
+
else
|
31
|
+
puts 'Reponse does not include a token'
|
32
|
+
end
|
33
|
+
else
|
34
|
+
puts "Authentication failed for Server: #{url}"
|
35
|
+
end
|
36
|
+
config.store
|
37
|
+
end
|
38
|
+
|
39
|
+
desc 'list', 'list all available profiles in Chef Compliance'
|
40
|
+
def list
|
41
|
+
profiles = get_profiles
|
42
|
+
if !profiles.empty?
|
43
|
+
# iterate over profiles
|
44
|
+
puts "Available profiles: "
|
45
|
+
profiles.each { |profile|
|
46
|
+
puts " * #{profile[:org]}/#{profile[:name]}"
|
47
|
+
}
|
48
|
+
else
|
49
|
+
puts "Could not reach server #{url}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'exec PROFILE', 'executes a profile from Chef Compliance'
|
54
|
+
def exec(profile)
|
55
|
+
config = Compliance::Configuration.new
|
56
|
+
profiles = get_profiles
|
57
|
+
if !profiles.empty?
|
58
|
+
# 1. verify that the profile exists (list)
|
59
|
+
index = profiles.index { |p| "#{p[:org]}/#{p[:name]}" == profile }
|
60
|
+
if index >= 0
|
61
|
+
p = profiles[index]
|
62
|
+
# 2. execute the profile with the proper url, inject `inspec exec` with the suitable params`
|
63
|
+
url = "#{config['server']}/owners/#{p[:org]}/compliance/#{p[:name]}/tar"
|
64
|
+
puts "b bin/inspec exec #{url} --user #{config['token']}"
|
65
|
+
end
|
66
|
+
else
|
67
|
+
puts "The profile #{profile} is not available"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
desc 'upload PATH', 'uploads a local profile to Chef Compliance'
|
72
|
+
def upload(path)
|
73
|
+
# 1. detect if tar or folder
|
74
|
+
# 2. archive if folder
|
75
|
+
# 3. check if tar is a compliance profile
|
76
|
+
# 4. show result and confirm upload to the user (skip with --force)
|
77
|
+
# 5. upload tar to server
|
78
|
+
|
79
|
+
# find the tar
|
80
|
+
config = Compliance::Configuration.new
|
81
|
+
tar_path = File.join(Dir.pwd, 'profile.tar.gz')
|
82
|
+
|
83
|
+
owner = 'admin'
|
84
|
+
profile = 'profile'
|
85
|
+
url = "#{config['server']}/owners/#{owner}/compliance/#{profile}/tar"
|
86
|
+
|
87
|
+
puts "Uploading to #{url}"
|
88
|
+
if post_file(url, config['token'], '', tar_path)
|
89
|
+
puts "Successfully uploaded profile"
|
90
|
+
else
|
91
|
+
puts "Error during profile upload"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
desc 'version', 'displays the version of the Chef Compliance server'
|
96
|
+
def version
|
97
|
+
config = Compliance::Configuration.new
|
98
|
+
url = "#{config['server']}/version"
|
99
|
+
|
100
|
+
data = get(url, nil, nil)
|
101
|
+
if !data.nil?
|
102
|
+
info = JSON.parse(data)
|
103
|
+
puts "Chef Compliance version: #{info['version']}"
|
104
|
+
else
|
105
|
+
puts "Could not reach server #{url}"
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
desc 'logout', 'user logout from Chef Compliance'
|
110
|
+
def logout
|
111
|
+
config = Compliance::Configuration.new
|
112
|
+
url = "#{config['server']}/logout"
|
113
|
+
data = post(url, config['token'], nil)
|
114
|
+
if !data.nil?
|
115
|
+
puts "Successfully logged out"
|
116
|
+
else
|
117
|
+
puts "Could not log out"
|
118
|
+
end
|
119
|
+
config.destroy
|
120
|
+
end
|
121
|
+
|
122
|
+
private
|
123
|
+
|
124
|
+
def get_profiles
|
125
|
+
config = Compliance::Configuration.new
|
126
|
+
|
127
|
+
url = "#{config['server']}/user/compliance"
|
128
|
+
data = get(url, config['token'], '')
|
129
|
+
|
130
|
+
if !data.nil?
|
131
|
+
profiles = JSON.parse(data)
|
132
|
+
val = []
|
133
|
+
# iterate over profiles
|
134
|
+
profiles.each_key { |org|
|
135
|
+
profiles[org].each_key { |name|
|
136
|
+
val.push({ org: org, name: name})
|
137
|
+
}
|
138
|
+
}
|
139
|
+
val
|
140
|
+
else
|
141
|
+
[]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def get(url, username, password)
|
146
|
+
uri = URI.parse(url)
|
147
|
+
req = Net::HTTP::Get.new(uri.path)
|
148
|
+
req.basic_auth username, password
|
149
|
+
|
150
|
+
send_request(uri, req)
|
151
|
+
end
|
152
|
+
|
153
|
+
def post(url, username, password)
|
154
|
+
# form request
|
155
|
+
uri = URI.parse(url)
|
156
|
+
req = Net::HTTP::Post.new(uri.path)
|
157
|
+
req.basic_auth username, password
|
158
|
+
req.form_data={}
|
159
|
+
|
160
|
+
send_request(uri, req)
|
161
|
+
end
|
162
|
+
|
163
|
+
# upload a file
|
164
|
+
def post_file(url, username, password, file_path)
|
165
|
+
uri = URI.parse(url)
|
166
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
167
|
+
req = Net::HTTP::Post.new(uri.path)
|
168
|
+
req.basic_auth username, password
|
169
|
+
|
170
|
+
req.body_stream=File.open(file_path)
|
171
|
+
req["Content-Type"] = "multipart/form-data"
|
172
|
+
req.add_field('Content-Length', File.size(file_path))
|
173
|
+
req.add_field('Content-Type', 'application/x-gtar')
|
174
|
+
|
175
|
+
boundary = "INSPEC-PROFILE-UPLOAD"
|
176
|
+
req.add_field('session', boundary)
|
177
|
+
res=http.request(req)
|
178
|
+
|
179
|
+
# puts "Response #{response.code} #{response.message}"
|
180
|
+
# puts "#{response.body}"
|
181
|
+
# puts "Headers: #{response.to_hash.inspect}"
|
182
|
+
|
183
|
+
res.is_a?(Net::HTTPSuccess)
|
184
|
+
end
|
185
|
+
|
186
|
+
def send_request(uri, req)
|
187
|
+
# send request
|
188
|
+
res = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') {|http|
|
189
|
+
http.request(req)
|
190
|
+
}
|
191
|
+
if res.is_a?(Net::HTTPSuccess)
|
192
|
+
res.body
|
193
|
+
else
|
194
|
+
nil
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
module Compliance
|
200
|
+
class Configuration
|
201
|
+
|
202
|
+
def initialize
|
203
|
+
@config_path = File.join(ENV['HOME'], '/.inspec')
|
204
|
+
# ensure the directory is available
|
205
|
+
unless File.directory?(@config_path)
|
206
|
+
FileUtils.mkdir_p(@config_path)
|
207
|
+
end
|
208
|
+
# set config file pasth
|
209
|
+
@config_file = File.join(@config_path, '/config.json')
|
210
|
+
@config = {}
|
211
|
+
|
212
|
+
# load the data
|
213
|
+
get
|
214
|
+
end
|
215
|
+
|
216
|
+
# direct access to config
|
217
|
+
def [](key)
|
218
|
+
@config[key]
|
219
|
+
end
|
220
|
+
|
221
|
+
def []=(key, value)
|
222
|
+
@config[key] = value
|
223
|
+
end
|
224
|
+
|
225
|
+
# return the json data
|
226
|
+
def get
|
227
|
+
if File.exists?(@config_file)
|
228
|
+
file = File.read(@config_file)
|
229
|
+
@config = JSON.parse(file)
|
230
|
+
end
|
231
|
+
@config
|
232
|
+
end
|
233
|
+
|
234
|
+
# stores a hash to json
|
235
|
+
def store
|
236
|
+
File.open(@config_file,"w") do |f|
|
237
|
+
f.write(@config.to_json)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def destroy
|
242
|
+
File.delete(@config_file)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
data/lib/inspec/metadata.rb
CHANGED
@@ -73,7 +73,9 @@ module Inspec
|
|
73
73
|
family = try_support[:'os-family']
|
74
74
|
release = try_support[:release]
|
75
75
|
elsif entry.is_a?(String)
|
76
|
-
@logger.warn(
|
76
|
+
@logger.warn(
|
77
|
+
"Do not use deprecated `supports: #{entry}` syntax. Instead use "\
|
78
|
+
"`supports: {os-family: #{entry}}`.")
|
77
79
|
family = entry
|
78
80
|
end
|
79
81
|
|
data/lib/inspec/profile.rb
CHANGED
@@ -33,11 +33,13 @@ module Inspec
|
|
33
33
|
@params = @metadata.params
|
34
34
|
# use the id from parameter, name or fallback to nil
|
35
35
|
@profile_id = options[:id] || params[:name] || nil
|
36
|
+
@params[:name] = @profile_id
|
36
37
|
|
37
38
|
@params[:rules] = rules = {}
|
38
39
|
@runner = Runner.new(
|
39
40
|
id: @profile_id,
|
40
41
|
backend: :mock,
|
42
|
+
test_collector: @options.delete(:test_collector),
|
41
43
|
)
|
42
44
|
@runner.add_tests([@path], @options)
|
43
45
|
@runner.rules.each do |id, rule|
|
@@ -4,11 +4,10 @@
|
|
4
4
|
|
5
5
|
require 'inspec/rule'
|
6
6
|
require 'inspec/dsl'
|
7
|
-
require 'rspec/core/dsl'
|
8
7
|
require 'securerandom'
|
9
8
|
|
10
9
|
module Inspec
|
11
|
-
class ProfileContext
|
10
|
+
class ProfileContext
|
12
11
|
attr_reader :rules, :only_ifs
|
13
12
|
def initialize(profile_id, backend, profile_registry = {}, only_ifs = [])
|
14
13
|
if backend.nil?
|
@@ -25,9 +24,8 @@ module Inspec
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def reload_dsl
|
28
|
-
|
29
|
-
|
30
|
-
ctx = create_context(outer_dsl)
|
27
|
+
resources_dsl = Inspec::Resource.create_dsl(@backend)
|
28
|
+
ctx = create_context(resources_dsl, rule_context(resources_dsl))
|
31
29
|
@profile_context = ctx.new
|
32
30
|
end
|
33
31
|
|
@@ -66,36 +64,42 @@ module Inspec
|
|
66
64
|
|
67
65
|
private
|
68
66
|
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# which is specified via the backend argument.
|
67
|
+
# Create the context for controls. This includes all components of the DSL,
|
68
|
+
# including matchers and resources.
|
72
69
|
#
|
73
|
-
# @param
|
74
|
-
# @return [
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
70
|
+
# @param [ResourcesDSL] resources_dsl which has all resources to attach
|
71
|
+
# @return [RuleContext] the inner context of rules
|
72
|
+
def rule_context(resources_dsl)
|
73
|
+
require 'rspec/core/dsl'
|
74
|
+
Class.new(Inspec::Rule) do
|
75
|
+
include RSpec::Core::DSL
|
76
|
+
include resources_dsl
|
82
77
|
end
|
83
78
|
end
|
84
79
|
|
85
|
-
# Creates the
|
86
|
-
#
|
80
|
+
# Creates the heart of the profile context:
|
81
|
+
# An instantiated object which has all resources registered to it
|
82
|
+
# and exposes them to the a test file. The profile context serves as a
|
83
|
+
# container for all profiles which are registered. Within the context
|
84
|
+
# profiles get access to all DSL calls for creating tests and controls.
|
87
85
|
#
|
88
|
-
# @param
|
89
|
-
# @return [
|
90
|
-
def
|
91
|
-
|
92
|
-
include RSpec::Core::DSL
|
93
|
-
include dsl
|
94
|
-
end
|
86
|
+
# @param outer_dsl [OuterDSLClass]
|
87
|
+
# @return [ProfileContextClass]
|
88
|
+
def create_context(resources_dsl, rule_class)
|
89
|
+
profile_context_owner = self
|
95
90
|
|
96
91
|
# rubocop:disable Lint/NestedMethodDefinition
|
97
92
|
Class.new do
|
98
|
-
include
|
93
|
+
include Inspec::DSL
|
94
|
+
include resources_dsl
|
95
|
+
|
96
|
+
define_method :title do |arg|
|
97
|
+
profile_context_owner.set_header(:title, arg)
|
98
|
+
end
|
99
|
+
|
100
|
+
def to_s
|
101
|
+
'Profile Context Run'
|
102
|
+
end
|
99
103
|
|
100
104
|
define_method :control do |*args, &block|
|
101
105
|
id = args[0]
|
@@ -107,7 +111,7 @@ module Inspec
|
|
107
111
|
# controls.
|
108
112
|
return if @skip_profile && os[:family] != 'unknown'
|
109
113
|
|
110
|
-
|
114
|
+
profile_context_owner.register_rule(rule_class.new(id, opts, &block))
|
111
115
|
end
|
112
116
|
|
113
117
|
alias_method :rule, :control
|
@@ -119,7 +123,7 @@ module Inspec
|
|
119
123
|
rule = rule_class.new(id, {}) do
|
120
124
|
describe(*args, &block)
|
121
125
|
end
|
122
|
-
|
126
|
+
profile_context_owner.register_rule(rule, &block)
|
123
127
|
end
|
124
128
|
|
125
129
|
# TODO: mock method for attributes; import attribute handling
|
@@ -128,7 +132,7 @@ module Inspec
|
|
128
132
|
end
|
129
133
|
|
130
134
|
def skip_control(id)
|
131
|
-
|
135
|
+
profile_context_owner.unregister_rule(id)
|
132
136
|
end
|
133
137
|
|
134
138
|
alias_method :skip_rule, :skip_control
|
@@ -140,38 +144,5 @@ module Inspec
|
|
140
144
|
end
|
141
145
|
# rubocop:enable all
|
142
146
|
end
|
143
|
-
|
144
|
-
# Creates the heart of the profile context:
|
145
|
-
# An instantiated object which has all resources registered to it
|
146
|
-
# and exposes them to the a test file. The profile context serves as a
|
147
|
-
# container for all profiles which are registered. Within the context
|
148
|
-
# profiles get access to all DSL calls for creating tests and controls.
|
149
|
-
#
|
150
|
-
# @param outer_dsl [OuterDSLClass]
|
151
|
-
# @return [ProfileContextClass]
|
152
|
-
def create_context(outer_dsl)
|
153
|
-
profile_context_owner = self
|
154
|
-
|
155
|
-
# rubocop:disable Lint/NestedMethodDefinition
|
156
|
-
Class.new(outer_dsl) do
|
157
|
-
include Inspec::DSL
|
158
|
-
|
159
|
-
define_method :title do |arg|
|
160
|
-
profile_context_owner.set_header(:title, arg)
|
161
|
-
end
|
162
|
-
|
163
|
-
define_method :__register_rule do |*args|
|
164
|
-
profile_context_owner.register_rule(*args)
|
165
|
-
end
|
166
|
-
define_method :__unregister_rule do |*args|
|
167
|
-
profile_context_owner.unregister_rule(*args)
|
168
|
-
end
|
169
|
-
|
170
|
-
def to_s
|
171
|
-
'Profile Context Run'
|
172
|
-
end
|
173
|
-
end
|
174
|
-
# rubocop:enable all
|
175
|
-
end
|
176
147
|
end
|
177
148
|
end
|