inspec 0.9.9 → 0.9.10
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/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/lib/inspec/resource.rb
CHANGED
|
@@ -11,8 +11,31 @@ module Inspec
|
|
|
11
11
|
def self.registry
|
|
12
12
|
@registry ||= {}
|
|
13
13
|
end
|
|
14
|
+
|
|
15
|
+
# Creates the inner DSL which includes all resources for
|
|
16
|
+
# creating tests. It is always connected to one target,
|
|
17
|
+
# which is specified via the backend argument.
|
|
18
|
+
#
|
|
19
|
+
# @param backend [BackendRunner] exposing the target to resources
|
|
20
|
+
# @return [ResourcesDSL]
|
|
21
|
+
def self.create_dsl(backend)
|
|
22
|
+
# need the local name, to use it in the module creation further down
|
|
23
|
+
my_registry = registry
|
|
24
|
+
Module.new do
|
|
25
|
+
my_registry.each do |id, r|
|
|
26
|
+
define_method id.to_sym do |*args|
|
|
27
|
+
r.new(backend, id.to_s, *args)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
14
32
|
end
|
|
15
33
|
|
|
34
|
+
# Retrieve the base class for creating a new resource.
|
|
35
|
+
# Create classes that inherit from this class.
|
|
36
|
+
#
|
|
37
|
+
# @param [int] version the resource version to use
|
|
38
|
+
# @return [Resource] base class for creating a new resource
|
|
16
39
|
def self.resource(version)
|
|
17
40
|
if version != 1
|
|
18
41
|
fail 'Only resource version 1 is supported!'
|
data/lib/inspec/runner.rb
CHANGED
|
@@ -10,27 +10,28 @@ require 'inspec/profile_context'
|
|
|
10
10
|
require 'inspec/targets'
|
|
11
11
|
require 'inspec/metadata'
|
|
12
12
|
# spec requirements
|
|
13
|
-
require 'rspec'
|
|
14
|
-
require 'rspec/its'
|
|
15
|
-
require 'inspec/rspec_json_formatter'
|
|
16
13
|
|
|
17
14
|
module Inspec
|
|
18
15
|
class Runner # rubocop:disable Metrics/ClassLength
|
|
19
|
-
attr_reader :
|
|
16
|
+
attr_reader :backend, :rules
|
|
20
17
|
def initialize(conf = {})
|
|
21
18
|
@rules = {}
|
|
22
19
|
@profile_id = conf[:id]
|
|
23
20
|
@conf = conf.dup
|
|
24
21
|
@conf[:logger] ||= Logger.new(nil)
|
|
25
|
-
@tests = RSpec::Core::World.new
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
@test_collector = @conf.delete(:test_collector) || begin
|
|
24
|
+
require 'inspec/runner_rspec'
|
|
25
|
+
RunnerRspec.new(@conf)
|
|
26
|
+
end
|
|
29
27
|
|
|
30
|
-
configure_output
|
|
31
28
|
configure_transport
|
|
32
29
|
end
|
|
33
30
|
|
|
31
|
+
def tests
|
|
32
|
+
@test_collector.tests
|
|
33
|
+
end
|
|
34
|
+
|
|
34
35
|
def normalize_map(hm)
|
|
35
36
|
res = {}
|
|
36
37
|
hm.each {|k, v|
|
|
@@ -39,10 +40,6 @@ module Inspec
|
|
|
39
40
|
res
|
|
40
41
|
end
|
|
41
42
|
|
|
42
|
-
def configure_output
|
|
43
|
-
RSpec.configuration.add_formatter(@conf['format'] || 'progress')
|
|
44
|
-
end
|
|
45
|
-
|
|
46
43
|
def configure_transport
|
|
47
44
|
@backend = Inspec::Backend.create(@conf)
|
|
48
45
|
end
|
|
@@ -105,16 +102,12 @@ module Inspec
|
|
|
105
102
|
|
|
106
103
|
# process the resulting rules
|
|
107
104
|
ctx.rules.each do |rule_id, rule|
|
|
108
|
-
register_rule(
|
|
105
|
+
register_rule(rule_id, rule)
|
|
109
106
|
end
|
|
110
107
|
end
|
|
111
108
|
|
|
112
|
-
def run
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
def run_with(rspec_runner)
|
|
117
|
-
rspec_runner.run_specs(@tests.ordered_example_groups)
|
|
109
|
+
def run(with = nil)
|
|
110
|
+
@test_collector.run(with)
|
|
118
111
|
end
|
|
119
112
|
|
|
120
113
|
private
|
|
@@ -130,14 +123,14 @@ module Inspec
|
|
|
130
123
|
if !arg.empty? &&
|
|
131
124
|
arg[0].respond_to?(:resource_skipped) &&
|
|
132
125
|
!arg[0].resource_skipped.nil?
|
|
133
|
-
return
|
|
126
|
+
return @test_collector.example_group(*arg, opts) do
|
|
134
127
|
it arg[0].resource_skipped
|
|
135
128
|
end
|
|
136
129
|
else
|
|
137
130
|
# add the resource
|
|
138
131
|
case method_name
|
|
139
132
|
when 'describe'
|
|
140
|
-
return
|
|
133
|
+
return @test_collector.example_group(*arg, opts, &block)
|
|
141
134
|
when 'expect'
|
|
142
135
|
return block.example_group
|
|
143
136
|
else
|
|
@@ -148,7 +141,7 @@ module Inspec
|
|
|
148
141
|
nil
|
|
149
142
|
end
|
|
150
143
|
|
|
151
|
-
def register_rule(
|
|
144
|
+
def register_rule(rule_id, rule)
|
|
152
145
|
@rules[rule_id] = rule
|
|
153
146
|
checks = rule.instance_variable_get(:@checks)
|
|
154
147
|
checks.each do |m, a, b|
|
|
@@ -161,21 +154,10 @@ module Inspec
|
|
|
161
154
|
# the scope of this run, thus not gaining ony of the DSL pieces.
|
|
162
155
|
# To circumvent this, the full DSL is attached to the example's
|
|
163
156
|
# scope.
|
|
164
|
-
dsl =
|
|
157
|
+
dsl = Inspec::Resource.create_dsl(backend)
|
|
165
158
|
example.send(:include, dsl)
|
|
166
159
|
|
|
167
|
-
|
|
168
|
-
@tests.register(example)
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def set_rspec_ids(example, id)
|
|
173
|
-
example.metadata[:id] = id
|
|
174
|
-
example.filtered_examples.each do |e|
|
|
175
|
-
e.metadata[:id] = id
|
|
176
|
-
end
|
|
177
|
-
example.children.each do |child|
|
|
178
|
-
set_rspec_ids(child, id)
|
|
160
|
+
@test_collector.add_test(example, rule_id)
|
|
179
161
|
end
|
|
180
162
|
end
|
|
181
163
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# author: Dominik Richter
|
|
3
|
+
# author: Christoph Hartmann
|
|
4
|
+
|
|
5
|
+
module Inspec
|
|
6
|
+
class RunnerMock
|
|
7
|
+
attr_reader :tests
|
|
8
|
+
def initialize
|
|
9
|
+
@tests = []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def add_test(example, _rule_id)
|
|
13
|
+
@tests.push(example)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def example_group(*in_args, &in_block)
|
|
17
|
+
Class.new do
|
|
18
|
+
define_method :args do
|
|
19
|
+
in_args
|
|
20
|
+
end
|
|
21
|
+
define_method :block do
|
|
22
|
+
in_block
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def run(_with = nil)
|
|
28
|
+
puts 'uhm.... nothing or something... dunno, ask your admin'
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# author: Dominik Richter
|
|
3
|
+
# author: Christoph Hartmann
|
|
4
|
+
|
|
5
|
+
require 'rspec/core'
|
|
6
|
+
require 'rspec/its'
|
|
7
|
+
require 'inspec/rspec_json_formatter'
|
|
8
|
+
|
|
9
|
+
# There be dragons!! Or borgs, or something...
|
|
10
|
+
# This file and all its contents cannot yet be tested. Once it is included
|
|
11
|
+
# in our unit test suite, it deactivates all other checks completely.
|
|
12
|
+
# To circumvent this, we need functional tests which tackle the RSpec runner
|
|
13
|
+
# or a separate suite of unit tests to which get along with this.
|
|
14
|
+
|
|
15
|
+
module Inspec
|
|
16
|
+
class RunnerRspec
|
|
17
|
+
def initialize(conf)
|
|
18
|
+
@conf = conf
|
|
19
|
+
reset_tests
|
|
20
|
+
configure_output
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Create a new RSpec example group from arguments and block.
|
|
24
|
+
#
|
|
25
|
+
# @param [Type] *args list of arguments for this example
|
|
26
|
+
# @param [Type] &block the block associated with this example group
|
|
27
|
+
# @return [RSpecExampleGroup]
|
|
28
|
+
def example_group(*args, &block)
|
|
29
|
+
RSpec::Core::ExampleGroup.describe(*args, &block)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Add an example group to the list of registered tests.
|
|
33
|
+
#
|
|
34
|
+
# @param [RSpecExampleGroup] example test
|
|
35
|
+
# @param [String] rule_id the ID associated with this check
|
|
36
|
+
# @return [nil]
|
|
37
|
+
def add_test(example, rule_id)
|
|
38
|
+
set_rspec_ids(example, rule_id)
|
|
39
|
+
@tests.register(example)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Retrieve the list of tests that have been added.
|
|
43
|
+
#
|
|
44
|
+
# @return [Array] full list of tests
|
|
45
|
+
def tests
|
|
46
|
+
@tests.ordered_example_groups
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Run all registered tests with an optional test runner.
|
|
50
|
+
#
|
|
51
|
+
# @param [RSpecRunner] with is an optional RSpecRunner
|
|
52
|
+
# @return [int] 0 if all went well; otherwise nonzero
|
|
53
|
+
def run(with = nil)
|
|
54
|
+
with ||= RSpec::Core::Runner.new(nil)
|
|
55
|
+
with.run_specs(tests)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
# Empty the list of registered tests.
|
|
61
|
+
#
|
|
62
|
+
# @return [nil]
|
|
63
|
+
def reset_tests
|
|
64
|
+
@tests = RSpec::Core::World.new
|
|
65
|
+
# resets "pending examples" in reporter
|
|
66
|
+
RSpec.configuration.reset
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Configure the output formatter and stream to be used with RSpec.
|
|
70
|
+
#
|
|
71
|
+
# @return [nil]
|
|
72
|
+
def configure_output
|
|
73
|
+
RSpec.configuration.add_formatter(@conf['format'] || 'progress')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Make sure that all RSpec example groups use the provided ID.
|
|
77
|
+
# At the time of creation, we didn't yet have full ID support in RSpec,
|
|
78
|
+
# which is why they were added to metadata directly. This is evaluated
|
|
79
|
+
# by the InSpec adjusted json formatter (rspec_json_formatter).
|
|
80
|
+
#
|
|
81
|
+
# @param [RSpecExampleGroup] example object which contains a check
|
|
82
|
+
# @param [Type] id describe id
|
|
83
|
+
# @return [Type] description of returned object
|
|
84
|
+
def set_rspec_ids(example, id)
|
|
85
|
+
example.metadata[:id] = id
|
|
86
|
+
example.filtered_examples.each do |e|
|
|
87
|
+
e.metadata[:id] = id
|
|
88
|
+
end
|
|
89
|
+
example.children.each do |child|
|
|
90
|
+
set_rspec_ids(child, id)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
data/lib/inspec/targets/dir.rb
CHANGED
|
@@ -11,13 +11,11 @@ module Inspec::Targets
|
|
|
11
11
|
# TODO: remove `test` support for InSpec 1.0
|
|
12
12
|
class ProfileDir
|
|
13
13
|
def handles?(paths)
|
|
14
|
+
return true if paths.include?('inspec.yml')
|
|
14
15
|
(
|
|
15
16
|
!paths.grep(/^controls/).empty? ||
|
|
16
17
|
!paths.grep(/^test/).empty?
|
|
17
|
-
) && (
|
|
18
|
-
paths.include?('inspec.yml') ||
|
|
19
|
-
paths.include?('metadata.rb')
|
|
20
|
-
)
|
|
18
|
+
) && paths.include?('metadata.rb')
|
|
21
19
|
end
|
|
22
20
|
|
|
23
21
|
def get_libraries(paths)
|
data/lib/inspec/version.rb
CHANGED
|
File without changes
|
data/lib/resources/command.rb
CHANGED
|
@@ -49,7 +49,7 @@ class Cmd < Inspec.resource(1)
|
|
|
49
49
|
elsif inspec.os.unix?
|
|
50
50
|
res = inspec.backend.run_command("type \"#{@command}\"")
|
|
51
51
|
else
|
|
52
|
-
warn "`command(#{@command}).exist?` is not suported on
|
|
52
|
+
warn "`command(#{@command}).exist?` is not suported on your OS: #{inspec.os[:family]}"
|
|
53
53
|
return false
|
|
54
54
|
end
|
|
55
55
|
res.exit_status.to_i == 0
|
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
# license: All rights reserved
|
|
6
6
|
|
|
7
7
|
class Lines
|
|
8
|
+
attr_reader :output
|
|
9
|
+
|
|
8
10
|
def initialize(raw, desc)
|
|
9
|
-
@
|
|
11
|
+
@output = raw
|
|
10
12
|
@desc = desc
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
def output
|
|
14
|
-
@raw
|
|
15
|
-
end
|
|
16
|
-
|
|
17
15
|
def lines
|
|
18
|
-
|
|
16
|
+
output.split("\n")
|
|
19
17
|
end
|
|
20
18
|
|
|
21
19
|
def to_s
|
|
@@ -39,29 +37,26 @@ class PostgresSession < Inspec.resource(1)
|
|
|
39
37
|
@pass = pass
|
|
40
38
|
end
|
|
41
39
|
|
|
42
|
-
def query(query, db = []
|
|
40
|
+
def query(query, db = [])
|
|
43
41
|
dbs = db.map { |x| "-d #{x}" }.join(' ')
|
|
44
42
|
# TODO: simple escape, must be handled by a library
|
|
45
43
|
# that does this securely
|
|
46
44
|
escaped_query = query.gsub(/\\/, '\\\\').gsub(/"/, '\\"').gsub(/\$/, '\\$')
|
|
47
45
|
# run the query
|
|
48
|
-
cmd = inspec.command("PGPASSWORD='#{@pass}' psql -U #{@user} #{dbs} -c \"#{escaped_query}\"")
|
|
46
|
+
cmd = inspec.command("PGPASSWORD='#{@pass}' psql -U #{@user} #{dbs} -h localhost -c \"#{escaped_query}\"")
|
|
49
47
|
out = cmd.stdout + "\n" + cmd.stderr
|
|
50
|
-
if
|
|
48
|
+
if cmd.exit_status != 0 or
|
|
49
|
+
out =~ /could not connect to .*/ or
|
|
51
50
|
out.downcase =~ /^error/
|
|
52
51
|
# skip this test if the server can't run the query
|
|
53
|
-
|
|
54
|
-
it 'is skipped', skip: out do
|
|
55
|
-
end
|
|
56
|
-
end
|
|
52
|
+
skip_resource "Can't read run query #{query.inspect} on postgres_session: #{out}"
|
|
57
53
|
else
|
|
58
54
|
# remove the whole header (i.e. up to the first ^-----+------+------$)
|
|
59
55
|
# remove the tail
|
|
60
56
|
lines = cmd.stdout
|
|
61
57
|
.sub(/(.*\n)+([-]+[+])*[-]+\n/, '')
|
|
62
58
|
.sub(/\n[^\n]*\n\n$/, '')
|
|
63
|
-
|
|
64
|
-
RSpec.__send__('describe', l, &block)
|
|
59
|
+
Lines.new(lines.strip, "PostgreSQL query: #{query}")
|
|
65
60
|
end
|
|
66
61
|
end
|
|
67
62
|
end
|
|
File without changes
|
|
@@ -69,22 +69,26 @@ class RegistryKey < Inspec.resource(1)
|
|
|
69
69
|
|
|
70
70
|
private
|
|
71
71
|
|
|
72
|
+
def prep_prop(property)
|
|
73
|
+
property.to_s.downcase
|
|
74
|
+
end
|
|
75
|
+
|
|
72
76
|
def registry_property_exists(regkey, property)
|
|
73
77
|
return false if regkey.nil? || property.nil?
|
|
74
78
|
# always ensure the key is lower case
|
|
75
|
-
!regkey[property
|
|
79
|
+
!regkey[prep_prop(property)].nil?
|
|
76
80
|
end
|
|
77
81
|
|
|
78
82
|
def registry_property_value(regkey, property)
|
|
79
|
-
return nil if regkey
|
|
83
|
+
return nil if !registry_property_exists(regkey, property)
|
|
80
84
|
# always ensure the key is lower case
|
|
81
|
-
regkey[property
|
|
85
|
+
regkey[prep_prop(property)]['value']
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
def registry_property_type(regkey, property)
|
|
85
|
-
return nil if regkey
|
|
89
|
+
return nil if !registry_property_exists(regkey, property)
|
|
86
90
|
# always ensure the key is lower case
|
|
87
|
-
regkey[property
|
|
91
|
+
regkey[prep_prop(property)]['type']
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
def registry_key(path)
|
|
@@ -174,6 +178,6 @@ class WindowsRegistryKey < RegistryKey
|
|
|
174
178
|
end
|
|
175
179
|
|
|
176
180
|
def deprecated
|
|
177
|
-
warn '[DEPRECATION] `
|
|
181
|
+
warn '[DEPRECATION] `windows_registry_key(reg_key)` is deprecated. Please use `registry_key(\'path\to\key\')` instead.'
|
|
178
182
|
end
|
|
179
183
|
end
|
data/lib/resources/service.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
2
|
# author: Christoph Hartmann
|
|
3
3
|
# author: Dominik Richter
|
|
4
|
+
# author: Stephan Renatus
|
|
4
5
|
# license: All rights reserved
|
|
5
6
|
|
|
6
7
|
# Usage:
|
|
@@ -30,14 +31,19 @@ class Service < Inspec.resource(1)
|
|
|
30
31
|
end
|
|
31
32
|
"
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
attr_reader :service_ctl
|
|
35
|
+
|
|
36
|
+
def initialize(service_name, service_ctl = nil)
|
|
34
37
|
@service_name = service_name
|
|
35
38
|
@service_mgmt = nil
|
|
39
|
+
@service_ctl ||= service_ctl
|
|
36
40
|
@cache = nil
|
|
37
|
-
|
|
41
|
+
@service_mgmt = select_service_mgmt
|
|
42
|
+
|
|
43
|
+
return skip_resource 'The `service` resource is not supported on your OS yet.' if @service_mgmt.nil?
|
|
38
44
|
end
|
|
39
45
|
|
|
40
|
-
def
|
|
46
|
+
def select_service_mgmt # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
41
47
|
family = inspec.os[:family]
|
|
42
48
|
|
|
43
49
|
case family
|
|
@@ -52,45 +58,42 @@ class Service < Inspec.resource(1)
|
|
|
52
58
|
when 'ubuntu'
|
|
53
59
|
version = inspec.os[:release].to_f
|
|
54
60
|
if version < 15.04
|
|
55
|
-
|
|
61
|
+
Upstart.new(inspec, service_ctl)
|
|
56
62
|
else
|
|
57
|
-
|
|
63
|
+
Systemd.new(inspec, service_ctl)
|
|
58
64
|
end
|
|
59
65
|
when 'debian'
|
|
60
66
|
version = inspec.os[:release].to_i
|
|
61
67
|
if version > 7
|
|
62
|
-
|
|
68
|
+
Systemd.new(inspec, service_ctl)
|
|
63
69
|
else
|
|
64
|
-
|
|
70
|
+
SysV.new(inspec, service_ctl || '/usr/sbin/service')
|
|
65
71
|
end
|
|
66
72
|
when 'redhat', 'fedora', 'centos'
|
|
67
73
|
version = inspec.os[:release].to_i
|
|
68
74
|
if (%w{ redhat centos }.include?(family) && version >= 7) || (family == 'fedora' && version >= 15)
|
|
69
|
-
|
|
75
|
+
Systemd.new(inspec, service_ctl)
|
|
70
76
|
else
|
|
71
|
-
|
|
77
|
+
SysV.new(inspec, service_ctl || '/sbin/service')
|
|
72
78
|
end
|
|
73
79
|
when 'wrlinux'
|
|
74
|
-
|
|
80
|
+
SysV.new(inspec, service_ctl)
|
|
75
81
|
when 'darwin'
|
|
76
|
-
|
|
82
|
+
LaunchCtl.new(inspec, service_ctl)
|
|
77
83
|
when 'windows'
|
|
78
|
-
|
|
84
|
+
WindowsSrv.new(inspec)
|
|
79
85
|
when 'freebsd'
|
|
80
|
-
|
|
86
|
+
BSDInit.new(inspec, service_ctl)
|
|
81
87
|
when 'arch', 'opensuse'
|
|
82
|
-
|
|
88
|
+
Systemd.new(inspec, service_ctl)
|
|
83
89
|
when 'aix'
|
|
84
|
-
|
|
90
|
+
SrcMstr.new(inspec)
|
|
85
91
|
end
|
|
86
|
-
|
|
87
|
-
return skip_resource 'The `service` resource is not supported on your OS yet.' if @service_mgmt.nil?
|
|
88
92
|
end
|
|
89
93
|
|
|
90
94
|
def info
|
|
91
|
-
return @cache if !@cache.nil?
|
|
92
95
|
return nil if @service_mgmt.nil?
|
|
93
|
-
@cache
|
|
96
|
+
@cache ||= @service_mgmt.info(@service_name)
|
|
94
97
|
end
|
|
95
98
|
|
|
96
99
|
# verifies the service is enabled
|
|
@@ -117,17 +120,23 @@ class Service < Inspec.resource(1)
|
|
|
117
120
|
end
|
|
118
121
|
|
|
119
122
|
class ServiceManager
|
|
120
|
-
attr_reader :inspec
|
|
121
|
-
def initialize(inspec)
|
|
123
|
+
attr_reader :inspec, :service_ctl
|
|
124
|
+
def initialize(inspec, service_ctl = nil)
|
|
122
125
|
@inspec = inspec
|
|
126
|
+
@service_ctl ||= service_ctl
|
|
123
127
|
end
|
|
124
128
|
end
|
|
125
129
|
|
|
126
130
|
# @see: http://www.freedesktop.org/software/systemd/man/systemctl.html
|
|
127
131
|
# @see: http://www.freedesktop.org/software/systemd/man/systemd-system.conf.html
|
|
128
132
|
class Systemd < ServiceManager
|
|
133
|
+
def initialize(inspec, service_ctl = nil)
|
|
134
|
+
@service_ctl ||= 'systemctl'
|
|
135
|
+
super
|
|
136
|
+
end
|
|
137
|
+
|
|
129
138
|
def info(service_name)
|
|
130
|
-
cmd = inspec.command("
|
|
139
|
+
cmd = inspec.command("#{service_ctl} show --all #{service_name}")
|
|
131
140
|
return nil if cmd.exit_status.to_i != 0
|
|
132
141
|
|
|
133
142
|
# parse data
|
|
@@ -138,13 +147,13 @@ class Systemd < ServiceManager
|
|
|
138
147
|
).params
|
|
139
148
|
|
|
140
149
|
# LoadState values eg. loaded, not-found
|
|
141
|
-
params['LoadState'] == 'loaded'
|
|
150
|
+
installed = params['LoadState'] == 'loaded'
|
|
142
151
|
# test via 'systemctl is-active service'
|
|
143
152
|
# SubState values running
|
|
144
|
-
params['SubState'] == 'running'
|
|
153
|
+
running = params['SubState'] == 'running'
|
|
145
154
|
# test via systemctl --quiet is-enabled
|
|
146
155
|
# ActiveState values eg.g inactive, active
|
|
147
|
-
params['UnitFileState'] == 'enabled'
|
|
156
|
+
enabled = params['UnitFileState'] == 'enabled'
|
|
148
157
|
|
|
149
158
|
{
|
|
150
159
|
name: params['Id'],
|
|
@@ -190,25 +199,26 @@ class SrcMstr < ServiceManager
|
|
|
190
199
|
|
|
191
200
|
# #rubocop:disable Style/TrailingComma
|
|
192
201
|
def enabled_rc_tcpip?
|
|
193
|
-
|
|
194
|
-
"grep -v ^# /etc/rc.tcpip | grep 'start ' | grep -Eq '(/{0,1}| )#{
|
|
202
|
+
inspec.command(
|
|
203
|
+
"grep -v ^# /etc/rc.tcpip | grep 'start ' | grep -Eq '(/{0,1}| )#{name} '",
|
|
195
204
|
).exit_status == 0
|
|
196
|
-
true
|
|
197
|
-
else
|
|
198
|
-
false
|
|
199
|
-
end
|
|
200
205
|
end
|
|
201
206
|
|
|
202
207
|
def enabled_inittab?
|
|
203
|
-
inspec.command("lsitab #{
|
|
208
|
+
inspec.command("lsitab #{name}").exit_status == 0
|
|
204
209
|
end
|
|
205
210
|
end
|
|
206
211
|
|
|
207
212
|
# @see: http://upstart.ubuntu.com
|
|
208
213
|
class Upstart < ServiceManager
|
|
214
|
+
def initialize(service_name, service_ctl = nil)
|
|
215
|
+
@service_ctl ||= 'initctl'
|
|
216
|
+
super
|
|
217
|
+
end
|
|
218
|
+
|
|
209
219
|
def info(service_name)
|
|
210
220
|
# get the status of upstart service
|
|
211
|
-
status = inspec.command("
|
|
221
|
+
status = inspec.command("#{service_ctl} status #{service_name}")
|
|
212
222
|
|
|
213
223
|
# fallback for systemv services, those are not handled via `initctl`
|
|
214
224
|
return SysV.new(inspec).info(service_name) if status.exit_status.to_i != 0
|
|
@@ -235,7 +245,7 @@ class Upstart < ServiceManager
|
|
|
235
245
|
# $ initctl show-config $job | grep -q "^ start on" && echo enabled || echo disabled
|
|
236
246
|
# Ubuntu 10.04 show-config is not supported
|
|
237
247
|
# @see http://manpages.ubuntu.com/manpages/maverick/man8/initctl.8.html
|
|
238
|
-
config = inspec.command("
|
|
248
|
+
config = inspec.command("#{service_ctl} show-config #{service_name}")
|
|
239
249
|
enabled = !config.stdout[/^\s*start on/].nil?
|
|
240
250
|
|
|
241
251
|
# implement fallback for Ubuntu 10.04
|
|
@@ -251,6 +261,11 @@ class Upstart < ServiceManager
|
|
|
251
261
|
end
|
|
252
262
|
|
|
253
263
|
class SysV < ServiceManager
|
|
264
|
+
def initialize(service_name, service_ctl = nil)
|
|
265
|
+
@service_ctl ||= 'service'
|
|
266
|
+
super
|
|
267
|
+
end
|
|
268
|
+
|
|
254
269
|
def info(service_name)
|
|
255
270
|
# check if service is installed
|
|
256
271
|
# read all available services via ls /etc/init.d/
|
|
@@ -270,19 +285,14 @@ class SysV < ServiceManager
|
|
|
270
285
|
enabled_services = enabled_services_cmd.stdout.split("\n").select { |line|
|
|
271
286
|
/(^.*#{service_name}.*)/.match(line)
|
|
272
287
|
}
|
|
273
|
-
enabled_services.empty?
|
|
288
|
+
enabled = !enabled_services.empty?
|
|
274
289
|
|
|
275
290
|
# check if service is really running
|
|
276
291
|
# service throws an exit code if the service is not installed or
|
|
277
292
|
# not enabled
|
|
278
293
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
service_cmd = '/usr/sbin/service' if inspec.os[:family] == 'debian'
|
|
282
|
-
service_cmd = '/sbin/service' if inspec.os[:family] == 'centos'
|
|
283
|
-
|
|
284
|
-
cmd = inspec.command("#{service_cmd} #{service_name} status")
|
|
285
|
-
cmd.exit_status == 0 ? (running = true) : (running = false)
|
|
294
|
+
cmd = inspec.command("#{service_ctl} #{service_name} status")
|
|
295
|
+
running = cmd.exit_status == 0
|
|
286
296
|
{
|
|
287
297
|
name: service_name,
|
|
288
298
|
description: nil,
|
|
@@ -297,6 +307,11 @@ end
|
|
|
297
307
|
# @see: https://www.freebsd.org/doc/en/articles/linux-users/startup.html
|
|
298
308
|
# @see: https://www.freebsd.org/cgi/man.cgi?query=rc.conf&sektion=5
|
|
299
309
|
class BSDInit < ServiceManager
|
|
310
|
+
def initialize(service_name, service_ctl = nil)
|
|
311
|
+
@service_ctl ||= 'service'
|
|
312
|
+
super
|
|
313
|
+
end
|
|
314
|
+
|
|
300
315
|
def info(service_name)
|
|
301
316
|
# check if service is enabled
|
|
302
317
|
# services are enabled in /etc/rc.conf and /etc/defaults/rc.conf
|
|
@@ -304,7 +319,7 @@ class BSDInit < ServiceManager
|
|
|
304
319
|
# service SERVICE status returns the following result if not activated:
|
|
305
320
|
# Cannot 'status' sshd. Set sshd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
|
|
306
321
|
# gather all enabled services
|
|
307
|
-
cmd = inspec.command(
|
|
322
|
+
cmd = inspec.command("#{service_ctl} -e")
|
|
308
323
|
return nil if cmd.exit_status != 0
|
|
309
324
|
|
|
310
325
|
# search for the service
|
|
@@ -314,8 +329,8 @@ class BSDInit < ServiceManager
|
|
|
314
329
|
|
|
315
330
|
# check if the service is running
|
|
316
331
|
# if the service is not available or not running, we always get an error code
|
|
317
|
-
cmd = inspec.command("
|
|
318
|
-
cmd.exit_status == 0
|
|
332
|
+
cmd = inspec.command("#{service_ctl} #{service_name} onestatus")
|
|
333
|
+
running = cmd.exit_status == 0
|
|
319
334
|
|
|
320
335
|
{
|
|
321
336
|
name: service_name,
|
|
@@ -328,12 +343,43 @@ class BSDInit < ServiceManager
|
|
|
328
343
|
end
|
|
329
344
|
end
|
|
330
345
|
|
|
346
|
+
class Runit < ServiceManager
|
|
347
|
+
def initialize(service_name, service_ctl = nil)
|
|
348
|
+
@service_ctl ||= 'sv'
|
|
349
|
+
super
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
def info(service_name)
|
|
353
|
+
# get the status of runit service
|
|
354
|
+
cmd = inspec.command("#{service_ctl} status #{service_name}")
|
|
355
|
+
# return nil unless cmd.exit_status == 0 # NOTE(sr) why do we do this?
|
|
356
|
+
|
|
357
|
+
installed = cmd.exit_status == 0
|
|
358
|
+
running = installed && (cmd.stdout =~ /^run:/)
|
|
359
|
+
enabled = installed && (running || (cmd.stdout =~ /normally up/) || (cmd.stdout =~ /want up/))
|
|
360
|
+
|
|
361
|
+
{
|
|
362
|
+
name: service_name,
|
|
363
|
+
description: nil,
|
|
364
|
+
installed: installed,
|
|
365
|
+
running: running,
|
|
366
|
+
enabled: enabled,
|
|
367
|
+
type: 'runit',
|
|
368
|
+
}
|
|
369
|
+
end
|
|
370
|
+
end
|
|
371
|
+
|
|
331
372
|
# MacOS / Darwin
|
|
332
373
|
# new launctl on macos 10.10
|
|
333
374
|
class LaunchCtl < ServiceManager
|
|
375
|
+
def initialize(service_name, service_ctl = nil)
|
|
376
|
+
@service_ctl ||= 'launchctl'
|
|
377
|
+
super
|
|
378
|
+
end
|
|
379
|
+
|
|
334
380
|
def info(service_name)
|
|
335
381
|
# get the status of upstart service
|
|
336
|
-
cmd = inspec.command(
|
|
382
|
+
cmd = inspec.command("#{service_ctl} list")
|
|
337
383
|
return nil if cmd.exit_status != 0
|
|
338
384
|
|
|
339
385
|
# search for the service
|
|
@@ -341,15 +387,15 @@ class LaunchCtl < ServiceManager
|
|
|
341
387
|
return nil if srv.nil? || srv[0].nil?
|
|
342
388
|
|
|
343
389
|
# extract values from service
|
|
344
|
-
parsed_srv = /^([0-9]+)\
|
|
345
|
-
!parsed_srv.nil?
|
|
390
|
+
parsed_srv = /^(?<pid>[0-9-]+)\t(?<exit>[0-9]+)\t(?<name>\S*)$/.match(srv[0])
|
|
391
|
+
enabled = !parsed_srv['name'].nil? # it's in the list
|
|
346
392
|
|
|
347
393
|
# check if the service is running
|
|
348
|
-
pid = parsed_srv[
|
|
349
|
-
|
|
394
|
+
pid = parsed_srv['pid']
|
|
395
|
+
running = pid != '-'
|
|
350
396
|
|
|
351
397
|
# extract service label
|
|
352
|
-
srv = parsed_srv[
|
|
398
|
+
srv = parsed_srv['name'] || service_name
|
|
353
399
|
|
|
354
400
|
{
|
|
355
401
|
name: srv,
|
|
@@ -423,22 +469,145 @@ class WindowsSrv < ServiceManager
|
|
|
423
469
|
|
|
424
470
|
# detect if service is enabled
|
|
425
471
|
def service_enabled?(service)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
true
|
|
430
|
-
else
|
|
431
|
-
false
|
|
432
|
-
end
|
|
472
|
+
!service['WMI'].nil? &&
|
|
473
|
+
!service['WMI']['StartMode'].nil? &&
|
|
474
|
+
service['WMI']['StartMode'] == 'Auto'
|
|
433
475
|
end
|
|
434
476
|
|
|
435
477
|
# detect if service is running
|
|
436
478
|
def service_running?(service)
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
479
|
+
!service['Service']['Status'].nil? && service['Service']['Status'] == 4
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
class SystemdService < Service
|
|
484
|
+
name 'systemd_service'
|
|
485
|
+
desc 'Use the systemd_service InSpec audit resource to test if the named service (controlled by systemd) is installed, running and/or enabled.'
|
|
486
|
+
example "
|
|
487
|
+
# to override service mgmt auto-detection
|
|
488
|
+
describe systemd_service('service_name') do
|
|
489
|
+
it { should be_installed }
|
|
490
|
+
it { should be_enabled }
|
|
491
|
+
it { should be_running }
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
# to set a non-standard systemctl path
|
|
495
|
+
describe systemd_service('service_name', '/path/to/systemctl') do
|
|
496
|
+
it { should be_running }
|
|
497
|
+
end
|
|
498
|
+
"
|
|
499
|
+
|
|
500
|
+
def select_service_mgmt
|
|
501
|
+
Systemd.new(inspec, service_ctl)
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
class UpstartService < Service
|
|
506
|
+
name 'upstart_service'
|
|
507
|
+
desc 'Use the upstart_service InSpec audit resource to test if the named service (controlled by upstart) is installed, running and/or enabled.'
|
|
508
|
+
example "
|
|
509
|
+
# to override service mgmt auto-detection
|
|
510
|
+
describe upstart_service('service_name') do
|
|
511
|
+
it { should be_installed }
|
|
512
|
+
it { should be_enabled }
|
|
513
|
+
it { should be_running }
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
# to set a non-standard initctl path
|
|
517
|
+
describe upstart_service('service_name', '/path/to/initctl') do
|
|
518
|
+
it { should be_running }
|
|
519
|
+
end
|
|
520
|
+
"
|
|
521
|
+
|
|
522
|
+
def select_service_mgmt
|
|
523
|
+
Upstart.new(inspec, service_ctl)
|
|
524
|
+
end
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
class SysVService < Service
|
|
528
|
+
name 'sysv_service'
|
|
529
|
+
desc 'Use the sysv_service InSpec audit resource to test if the named service (controlled by SysV) is installed, running and/or enabled.'
|
|
530
|
+
example "
|
|
531
|
+
# to override service mgmt auto-detection
|
|
532
|
+
describe sysv_service('service_name') do
|
|
533
|
+
it { should be_installed }
|
|
534
|
+
it { should be_enabled }
|
|
535
|
+
it { should be_running }
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
# to set a non-standard service path
|
|
539
|
+
describe sysv_service('service_name', '/path/to/service') do
|
|
540
|
+
it { should be_running }
|
|
442
541
|
end
|
|
542
|
+
"
|
|
543
|
+
|
|
544
|
+
def select_service_mgmt
|
|
545
|
+
SysV.new(inspec, service_ctl)
|
|
546
|
+
end
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
class BSDService < Service
|
|
550
|
+
name 'bsd_service'
|
|
551
|
+
desc 'Use the bsd_service InSpec audit resource to test if the named service (controlled by BSD init) is installed, running and/or enabled.'
|
|
552
|
+
example "
|
|
553
|
+
# to override service mgmt auto-detection
|
|
554
|
+
describe bsd_service('service_name') do
|
|
555
|
+
it { should be_installed }
|
|
556
|
+
it { should be_enabled }
|
|
557
|
+
it { should be_running }
|
|
558
|
+
end
|
|
559
|
+
|
|
560
|
+
# to set a non-standard service path
|
|
561
|
+
describe bsd_service('service_name', '/path/to/service') do
|
|
562
|
+
it { should be_running }
|
|
563
|
+
end
|
|
564
|
+
"
|
|
565
|
+
|
|
566
|
+
def select_service_mgmt
|
|
567
|
+
BSDInit.new(inspec, service_ctl)
|
|
568
|
+
end
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
class LaunchdService < Service
|
|
572
|
+
name 'launchd_service'
|
|
573
|
+
desc 'Use the launchd_service InSpec audit resource to test if the named service (controlled by launchd) is installed, running and/or enabled.'
|
|
574
|
+
example "
|
|
575
|
+
# to override service mgmt auto-detection
|
|
576
|
+
describe launchd_service('service_name') do
|
|
577
|
+
it { should be_installed }
|
|
578
|
+
it { should be_enabled }
|
|
579
|
+
it { should be_running }
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
# to set a non-standard launchctl path
|
|
583
|
+
describe launchd_service('service_name', '/path/to/launchctl') do
|
|
584
|
+
it { should be_running }
|
|
585
|
+
end
|
|
586
|
+
"
|
|
587
|
+
|
|
588
|
+
def select_service_mgmt
|
|
589
|
+
LaunchCtl.new(inspec, service_ctl)
|
|
590
|
+
end
|
|
591
|
+
end
|
|
592
|
+
|
|
593
|
+
class RunitService < Service
|
|
594
|
+
name 'runit_service'
|
|
595
|
+
desc 'Use the runit_service InSpec audit resource to test if the named service (controlled by runit) is installed, running and/or enabled.'
|
|
596
|
+
example "
|
|
597
|
+
# to override service mgmt auto-detection
|
|
598
|
+
describe runit_service('service_name') do
|
|
599
|
+
it { should be_installed }
|
|
600
|
+
it { should be_enabled }
|
|
601
|
+
it { should be_running }
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
# to set a non-standard sv path
|
|
605
|
+
describe runit_service('service_name', '/path/to/sv') do
|
|
606
|
+
it { should be_running }
|
|
607
|
+
end
|
|
608
|
+
"
|
|
609
|
+
|
|
610
|
+
def select_service_mgmt
|
|
611
|
+
Runit.new(inspec, service_ctl)
|
|
443
612
|
end
|
|
444
613
|
end
|