chef 18.8.11 → 18.8.46
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/Gemfile +0 -19
- data/chef.gemspec +4 -5
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +4 -0
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +1 -5
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +12 -0
- data/lib/chef/chef_fs/file_system.rb +18 -0
- data/lib/chef/pwsh.rb +2 -5
- data/lib/chef/resource/apt_repository.rb +14 -5
- data/lib/chef/resource/chocolatey_installer.rb +19 -4
- data/lib/chef/resource/ohai.rb +1 -0
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/shell.rb +8 -3
- data/lib/chef/version.rb +1 -1
- metadata +14 -1121
- data/spec/data/apt/chef-integration-test-1.0/debian/changelog +0 -5
- data/spec/data/apt/chef-integration-test-1.0/debian/compat +0 -1
- data/spec/data/apt/chef-integration-test-1.0/debian/control +0 -13
- data/spec/data/apt/chef-integration-test-1.0/debian/copyright +0 -34
- data/spec/data/apt/chef-integration-test-1.0/debian/files +0 -1
- data/spec/data/apt/chef-integration-test-1.0/debian/rules +0 -13
- data/spec/data/apt/chef-integration-test-1.0/debian/source/format +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/changelog +0 -11
- data/spec/data/apt/chef-integration-test-1.1/debian/compat +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/control +0 -13
- data/spec/data/apt/chef-integration-test-1.1/debian/copyright +0 -34
- data/spec/data/apt/chef-integration-test-1.1/debian/files +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/rules +0 -13
- data/spec/data/apt/chef-integration-test-1.1/debian/source/format +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/changelog +0 -5
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/conffiles +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/control +0 -10
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/md5sums +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.debhelper.log +0 -45
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.substvars +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/compat +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/conffiles +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/control +0 -13
- data/spec/data/apt/chef-integration-test2-1.0/debian/copyright +0 -34
- data/spec/data/apt/chef-integration-test2-1.0/debian/files +0 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/rules +0 -13
- data/spec/data/apt/chef-integration-test2-1.0/debian/source/format +0 -1
- data/spec/data/apt/chef-integration-test2_1.0-1.debian.tar.gz +0 -0
- data/spec/data/apt/chef-integration-test2_1.0-1.dsc +0 -18
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.build +0 -91
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.changes +0 -31
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test2_1.0.orig.tar.gz +0 -0
- data/spec/data/apt/chef-integration-test_1.0-1_amd64.changes +0 -22
- data/spec/data/apt/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test_1.0.orig.tar.gz +0 -0
- data/spec/data/apt/chef-integration-test_1.1-1_amd64.changes +0 -22
- data/spec/data/apt/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test_1.1.orig.tar.gz +0 -0
- data/spec/data/apt/var/www/apt/conf/distributions +0 -7
- data/spec/data/apt/var/www/apt/conf/incoming +0 -4
- data/spec/data/apt/var/www/apt/conf/pulls +0 -3
- data/spec/data/apt/var/www/apt/db/checksums.db +0 -0
- data/spec/data/apt/var/www/apt/db/contents.cache.db +0 -0
- data/spec/data/apt/var/www/apt/db/packages.db +0 -0
- data/spec/data/apt/var/www/apt/db/references.db +0 -0
- data/spec/data/apt/var/www/apt/db/release.caches.db +0 -0
- data/spec/data/apt/var/www/apt/db/version +0 -4
- data/spec/data/apt/var/www/apt/dists/sid/Release +0 -19
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +0 -16
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +0 -0
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +0 -5
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-i386/Packages +0 -0
- data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/spec/data/archive_file/test_archive.tar.gz +0 -0
- data/spec/data/bad-config.rb +0 -1
- data/spec/data/bootstrap/encrypted_data_bag_secret +0 -1
- data/spec/data/bootstrap/no_proxy.erb +0 -2
- data/spec/data/bootstrap/secret.erb +0 -9
- data/spec/data/bootstrap/test-hints.erb +0 -12
- data/spec/data/bootstrap/test.erb +0 -1
- data/spec/data/cb_version_cookbooks/cookbook2/files/test.txt +0 -0
- data/spec/data/cb_version_cookbooks/cookbook2/templates/test.erb +0 -0
- data/spec/data/cb_version_cookbooks/tatft/README.rdoc +0 -3
- data/spec/data/cb_version_cookbooks/tatft/attributes/default.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz +0 -1
- data/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/recipes/default.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb +0 -1
- data/spec/data/cb_version_cookbooks/tatft/templates/default/configuration.erb +0 -0
- data/spec/data/checksum/random.txt +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-600hhz-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-6m8zdk-0 +0 -0
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-ahd2gq-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-api8ux-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-b0r1m1-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-bfygsi-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-el14l6-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-ivrl3y-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-kkbs85-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-ory1ux-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-pgsq76-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-ra8uim-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-t7k1g-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-t8g0sv-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-ufy6g3-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-x2d6j9-0 +0 -1
- data/spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-xi0l6h-0 +0 -1
- data/spec/data/client.d_00/00-foo.rb +0 -2
- data/spec/data/client.d_00/01-bar.rb +0 -1
- data/spec/data/client.d_00/02-strings.rb +0 -2
- data/spec/data/client.d_00/bar +0 -1
- data/spec/data/client.d_01/foo/bar.rb +0 -1
- data/spec/data/client.d_02/foo.rb/foo.txt +0 -1
- data/spec/data/config.rb +0 -6
- data/spec/data/cookbooks/angrybash/metadata.rb +0 -2
- data/spec/data/cookbooks/angrybash/recipes/default.rb +0 -8
- data/spec/data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +0 -2
- data/spec/data/cookbooks/apache2/metadata.json +0 -33
- data/spec/data/cookbooks/apache2/metadata.rb +0 -2
- data/spec/data/cookbooks/apache2/recipes/default.rb +0 -3
- data/spec/data/cookbooks/borken/metadata.rb +0 -2
- data/spec/data/cookbooks/borken/recipes/default.rb +0 -2
- data/spec/data/cookbooks/borken/templates/default/borken.erb +0 -2
- data/spec/data/cookbooks/chefignore +0 -8
- data/spec/data/cookbooks/ignorken/files/default/not_me.rb +0 -2
- data/spec/data/cookbooks/ignorken/metadata.rb +0 -2
- data/spec/data/cookbooks/ignorken/recipes/default.rb +0 -1
- data/spec/data/cookbooks/ignorken/recipes/ignoreme.rb +0 -2
- data/spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb +0 -2
- data/spec/data/cookbooks/irssi/files/default/irssi.response +0 -2
- data/spec/data/cookbooks/java/files/default/java.response +0 -2
- data/spec/data/cookbooks/java/metadata.json +0 -33
- data/spec/data/cookbooks/java/metadata.rb +0 -2
- data/spec/data/cookbooks/name-mismatch-versionnumber/README.md +0 -4
- data/spec/data/cookbooks/name-mismatch-versionnumber/metadata.rb +0 -8
- data/spec/data/cookbooks/name-mismatch-versionnumber/recipes/default.rb +0 -8
- data/spec/data/cookbooks/openldap/.root_dotfile +0 -0
- data/spec/data/cookbooks/openldap/attributes/default.rb +0 -16
- data/spec/data/cookbooks/openldap/attributes/smokey.rb +0 -1
- data/spec/data/cookbooks/openldap/definitions/client.rb +0 -5
- data/spec/data/cookbooks/openldap/definitions/server.rb +0 -5
- data/spec/data/cookbooks/openldap/files/default/.dotfile +0 -1
- data/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/not_a_template.erb +0 -2
- data/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile +0 -1
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt +0 -3
- data/spec/data/cookbooks/openldap/files/default/remotedir/subdir_with_no_file_just_a_subsubdir/the_subsubdir/some_file.txt +0 -3
- data/spec/data/cookbooks/openldap/libraries/openldap/version.rb +0 -3
- data/spec/data/cookbooks/openldap/libraries/openldap.rb +0 -4
- data/spec/data/cookbooks/openldap/metadata.rb +0 -8
- data/spec/data/cookbooks/openldap/recipes/default.rb +0 -4
- data/spec/data/cookbooks/openldap/recipes/gigantor.rb +0 -3
- data/spec/data/cookbooks/openldap/recipes/one.rb +0 -15
- data/spec/data/cookbooks/openldap/recipes/return.rb +0 -2
- data/spec/data/cookbooks/openldap/spec/spec_helper.rb +0 -0
- data/spec/data/cookbooks/openldap/templates/default/all_windows_line_endings.erb +0 -4
- data/spec/data/cookbooks/openldap/templates/default/helper_test.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/helpers.erb +0 -14
- data/spec/data/cookbooks/openldap/templates/default/helpers_via_partial_test.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/nested_openldap_partials.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/nested_partial.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/no_windows_line_endings.erb +0 -4
- data/spec/data/cookbooks/openldap/templates/default/openldap_nested_variable_stuff.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/openldap_variable_stuff.conf.erb +0 -1
- data/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb +0 -4
- data/spec/data/cookbooks/openldap/templates/default/test.erb +0 -1
- data/spec/data/cookbooks/preseed/files/default/preseed-file.seed +0 -1
- data/spec/data/cookbooks/preseed/files/default/preseed-template.seed +0 -4
- data/spec/data/cookbooks/preseed/metadata.rb +0 -2
- data/spec/data/cookbooks/preseed/templates/default/preseed-template-variables.seed +0 -1
- data/spec/data/cookbooks/preseed/templates/default/preseed-template.seed +0 -1
- data/spec/data/cookbooks/starter/chefignore +0 -8
- data/spec/data/cookbooks/starter/files/sample.txt +0 -1
- data/spec/data/cookbooks/starter/metadata.rb +0 -2
- data/spec/data/cookbooks/starter/recipes/default.rb +0 -4
- data/spec/data/cookbooks/supports-platform-constraints/metadata.rb +0 -5
- data/spec/data/cookbooks/wget/files/default/wget.response +0 -2
- data/spec/data/definitions/test.rb +0 -5
- data/spec/data/dsc_lcm.pfx +0 -0
- data/spec/data/environment-config.rb +0 -5
- data/spec/data/file-providers-method-snapshot-chef-11-4.json +0 -127
- data/spec/data/fileedit/blank +0 -0
- data/spec/data/fileedit/hosts +0 -4
- data/spec/data/gems/chef-integration-test-0.1.0.gem +0 -0
- data/spec/data/git_bundles/example-repo.gitbundle +0 -0
- data/spec/data/git_bundles/sinatra-test-app-with-callback-files.gitbundle +0 -0
- data/spec/data/git_bundles/sinatra-test-app-with-symlinks.gitbundle +0 -0
- data/spec/data/git_bundles/sinatra-test-app.gitbundle +0 -0
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/README.md +0 -4
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/metadata.rb +0 -13
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/recipes/default.rb +0 -8
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/README.md +0 -4
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/metadata.rb +0 -9
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/recipes/default.rb +0 -8
- data/spec/data/kitchen/chefignore +0 -6
- data/spec/data/kitchen/openldap/attributes/default.rb +0 -3
- data/spec/data/kitchen/openldap/attributes/robinson.rb +0 -3
- data/spec/data/kitchen/openldap/definitions/client.rb +0 -3
- data/spec/data/kitchen/openldap/definitions/drewbarrymore.rb +0 -3
- data/spec/data/kitchen/openldap/recipes/gigantor.rb +0 -3
- data/spec/data/kitchen/openldap/recipes/ignoreme.rb +0 -3
- data/spec/data/kitchen/openldap/recipes/woot.rb +0 -3
- data/spec/data/knife-home/.chef/plugins/knife/example_home_subcommand.rb +0 -0
- data/spec/data/knife-site-subcommands/plugins/knife/example_subcommand.rb +0 -0
- data/spec/data/knife_subcommand/test_explicit_category.rb +0 -7
- data/spec/data/knife_subcommand/test_name_mapping.rb +0 -4
- data/spec/data/knife_subcommand/test_yourself.rb +0 -21
- data/spec/data/lwrp/providers/buck_passer.rb +0 -28
- data/spec/data/lwrp/providers/buck_passer_2.rb +0 -26
- data/spec/data/lwrp/providers/embedded_resource_accesses_providers_scope.rb +0 -28
- data/spec/data/lwrp/providers/inline_compiler.rb +0 -24
- data/spec/data/lwrp/providers/monkey_name_printer.rb +0 -5
- data/spec/data/lwrp/providers/paint_drying_watcher.rb +0 -7
- data/spec/data/lwrp/providers/thumb_twiddler.rb +0 -7
- data/spec/data/lwrp/resources/bar.rb +0 -4
- data/spec/data/lwrp/resources/buck_passer.rb +0 -6
- data/spec/data/lwrp/resources/buck_passer_2.rb +0 -4
- data/spec/data/lwrp/resources/embedded_resource_accesses_providers_scope.rb +0 -4
- data/spec/data/lwrp/resources/foo.rb +0 -6
- data/spec/data/lwrp/resources/inline_compiler.rb +0 -4
- data/spec/data/lwrp/resources/monkey_name_printer.rb +0 -6
- data/spec/data/lwrp/resources/paint_drying_watcher.rb +0 -4
- data/spec/data/lwrp/resources/thumb_twiddler.rb +0 -4
- data/spec/data/lwrp/resources_with_default_attributes/nodeattr.rb +0 -3
- data/spec/data/lwrp_const_scoping/resources/conflict.rb +0 -1
- data/spec/data/lwrp_override/providers/buck_passer.rb +0 -5
- data/spec/data/lwrp_override/resources/foo.rb +0 -11
- data/spec/data/mac_users/10.9.plist.xml +0 -560
- data/spec/data/mac_users/10.9.shadow.xml +0 -21
- data/spec/data/metadata/quick_start/metadata.rb +0 -14
- data/spec/data/mixin/invalid_data.rb +0 -3
- data/spec/data/mixin/real_data.rb +0 -2
- data/spec/data/nested.json +0 -2
- data/spec/data/nodes/default.rb +0 -15
- data/spec/data/nodes/test.example.com.rb +0 -17
- data/spec/data/nodes/test.rb +0 -15
- data/spec/data/null_config.rb +0 -1
- data/spec/data/object_loader/environments/test.json +0 -7
- data/spec/data/object_loader/environments/test.rb +0 -2
- data/spec/data/object_loader/environments/test_json_class.json +0 -8
- data/spec/data/object_loader/nodes/test.json +0 -7
- data/spec/data/object_loader/nodes/test.rb +0 -2
- data/spec/data/object_loader/nodes/test_json_class.json +0 -8
- data/spec/data/object_loader/roles/test.json +0 -7
- data/spec/data/object_loader/roles/test.rb +0 -2
- data/spec/data/object_loader/roles/test_json_class.json +0 -8
- data/spec/data/old_home_dir/my-dot-emacs +0 -0
- data/spec/data/old_home_dir/my-dot-vim +0 -0
- data/spec/data/partial_one.erb +0 -1
- data/spec/data/prefer_metadata_json/metadata.json +0 -51
- data/spec/data/prefer_metadata_json/metadata.rb +0 -6
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/data/recipes/test.rb +0 -7
- data/spec/data/recipes.tgz +0 -0
- data/spec/data/remote_directory_data/remote_dir_file.txt +0 -1
- data/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt +0 -1
- data/spec/data/remote_file/nyan_cat.png +0 -0
- data/spec/data/remote_file/nyan_cat.png.gz +0 -0
- data/spec/data/root_alias_cookbooks/dup_attr/attributes/default.rb +0 -1
- data/spec/data/root_alias_cookbooks/dup_attr/attributes.rb +0 -1
- data/spec/data/root_alias_cookbooks/dup_attr/metadata.rb +0 -2
- data/spec/data/root_alias_cookbooks/dup_attr/recipe.rb +0 -3
- data/spec/data/root_alias_cookbooks/dup_recipe/attributes.rb +0 -1
- data/spec/data/root_alias_cookbooks/dup_recipe/metadata.rb +0 -2
- data/spec/data/root_alias_cookbooks/dup_recipe/recipe.rb +0 -3
- data/spec/data/root_alias_cookbooks/dup_recipe/recipes/default.rb +0 -3
- data/spec/data/root_alias_cookbooks/simple/attributes.rb +0 -1
- data/spec/data/root_alias_cookbooks/simple/metadata.rb +0 -2
- data/spec/data/root_alias_cookbooks/simple/recipe.rb +0 -3
- data/spec/data/rubygems.org/latest_specs.4.8.gz +0 -0
- data/spec/data/rubygems.org/nonexistent_gem +0 -0
- data/spec/data/rubygems.org/nonexistent_gem-info +0 -1
- data/spec/data/rubygems.org/sexp_processor +0 -0
- data/spec/data/rubygems.org/sexp_processor-4.15.1.gemspec.rz +0 -0
- data/spec/data/rubygems.org/sexp_processor-info +0 -50
- data/spec/data/run_context/cookbooks/circular-dep1/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep1/definitions/circular_dep1_res.rb +0 -1
- data/spec/data/run_context/cookbooks/circular-dep1/libraries/lib.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep1/metadata.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep1/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/circular-dep1/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/circular-dep1/resources/resource.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep2/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep2/definitions/circular_dep2_res.rb +0 -1
- data/spec/data/run_context/cookbooks/circular-dep2/libraries/lib.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep2/metadata.rb +0 -2
- data/spec/data/run_context/cookbooks/circular-dep2/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/circular-dep2/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/circular-dep2/resources/resource.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/attributes/aa_first.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/attributes/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency1/attributes/zz_last.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/definitions/dependency1_res.rb +0 -1
- data/spec/data/run_context/cookbooks/dependency1/definitions/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency1/libraries/lib.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/libraries/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency1/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/dependency1/providers/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency1/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency1/recipes/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency1/resources/resource.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency1/resources/unparsed_file +0 -1
- data/spec/data/run_context/cookbooks/dependency2/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency2/definitions/dependency2_res.rb +0 -1
- data/spec/data/run_context/cookbooks/dependency2/libraries/lib.rb +0 -2
- data/spec/data/run_context/cookbooks/dependency2/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/dependency2/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency2/resources/resource.rb +0 -2
- data/spec/data/run_context/cookbooks/include/recipes/default.rb +0 -24
- data/spec/data/run_context/cookbooks/include/recipes/includee.rb +0 -3
- data/spec/data/run_context/cookbooks/no-default-attr/attributes/server.rb +0 -2
- data/spec/data/run_context/cookbooks/no-default-attr/definitions/no_default-attr_res.rb +0 -1
- data/spec/data/run_context/cookbooks/no-default-attr/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/no-default-attr/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/no-default-attr/resources/resource.rb +0 -2
- data/spec/data/run_context/cookbooks/test/attributes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test/attributes/george.rb +0 -1
- data/spec/data/run_context/cookbooks/test/definitions/new_animals.rb +0 -9
- data/spec/data/run_context/cookbooks/test/definitions/new_cat.rb +0 -5
- data/spec/data/run_context/cookbooks/test/definitions/test_res.rb +0 -1
- data/spec/data/run_context/cookbooks/test/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/test/recipes/default.rb +0 -5
- data/spec/data/run_context/cookbooks/test/recipes/one.rb +0 -7
- data/spec/data/run_context/cookbooks/test/recipes/two.rb +0 -7
- data/spec/data/run_context/cookbooks/test/resources/resource.rb +0 -3
- data/spec/data/run_context/cookbooks/test-with-circular-deps/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/test-with-circular-deps/definitions/test_with-circular-deps_res.rb +0 -1
- data/spec/data/run_context/cookbooks/test-with-circular-deps/libraries/lib.rb +0 -2
- data/spec/data/run_context/cookbooks/test-with-circular-deps/metadata.rb +0 -2
- data/spec/data/run_context/cookbooks/test-with-circular-deps/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/test-with-circular-deps/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/resources/resource.rb +0 -3
- data/spec/data/run_context/cookbooks/test-with-deps/attributes/default.rb +0 -2
- data/spec/data/run_context/cookbooks/test-with-deps/definitions/test_with-deps_res.rb +0 -1
- data/spec/data/run_context/cookbooks/test-with-deps/libraries/lib.rb +0 -1
- data/spec/data/run_context/cookbooks/test-with-deps/metadata.rb +0 -3
- data/spec/data/run_context/cookbooks/test-with-deps/providers/provider.rb +0 -1
- data/spec/data/run_context/cookbooks/test-with-deps/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-deps/recipes/server.rb +0 -0
- data/spec/data/run_context/cookbooks/test-with-deps/resources/resource.rb +0 -2
- data/spec/data/run_context/nodes/run_context.rb +0 -5
- data/spec/data/sample_msu1.xml +0 -10
- data/spec/data/sample_msu2.xml +0 -14
- data/spec/data/sample_msu3.xml +0 -16
- data/spec/data/search_queries_to_transform.txt +0 -98
- data/spec/data/shef-config.rb +0 -11
- data/spec/data/snap_package/async_result_success.json +0 -6
- data/spec/data/snap_package/change_id_result.json +0 -175
- data/spec/data/snap_package/find_result_failure.json +0 -10
- data/spec/data/snap_package/find_result_success.json +0 -70
- data/spec/data/snap_package/get_by_name_result_failure.json +0 -10
- data/spec/data/snap_package/get_by_name_result_success.json +0 -38
- data/spec/data/snap_package/get_conf_success.json +0 -10
- data/spec/data/snap_package/result_failure.json +0 -9
- data/spec/data/ssl/5e707473.0 +0 -18
- data/spec/data/ssl/binary/chef-rspec-der.cert +0 -0
- data/spec/data/ssl/binary/chef-rspec-der.key +0 -0
- data/spec/data/ssl/chef-rspec.cert +0 -27
- data/spec/data/ssl/chef-rspec.key +0 -27
- data/spec/data/ssl/key.pem +0 -15
- data/spec/data/ssl/private_key.pem +0 -27
- data/spec/data/ssl/private_key_with_whitespace.pem +0 -32
- data/spec/data/standalone_cookbook/Gemfile +0 -1
- data/spec/data/standalone_cookbook/chefignore +0 -9
- data/spec/data/standalone_cookbook/recipes/default.rb +0 -3
- data/spec/data/standalone_cookbook/vendor/bundle/ruby/2.0.0/gems/multi_json-1.9.0/lib/multi_json.rb +0 -1
- data/spec/data/templates/chef-seattle20160930-4388-1crv7ef.txt +0 -1
- data/spec/data/templates/chef-seattle20160930-4388-jjfoae.txt +0 -1
- data/spec/data/templates/chef-seattle20160930-4388-umeq2c.txt +0 -1
- data/spec/data/templates/failed.erb +0 -5
- data/spec/data/templates/seattle.txt +0 -1
- data/spec/data/trusted_certs/example.crt +0 -31
- data/spec/data/trusted_certs/example_no_cn.crt +0 -32
- data/spec/data/trusted_certs/intermediate.pem +0 -38
- data/spec/data/trusted_certs/opscode.pem +0 -36
- data/spec/data/trusted_certs/root.pem +0 -22
- data/spec/data/windows_certificates/base64_test.cer +0 -20
- data/spec/data/windows_certificates/othertest.cer +0 -20
- data/spec/data/windows_certificates/test.cer +0 -20
- data/spec/data/windows_certificates/test.p7b +0 -0
- data/spec/data/windows_certificates/test.pem +0 -20
- data/spec/data/windows_certificates/test.pfx +0 -0
- data/spec/functional/application_spec.rb +0 -58
- data/spec/functional/assets/PkgA.1.0.0.0.bff +0 -0
- data/spec/functional/assets/PkgA.2.0.0.0.bff +0 -0
- data/spec/functional/assets/chefinittest +0 -36
- data/spec/functional/assets/chocolatey_feed/test-A.1.0.0.nupkg +0 -0
- data/spec/functional/assets/chocolatey_feed/test-A.1.5.0.nupkg +0 -0
- data/spec/functional/assets/chocolatey_feed/test-A.2.0.0.nupkg +0 -0
- data/spec/functional/assets/chocolatey_feed/test-B.1.0.0.nupkg +0 -0
- data/spec/functional/assets/dummy-1-0.aix6.1.noarch.rpm +0 -0
- data/spec/functional/assets/dummy-2-0.aix6.1.noarch.rpm +0 -0
- data/spec/functional/assets/inittest +0 -37
- data/spec/functional/assets/mytest-1.0-1.noarch.rpm +0 -0
- data/spec/functional/assets/mytest-2.0-1.noarch.rpm +0 -0
- data/spec/functional/assets/testchefsubsys +0 -10
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.aarch64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.ppc64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.s390x.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.10-1.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.aarch64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.i686.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.ppc64.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.s390x.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.src.rpm +0 -0
- data/spec/functional/assets/yumrepo/chef_rpm-1.2-1.x86_64.rpm +0 -0
- data/spec/functional/assets/yumrepo/repodata/4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo/repodata/bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo/repodata/repomd.xml +0 -21
- data/spec/functional/assets/yumrepo-empty/repodata/01a3b-filelists.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/401dc-filelists.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/5dc1e-primary.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/6bf96-other.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/7c365-other.sqlite.bz2 +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/dabe2-primary.xml.gz +0 -0
- data/spec/functional/assets/yumrepo-empty/repodata/repomd.xml +0 -55
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.aarch64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.i686.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.s390x.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.src.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.10-1.x86_64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.aarch64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.i686.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.ppc64le.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.s390x.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.src.rpm +0 -0
- data/spec/functional/assets/zypprepo/chef_rpm-1.2-1.x86_64.rpm +0 -0
- data/spec/functional/dsl/reboot_pending_spec.rb +0 -88
- data/spec/functional/dsl/registry_helper_spec.rb +0 -61
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +0 -107
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +0 -229
- data/spec/functional/http/simple_spec.rb +0 -146
- data/spec/functional/mixin/from_file_spec.rb +0 -93
- data/spec/functional/mixin/powershell_out_spec.rb +0 -51
- data/spec/functional/mixin/shell_out_spec.rb +0 -48
- data/spec/functional/mixin/user_context_spec.rb +0 -119
- data/spec/functional/notifications_spec.rb +0 -238
- data/spec/functional/provider/remote_file/cache_control_data_spec.rb +0 -100
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +0 -51
- data/spec/functional/rebooter_spec.rb +0 -117
- data/spec/functional/resource/aix_service_spec.rb +0 -145
- data/spec/functional/resource/aixinit_service_spec.rb +0 -210
- data/spec/functional/resource/apt_package_spec.rb +0 -383
- data/spec/functional/resource/archive_file_spec.rb +0 -88
- data/spec/functional/resource/bash_spec.rb +0 -55
- data/spec/functional/resource/batch_spec.rb +0 -34
- data/spec/functional/resource/bff_spec.rb +0 -120
- data/spec/functional/resource/chocolatey_package_spec.rb +0 -194
- data/spec/functional/resource/cookbook_file_spec.rb +0 -79
- data/spec/functional/resource/cron_spec.rb +0 -179
- data/spec/functional/resource/directory_spec.rb +0 -43
- data/spec/functional/resource/dnf_package_spec.rb +0 -1629
- data/spec/functional/resource/dpkg_package_spec.rb +0 -355
- data/spec/functional/resource/dsc_resource_spec.rb +0 -91
- data/spec/functional/resource/dsc_script_spec.rb +0 -476
- data/spec/functional/resource/execute_spec.rb +0 -171
- data/spec/functional/resource/file_spec.rb +0 -167
- data/spec/functional/resource/git_spec.rb +0 -330
- data/spec/functional/resource/group_spec.rb +0 -486
- data/spec/functional/resource/ifconfig_spec.rb +0 -178
- data/spec/functional/resource/insserv_spec.rb +0 -206
- data/spec/functional/resource/launchd_spec.rb +0 -232
- data/spec/functional/resource/link_spec.rb +0 -704
- data/spec/functional/resource/locale_spec.rb +0 -108
- data/spec/functional/resource/macos_userdefaults_spec.rb +0 -139
- data/spec/functional/resource/mount_spec.rb +0 -219
- data/spec/functional/resource/msu_package_spec.rb +0 -107
- data/spec/functional/resource/ohai_spec.rb +0 -54
- data/spec/functional/resource/plist_spec.rb +0 -25
- data/spec/functional/resource/powershell_package_source_spec.rb +0 -106
- data/spec/functional/resource/powershell_script_spec.rb +0 -588
- data/spec/functional/resource/reboot_spec.rb +0 -103
- data/spec/functional/resource/registry_spec.rb +0 -300
- data/spec/functional/resource/remote_directory_spec.rb +0 -220
- data/spec/functional/resource/remote_file_spec.rb +0 -418
- data/spec/functional/resource/rpm_spec.rb +0 -120
- data/spec/functional/resource/template_spec.rb +0 -245
- data/spec/functional/resource/timezone_spec.rb +0 -41
- data/spec/functional/resource/user/linux_user_spec.rb +0 -127
- data/spec/functional/resource/user/mac_user_spec.rb +0 -207
- data/spec/functional/resource/user/windows_spec.rb +0 -245
- data/spec/functional/resource/windows_certificate_spec.rb +0 -401
- data/spec/functional/resource/windows_env_spec.rb +0 -285
- data/spec/functional/resource/windows_firewall_rule_spec.rb +0 -93
- data/spec/functional/resource/windows_font_spec.rb +0 -52
- data/spec/functional/resource/windows_hostname_spec.rb +0 -91
- data/spec/functional/resource/windows_package_spec.rb +0 -193
- data/spec/functional/resource/windows_pagefile_spec.rb +0 -125
- data/spec/functional/resource/windows_path_spec.rb +0 -68
- data/spec/functional/resource/windows_security_policy_spec.rb +0 -86
- data/spec/functional/resource/windows_share_spec.rb +0 -103
- data/spec/functional/resource/windows_task_spec.rb +0 -1969
- data/spec/functional/resource/windows_user_privilege_spec.rb +0 -192
- data/spec/functional/resource/yum_package_spec.rb +0 -1739
- data/spec/functional/resource/zypper_package_spec.rb +0 -276
- data/spec/functional/root_alias_spec.rb +0 -78
- data/spec/functional/run_lock_spec.rb +0 -481
- data/spec/functional/shell_spec.rb +0 -149
- data/spec/functional/tiny_server_spec.rb +0 -79
- data/spec/functional/util/path_helper_spec.rb +0 -37
- data/spec/functional/version_spec.rb +0 -36
- data/spec/functional/win32/crypto_spec.rb +0 -54
- data/spec/functional/win32/registry_spec.rb +0 -618
- data/spec/functional/win32/security_spec.rb +0 -233
- data/spec/functional/win32/sid_spec.rb +0 -55
- data/spec/functional/win32/version_info_spec.rb +0 -50
- data/spec/functional/win32/versions_spec.rb +0 -115
- data/spec/integration/client/client_spec.rb +0 -963
- data/spec/integration/client/exit_code_spec.rb +0 -116
- data/spec/integration/client/fips_spec.rb +0 -29
- data/spec/integration/client/ipv6_spec.rb +0 -135
- data/spec/integration/client/open_ssl_spec.rb +0 -25
- data/spec/integration/compliance/compliance_spec.rb +0 -143
- data/spec/integration/ohai/ohai_spec.rb +0 -62
- data/spec/integration/recipes/accumulator_spec.rb +0 -245
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +0 -176
- data/spec/integration/recipes/lwrp_spec.rb +0 -56
- data/spec/integration/recipes/noop_resource_spec.rb +0 -24
- data/spec/integration/recipes/notifies_spec.rb +0 -438
- data/spec/integration/recipes/notifying_block_spec.rb +0 -116
- data/spec/integration/recipes/provider_choice.rb +0 -38
- data/spec/integration/recipes/recipe_dsl_spec.rb +0 -1281
- data/spec/integration/recipes/remote_directory.rb +0 -74
- data/spec/integration/recipes/resource_action_spec.rb +0 -524
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +0 -554
- data/spec/integration/recipes/resource_load_spec.rb +0 -315
- data/spec/integration/recipes/unified_mode_spec.rb +0 -947
- data/spec/integration/recipes/use_partial_spec.rb +0 -116
- data/spec/integration/solo/solo_spec.rb +0 -219
- data/spec/rcov.opts +0 -2
- data/spec/spec_helper.rb +0 -350
- data/spec/stress/win32/file_spec.rb +0 -37
- data/spec/stress/win32/memory_spec.rb +0 -22
- data/spec/stress/win32/security_spec.rb +0 -69
- data/spec/support/chef_helpers.rb +0 -79
- data/spec/support/key_helpers.rb +0 -102
- data/spec/support/lib/chef/provider/easy.rb +0 -35
- data/spec/support/lib/chef/provider/openldap_includer.rb +0 -29
- data/spec/support/lib/chef/provider/snakeoil.rb +0 -42
- data/spec/support/lib/chef/resource/cat.rb +0 -39
- data/spec/support/lib/chef/resource/one_two_three_four.rb +0 -36
- data/spec/support/lib/chef/resource/openldap_includer.rb +0 -28
- data/spec/support/lib/chef/resource/with_state.rb +0 -29
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -36
- data/spec/support/lib/chef/resource/zen_master.rb +0 -39
- data/spec/support/lib/library_load_order.rb +0 -20
- data/spec/support/matchers/leak.rb +0 -96
- data/spec/support/mock/platform.rb +0 -33
- data/spec/support/platform_helpers.rb +0 -284
- data/spec/support/platforms/prof/gc.rb +0 -51
- data/spec/support/platforms/prof/win32.rb +0 -45
- data/spec/support/platforms/win32/spec_service.rb +0 -57
- data/spec/support/recipe_dsl_helper.rb +0 -83
- data/spec/support/ruby_installer.rb +0 -51
- data/spec/support/shared/context/config.rb +0 -18
- data/spec/support/shared/context/win32.rb +0 -34
- data/spec/support/shared/functional/diff_disabled.rb +0 -10
- data/spec/support/shared/functional/directory_resource.rb +0 -178
- data/spec/support/shared/functional/execute_resource.rb +0 -150
- data/spec/support/shared/functional/file_resource.rb +0 -1047
- data/spec/support/shared/functional/http.rb +0 -224
- data/spec/support/shared/functional/knife.rb +0 -37
- data/spec/support/shared/functional/securable_resource.rb +0 -654
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +0 -393
- data/spec/support/shared/functional/windows_script.rb +0 -260
- data/spec/support/shared/integration/integration_helper.rb +0 -122
- data/spec/support/shared/integration/knife_support.rb +0 -192
- data/spec/support/shared/matchers/exit_with_code.rb +0 -32
- data/spec/support/shared/matchers/match_environment_variable.rb +0 -17
- data/spec/support/shared/shared_examples.rb +0 -14
- data/spec/support/shared/unit/api_error_inspector.rb +0 -190
- data/spec/support/shared/unit/api_versioning.rb +0 -77
- data/spec/support/shared/unit/application_dot_d.rb +0 -82
- data/spec/support/shared/unit/execute_resource.rb +0 -166
- data/spec/support/shared/unit/file_system_support.rb +0 -70
- data/spec/support/shared/unit/knife_shared.rb +0 -39
- data/spec/support/shared/unit/mock_shellout.rb +0 -49
- data/spec/support/shared/unit/platform_introspector.rb +0 -189
- data/spec/support/shared/unit/provider/file.rb +0 -877
- data/spec/support/shared/unit/provider/package/package_shared.rb +0 -95
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +0 -410
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +0 -63
- data/spec/support/shared/unit/script_resource.rb +0 -74
- data/spec/support/shared/unit/user_and_client_shared.rb +0 -114
- data/spec/support/shared/unit/windows_script_resource.rb +0 -65
- data/spec/tiny_server.rb +0 -193
- data/spec/unit/action_collection_spec.rb +0 -19
- data/spec/unit/api_client/registration_spec.rb +0 -278
- data/spec/unit/api_client_spec.rb +0 -341
- data/spec/unit/api_client_v1_spec.rb +0 -455
- data/spec/unit/application/agent_spec.rb +0 -0
- data/spec/unit/application/apply_spec.rb +0 -116
- data/spec/unit/application/base_spec.rb +0 -40
- data/spec/unit/application/client_spec.rb +0 -588
- data/spec/unit/application/exit_code_spec.rb +0 -145
- data/spec/unit/application/server_spec.rb +0 -0
- data/spec/unit/application/solo_spec.rb +0 -218
- data/spec/unit/application_spec.rb +0 -587
- data/spec/unit/chef_class_spec.rb +0 -240
- data/spec/unit/chef_fs/config_spec.rb +0 -235
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +0 -82
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +0 -65
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +0 -63
- data/spec/unit/chef_fs/diff_spec.rb +0 -328
- data/spec/unit/chef_fs/file_pattern_spec.rb +0 -512
- data/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb +0 -34
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +0 -45
- data/spec/unit/chef_fs/file_system/repository/base_file_spec.rb +0 -126
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +0 -175
- data/spec/unit/chef_fs/file_system_spec.rb +0 -150
- data/spec/unit/chef_fs/path_util_spec.rb +0 -108
- data/spec/unit/chef_spec.rb +0 -25
- data/spec/unit/client_spec.rb +0 -881
- data/spec/unit/compliance/fetcher/automate_spec.rb +0 -126
- data/spec/unit/compliance/fetcher/chef_server_spec.rb +0 -93
- data/spec/unit/compliance/input_spec.rb +0 -104
- data/spec/unit/compliance/profile_spec.rb +0 -120
- data/spec/unit/compliance/reporter/automate_spec.rb +0 -451
- data/spec/unit/compliance/reporter/chef_server_automate_spec.rb +0 -197
- data/spec/unit/compliance/reporter/compliance_enforcer_spec.rb +0 -49
- data/spec/unit/compliance/runner_spec.rb +0 -354
- data/spec/unit/compliance/waiver_spec.rb +0 -104
- data/spec/unit/config_fetcher_spec.rb +0 -125
- data/spec/unit/config_spec.rb +0 -31
- data/spec/unit/cookbook/chefignore_spec.rb +0 -69
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +0 -213
- data/spec/unit/cookbook/file_vendor_spec.rb +0 -123
- data/spec/unit/cookbook/gem_installer_spec.rb +0 -114
- data/spec/unit/cookbook/manifest_v0_spec.rb +0 -133
- data/spec/unit/cookbook/manifest_v2_spec.rb +0 -70
- data/spec/unit/cookbook/metadata_spec.rb +0 -610
- data/spec/unit/cookbook/synchronizer_spec.rb +0 -560
- data/spec/unit/cookbook/syntax_check_spec.rb +0 -229
- data/spec/unit/cookbook_loader_spec.rb +0 -265
- data/spec/unit/cookbook_manifest_spec.rb +0 -228
- data/spec/unit/cookbook_spec.rb +0 -62
- data/spec/unit/cookbook_uploader_spec.rb +0 -205
- data/spec/unit/cookbook_version_file_specificity_spec.rb +0 -623
- data/spec/unit/cookbook_version_spec.rb +0 -341
- data/spec/unit/daemon_spec.rb +0 -179
- data/spec/unit/data_bag_item_spec.rb +0 -387
- data/spec/unit/data_bag_spec.rb +0 -263
- data/spec/unit/data_collector/config_validation_spec.rb +0 -208
- data/spec/unit/data_collector_spec.rb +0 -1076
- data/spec/unit/decorator/lazy_array_spec.rb +0 -58
- data/spec/unit/decorator/lazy_spec.rb +0 -39
- data/spec/unit/decorator_spec.rb +0 -142
- data/spec/unit/delayed_evaluator_spec.rb +0 -35
- data/spec/unit/deprecated_spec.rb +0 -65
- data/spec/unit/deprecation_spec.rb +0 -129
- data/spec/unit/digester_spec.rb +0 -49
- data/spec/unit/dsl/data_query_spec.rb +0 -108
- data/spec/unit/dsl/declare_resource_spec.rb +0 -374
- data/spec/unit/dsl/platform_introspection_spec.rb +0 -160
- data/spec/unit/dsl/reboot_pending_spec.rb +0 -87
- data/spec/unit/dsl/recipe_spec.rb +0 -76
- data/spec/unit/dsl/registry_helper_spec.rb +0 -52
- data/spec/unit/dsl/render_helpers_spec.rb +0 -102
- data/spec/unit/dsl/resources_spec.rb +0 -85
- data/spec/unit/dsl/secret_spec.rb +0 -175
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +0 -97
- data/spec/unit/encrypted_data_bag_item_spec.rb +0 -439
- data/spec/unit/environment_spec.rb +0 -476
- data/spec/unit/event_dispatch/dispatcher_spec.rb +0 -172
- data/spec/unit/event_dispatch/dsl_spec.rb +0 -83
- data/spec/unit/exceptions_spec.rb +0 -132
- data/spec/unit/file_access_control_spec.rb +0 -308
- data/spec/unit/file_cache_spec.rb +0 -178
- data/spec/unit/file_content_management/deploy/cp_spec.rb +0 -44
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +0 -113
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +0 -232
- data/spec/unit/file_content_management/tempfile_spec.rb +0 -115
- data/spec/unit/formatters/base_spec.rb +0 -100
- data/spec/unit/formatters/doc_spec.rb +0 -110
- data/spec/unit/formatters/error_description_spec.rb +0 -141
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +0 -76
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +0 -265
- data/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +0 -126
- data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +0 -43
- data/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb +0 -26
- data/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb +0 -26
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +0 -191
- data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +0 -91
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +0 -155
- data/spec/unit/guard_interpreter_spec.rb +0 -41
- data/spec/unit/handler/json_file_spec.rb +0 -63
- data/spec/unit/handler_spec.rb +0 -308
- data/spec/unit/http/api_versions_spec.rb +0 -100
- data/spec/unit/http/authenticator_spec.rb +0 -247
- data/spec/unit/http/basic_client_spec.rb +0 -102
- data/spec/unit/http/http_request_spec.rb +0 -97
- data/spec/unit/http/json_input_spec.rb +0 -128
- data/spec/unit/http/simple_spec.rb +0 -32
- data/spec/unit/http/socketless_chef_zero_client_spec.rb +0 -174
- data/spec/unit/http/ssl_policies_spec.rb +0 -228
- data/spec/unit/http/validate_content_length_spec.rb +0 -207
- data/spec/unit/http_spec.rb +0 -235
- data/spec/unit/json_compat_spec.rb +0 -73
- data/spec/unit/key_spec.rb +0 -631
- data/spec/unit/log/syslog_spec.rb +0 -47
- data/spec/unit/log/winevt_spec.rb +0 -62
- data/spec/unit/lwrp_spec.rb +0 -693
- data/spec/unit/mixin/api_version_request_handling_spec.rb +0 -126
- data/spec/unit/mixin/checksum_spec.rb +0 -82
- data/spec/unit/mixin/convert_to_class_name_spec.rb +0 -54
- data/spec/unit/mixin/deep_merge_spec.rb +0 -357
- data/spec/unit/mixin/default_paths_spec.rb +0 -92
- data/spec/unit/mixin/deprecation_spec.rb +0 -57
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +0 -96
- data/spec/unit/mixin/homebrew_spec.rb +0 -118
- data/spec/unit/mixin/lazy_module_include.rb +0 -71
- data/spec/unit/mixin/openssl_helper_spec.rb +0 -897
- data/spec/unit/mixin/params_validate_spec.rb +0 -422
- data/spec/unit/mixin/powershell_exec_spec.rb +0 -90
- data/spec/unit/mixin/powershell_out_spec.rb +0 -106
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +0 -84
- data/spec/unit/mixin/properties_spec.rb +0 -107
- data/spec/unit/mixin/proxified_socket_spec.rb +0 -97
- data/spec/unit/mixin/securable_spec.rb +0 -313
- data/spec/unit/mixin/shell_out_spec.rb +0 -308
- data/spec/unit/mixin/subclass_directive_spec.rb +0 -45
- data/spec/unit/mixin/template_spec.rb +0 -317
- data/spec/unit/mixin/unformatter_spec.rb +0 -60
- data/spec/unit/mixin/uris_spec.rb +0 -57
- data/spec/unit/mixin/user_context_spec.rb +0 -99
- data/spec/unit/mixin/versioned_api_spec.rb +0 -128
- data/spec/unit/mixin/which.rb +0 -170
- data/spec/unit/mixin/why_run_spec.rb +0 -53
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +0 -85
- data/spec/unit/mixin/xml_escape_spec.rb +0 -54
- data/spec/unit/monologger_spec.rb +0 -45
- data/spec/unit/node/attribute_spec.rb +0 -1322
- data/spec/unit/node/immutable_collections_spec.rb +0 -258
- data/spec/unit/node/vivid_mash_spec.rb +0 -500
- data/spec/unit/node_map_spec.rb +0 -276
- data/spec/unit/node_spec.rb +0 -2038
- data/spec/unit/org_group_spec.rb +0 -45
- data/spec/unit/org_spec.rb +0 -196
- data/spec/unit/platform/query_helpers_spec.rb +0 -48
- data/spec/unit/policy_builder/dynamic_spec.rb +0 -256
- data/spec/unit/policy_builder/expand_node_object_spec.rb +0 -311
- data/spec/unit/policy_builder/policyfile_spec.rb +0 -960
- data/spec/unit/policy_builder_spec.rb +0 -26
- data/spec/unit/property/state_spec.rb +0 -514
- data/spec/unit/property/validation_spec.rb +0 -813
- data/spec/unit/property_spec.rb +0 -1329
- data/spec/unit/provider/apt_preference_spec.rb +0 -91
- data/spec/unit/provider/apt_repository_spec.rb +0 -370
- data/spec/unit/provider/apt_update_spec.rb +0 -119
- data/spec/unit/provider/batch_spec.rb +0 -130
- data/spec/unit/provider/cookbook_file/content_spec.rb +0 -39
- data/spec/unit/provider/cookbook_file_spec.rb +0 -59
- data/spec/unit/provider/cron/unix_spec.rb +0 -144
- data/spec/unit/provider/cron_spec.rb +0 -1252
- data/spec/unit/provider/directory_spec.rb +0 -289
- data/spec/unit/provider/dsc_resource_spec.rb +0 -313
- data/spec/unit/provider/dsc_script_spec.rb +0 -173
- data/spec/unit/provider/execute_spec.rb +0 -244
- data/spec/unit/provider/file/content_spec.rb +0 -114
- data/spec/unit/provider/file_spec.rb +0 -58
- data/spec/unit/provider/git_spec.rb +0 -822
- data/spec/unit/provider/group/dscl_spec.rb +0 -339
- data/spec/unit/provider/group/gpasswd_spec.rb +0 -119
- data/spec/unit/provider/group/groupadd_spec.rb +0 -195
- data/spec/unit/provider/group/groupmod_spec.rb +0 -136
- data/spec/unit/provider/group/pw_spec.rb +0 -141
- data/spec/unit/provider/group/solaris_spec.rb +0 -106
- data/spec/unit/provider/group/usermod_spec.rb +0 -112
- data/spec/unit/provider/group/windows_spec.rb +0 -130
- data/spec/unit/provider/group_spec.rb +0 -285
- data/spec/unit/provider/http_request_spec.rb +0 -147
- data/spec/unit/provider/ifconfig/aix_spec.rb +0 -180
- data/spec/unit/provider/ifconfig/debian_spec.rb +0 -332
- data/spec/unit/provider/ifconfig/redhat_spec.rb +0 -83
- data/spec/unit/provider/ifconfig_spec.rb +0 -247
- data/spec/unit/provider/launchd_spec.rb +0 -234
- data/spec/unit/provider/link_spec.rb +0 -425
- data/spec/unit/provider/log_spec.rb +0 -94
- data/spec/unit/provider/mdadm_spec.rb +0 -138
- data/spec/unit/provider/mount/aix_spec.rb +0 -277
- data/spec/unit/provider/mount/linux_spec.rb +0 -131
- data/spec/unit/provider/mount/mount_spec.rb +0 -590
- data/spec/unit/provider/mount/solaris_spec.rb +0 -822
- data/spec/unit/provider/mount/windows_spec.rb +0 -150
- data/spec/unit/provider/mount_spec.rb +0 -222
- data/spec/unit/provider/package/apt_spec.rb +0 -703
- data/spec/unit/provider/package/bff_spec.rb +0 -188
- data/spec/unit/provider/package/cab_spec.rb +0 -272
- data/spec/unit/provider/package/chocolatey_spec.rb +0 -574
- data/spec/unit/provider/package/deb_spec.rb +0 -135
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +0 -36
- data/spec/unit/provider/package/dpkg_spec.rb +0 -314
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +0 -147
- data/spec/unit/provider/package/freebsd/port_spec.rb +0 -151
- data/spec/unit/provider/package/homebrew_spec.rb +0 -402
- data/spec/unit/provider/package/ips_spec.rb +0 -233
- data/spec/unit/provider/package/macports_spec.rb +0 -203
- data/spec/unit/provider/package/msu_spec.rb +0 -283
- data/spec/unit/provider/package/openbsd_spec.rb +0 -136
- data/spec/unit/provider/package/pacman_spec.rb +0 -109
- data/spec/unit/provider/package/paludis_spec.rb +0 -134
- data/spec/unit/provider/package/portage_spec.rb +0 -179
- data/spec/unit/provider/package/powershell_spec.rb +0 -565
- data/spec/unit/provider/package/rpm_spec.rb +0 -440
- data/spec/unit/provider/package/rubygems_spec.rb +0 -1187
- data/spec/unit/provider/package/smartos_spec.rb +0 -110
- data/spec/unit/provider/package/snap_spec.rb +0 -208
- data/spec/unit/provider/package/solaris_spec.rb +0 -168
- data/spec/unit/provider/package/windows/exe_spec.rb +0 -201
- data/spec/unit/provider/package/windows/msi_spec.rb +0 -168
- data/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb +0 -78
- data/spec/unit/provider/package/windows_spec.rb +0 -441
- data/spec/unit/provider/package/yum/python_helper_spec.rb +0 -30
- data/spec/unit/provider/package/yum/yum_cache_spec.rb +0 -109
- data/spec/unit/provider/package/zypper_spec.rb +0 -494
- data/spec/unit/provider/package_spec.rb +0 -791
- data/spec/unit/provider/powershell_script_spec.rb +0 -157
- data/spec/unit/provider/registry_key_spec.rb +0 -487
- data/spec/unit/provider/remote_directory_spec.rb +0 -236
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +0 -245
- data/spec/unit/provider/remote_file/content_spec.rb +0 -253
- data/spec/unit/provider/remote_file/fetcher_spec.rb +0 -95
- data/spec/unit/provider/remote_file/ftp_spec.rb +0 -217
- data/spec/unit/provider/remote_file/http_spec.rb +0 -334
- data/spec/unit/provider/remote_file/local_file_spec.rb +0 -105
- data/spec/unit/provider/remote_file/network_file_spec.rb +0 -50
- data/spec/unit/provider/remote_file/sftp_spec.rb +0 -150
- data/spec/unit/provider/remote_file_spec.rb +0 -61
- data/spec/unit/provider/route_spec.rb +0 -268
- data/spec/unit/provider/ruby_block_spec.rb +0 -45
- data/spec/unit/provider/script_spec.rb +0 -67
- data/spec/unit/provider/service/aix_service_spec.rb +0 -195
- data/spec/unit/provider/service/aixinit_service_spec.rb +0 -272
- data/spec/unit/provider/service/arch_service_spec.rb +0 -326
- data/spec/unit/provider/service/debian_service_spec.rb +0 -273
- data/spec/unit/provider/service/freebsd_service_spec.rb +0 -621
- data/spec/unit/provider/service/gentoo_service_spec.rb +0 -145
- data/spec/unit/provider/service/init_service_spec.rb +0 -235
- data/spec/unit/provider/service/insserv_service_spec.rb +0 -75
- data/spec/unit/provider/service/invokercd_service_spec.rb +0 -211
- data/spec/unit/provider/service/macosx_spec.rb +0 -337
- data/spec/unit/provider/service/openbsd_service_spec.rb +0 -553
- data/spec/unit/provider/service/redhat_spec.rb +0 -253
- data/spec/unit/provider/service/simple_service_spec.rb +0 -171
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +0 -292
- data/spec/unit/provider/service/systemd_service_spec.rb +0 -504
- data/spec/unit/provider/service/upstart_service_spec.rb +0 -322
- data/spec/unit/provider/service/windows_spec.rb +0 -986
- data/spec/unit/provider/service_spec.rb +0 -168
- data/spec/unit/provider/subversion_spec.rb +0 -364
- data/spec/unit/provider/systemd_unit_spec.rb +0 -1039
- data/spec/unit/provider/template/content_spec.rb +0 -169
- data/spec/unit/provider/template_spec.rb +0 -86
- data/spec/unit/provider/user/aix_spec.rb +0 -96
- data/spec/unit/provider/user/linux_spec.rb +0 -178
- data/spec/unit/provider/user/mac_spec.rb +0 -38
- data/spec/unit/provider/user/pw_spec.rb +0 -235
- data/spec/unit/provider/user/solaris_spec.rb +0 -177
- data/spec/unit/provider/user/windows_spec.rb +0 -198
- data/spec/unit/provider/user_spec.rb +0 -520
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +0 -46
- data/spec/unit/provider/windows_env_spec.rb +0 -385
- data/spec/unit/provider/windows_path_spec.rb +0 -60
- data/spec/unit/provider/windows_task_spec.rb +0 -436
- data/spec/unit/provider/yum_repository_spec.rb +0 -35
- data/spec/unit/provider/zypper_repository_spec.rb +0 -169
- data/spec/unit/provider_spec.rb +0 -215
- data/spec/unit/pure_application_spec.rb +0 -32
- data/spec/unit/recipe_spec.rb +0 -703
- data/spec/unit/resource/alternatives_spec.rb +0 -120
- data/spec/unit/resource/apt_package_spec.rb +0 -71
- data/spec/unit/resource/apt_preference_spec.rb +0 -39
- data/spec/unit/resource/apt_repository_spec.rb +0 -79
- data/spec/unit/resource/apt_update_spec.rb +0 -44
- data/spec/unit/resource/archive_file_spec.rb +0 -466
- data/spec/unit/resource/bash_spec.rb +0 -45
- data/spec/unit/resource/batch_spec.rb +0 -46
- data/spec/unit/resource/bff_package_spec.rb +0 -51
- data/spec/unit/resource/breakpoint_spec.rb +0 -64
- data/spec/unit/resource/build_essential_spec.rb +0 -77
- data/spec/unit/resource/cab_package_spec.rb +0 -64
- data/spec/unit/resource/chef_client_config_spec.rb +0 -145
- data/spec/unit/resource/chef_client_cron_spec.rb +0 -161
- data/spec/unit/resource/chef_client_launchd_spec.rb +0 -132
- data/spec/unit/resource/chef_client_scheduled_task_spec.rb +0 -186
- data/spec/unit/resource/chef_client_systemd_timer_spec.rb +0 -108
- data/spec/unit/resource/chef_client_trusted_certificate_spec.rb +0 -68
- data/spec/unit/resource/chef_gem_spec.rb +0 -122
- data/spec/unit/resource/chef_handler_spec.rb +0 -40
- data/spec/unit/resource/chef_sleep_spec.rb +0 -30
- data/spec/unit/resource/chef_vault_secret_spec.rb +0 -40
- data/spec/unit/resource/chocolatey_config_spec.rb +0 -93
- data/spec/unit/resource/chocolatey_feature_spec.rb +0 -89
- data/spec/unit/resource/chocolatey_installer_spec.rb +0 -151
- data/spec/unit/resource/chocolatey_package_spec.rb +0 -106
- data/spec/unit/resource/chocolatey_source_spec.rb +0 -151
- data/spec/unit/resource/conditional_action_not_nothing_spec.rb +0 -45
- data/spec/unit/resource/conditional_spec.rb +0 -254
- data/spec/unit/resource/cookbook_file_spec.rb +0 -93
- data/spec/unit/resource/cron_access_spec.rb +0 -36
- data/spec/unit/resource/cron_d_spec.rb +0 -84
- data/spec/unit/resource/cron_spec.rb +0 -167
- data/spec/unit/resource/csh_spec.rb +0 -45
- data/spec/unit/resource/directory_spec.rb +0 -69
- data/spec/unit/resource/dmg_package_spec.rb +0 -39
- data/spec/unit/resource/dnf_package_spec.rb +0 -114
- data/spec/unit/resource/dpkg_package_spec.rb +0 -72
- data/spec/unit/resource/dsc_resource_spec.rb +0 -102
- data/spec/unit/resource/dsc_script_spec.rb +0 -134
- data/spec/unit/resource/execute_spec.rb +0 -282
- data/spec/unit/resource/file/verification/json_spec.rb +0 -72
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +0 -103
- data/spec/unit/resource/file/verification/yaml_spec.rb +0 -67
- data/spec/unit/resource/file/verification_spec.rb +0 -147
- data/spec/unit/resource/file_spec.rb +0 -127
- data/spec/unit/resource/freebsd_package_spec.rb +0 -77
- data/spec/unit/resource/gem_package_spec.rb +0 -67
- data/spec/unit/resource/group_spec.rb +0 -165
- data/spec/unit/resource/helpers/cron_validations_spec.rb +0 -81
- data/spec/unit/resource/homebrew_cask_spec.rb +0 -58
- data/spec/unit/resource/homebrew_package_spec.rb +0 -68
- data/spec/unit/resource/homebrew_tap_spec.rb +0 -44
- data/spec/unit/resource/homebrew_update_spec.rb +0 -30
- data/spec/unit/resource/hostname_spec.rb +0 -47
- data/spec/unit/resource/http_request_spec.rb +0 -65
- data/spec/unit/resource/ifconfig_spec.rb +0 -101
- data/spec/unit/resource/inspec_input_spec.rb +0 -300
- data/spec/unit/resource/inspec_waiver_file_entry_spec.rb +0 -80
- data/spec/unit/resource/inspec_waiver_spec.rb +0 -312
- data/spec/unit/resource/ips_package_spec.rb +0 -54
- data/spec/unit/resource/kernel_module_spec.rb +0 -45
- data/spec/unit/resource/ksh_spec.rb +0 -45
- data/spec/unit/resource/launchd_spec.rb +0 -48
- data/spec/unit/resource/link_spec.rb +0 -120
- data/spec/unit/resource/locale_spec.rb +0 -189
- data/spec/unit/resource/log_spec.rb +0 -64
- data/spec/unit/resource/macos_pkg_spec.rb +0 -38
- data/spec/unit/resource/macos_user_defaults_spec.rb +0 -76
- data/spec/unit/resource/macosx_service.rb +0 -37
- data/spec/unit/resource/macports_package_spec.rb +0 -51
- data/spec/unit/resource/mdadm_spec.rb +0 -104
- data/spec/unit/resource/mount_spec.rb +0 -201
- data/spec/unit/resource/msu_package_spec.rb +0 -67
- data/spec/unit/resource/notify_group_spec.rb +0 -34
- data/spec/unit/resource/ohai_hint_spec.rb +0 -44
- data/spec/unit/resource/ohai_spec.rb +0 -185
- data/spec/unit/resource/openbsd_package_spec.rb +0 -58
- data/spec/unit/resource/openssl_dhparam_spec.rb +0 -61
- data/spec/unit/resource/openssl_ec_private_key_spec.rb +0 -64
- data/spec/unit/resource/openssl_ec_public_key_spec.rb +0 -43
- data/spec/unit/resource/openssl_rsa_private_key_spec.rb +0 -64
- data/spec/unit/resource/openssl_rsa_public_key_spec.rb +0 -43
- data/spec/unit/resource/openssl_x509_certificate_spec.rb +0 -72
- data/spec/unit/resource/openssl_x509_crl_spec.rb +0 -61
- data/spec/unit/resource/openssl_x509_request.rb +0 -68
- data/spec/unit/resource/osx_profile_spec.rb +0 -360
- data/spec/unit/resource/package_spec.rb +0 -98
- data/spec/unit/resource/pacman_package_spec.rb +0 -46
- data/spec/unit/resource/paludis_package_spec.rb +0 -36
- data/spec/unit/resource/perl_spec.rb +0 -44
- data/spec/unit/resource/plist_spec.rb +0 -130
- data/spec/unit/resource/portage_package_spec.rb +0 -46
- data/spec/unit/resource/powershell_package_source_spec.rb +0 -220
- data/spec/unit/resource/powershell_package_spec.rb +0 -98
- data/spec/unit/resource/powershell_script_spec.rb +0 -65
- data/spec/unit/resource/python_spec.rb +0 -40
- data/spec/unit/resource/reboot_spec.rb +0 -47
- data/spec/unit/resource/registry_key_spec.rb +0 -215
- data/spec/unit/resource/remote_directory_spec.rb +0 -118
- data/spec/unit/resource/remote_file_spec.rb +0 -220
- data/spec/unit/resource/resource_notification_spec.rb +0 -169
- data/spec/unit/resource/rest_resource_spec.rb +0 -381
- data/spec/unit/resource/rhsm_errata_level_spec.rb +0 -50
- data/spec/unit/resource/rhsm_errata_spec.rb +0 -39
- data/spec/unit/resource/rhsm_register_spec.rb +0 -308
- data/spec/unit/resource/rhsm_repo_spec.rb +0 -70
- data/spec/unit/resource/rhsm_subscription_spec.rb +0 -145
- data/spec/unit/resource/route_spec.rb +0 -100
- data/spec/unit/resource/rpm_package_spec.rb +0 -62
- data/spec/unit/resource/ruby_block_spec.rb +0 -58
- data/spec/unit/resource/ruby_spec.rb +0 -39
- data/spec/unit/resource/scm/git_spec.rb +0 -110
- data/spec/unit/resource/scm/scm.rb +0 -122
- data/spec/unit/resource/scm/subversion_spec.rb +0 -90
- data/spec/unit/resource/script_spec.rb +0 -57
- data/spec/unit/resource/selinux_boolean_spec.rb +0 -92
- data/spec/unit/resource/selinux_fcontext_spec.rb +0 -65
- data/spec/unit/resource/selinux_install_spec.rb +0 -60
- data/spec/unit/resource/selinux_login_spec.rb +0 -73
- data/spec/unit/resource/selinux_module_spec.rb +0 -55
- data/spec/unit/resource/selinux_permissive_spec.rb +0 -39
- data/spec/unit/resource/selinux_port_spec.rb +0 -42
- data/spec/unit/resource/selinux_state_spec.rb +0 -46
- data/spec/unit/resource/selinux_user_spec.rb +0 -92
- data/spec/unit/resource/service_spec.rb +0 -203
- data/spec/unit/resource/smartos_package_spec.rb +0 -52
- data/spec/unit/resource/snap_package_spec.rb +0 -60
- data/spec/unit/resource/solaris_package_spec.rb +0 -52
- data/spec/unit/resource/ssh_known_hosts_entry_spec.rb +0 -50
- data/spec/unit/resource/sudo_spec.rb +0 -99
- data/spec/unit/resource/swap_file_spec.rb +0 -39
- data/spec/unit/resource/sysctl_spec.rb +0 -76
- data/spec/unit/resource/systemd_unit_spec.rb +0 -130
- data/spec/unit/resource/template_spec.rb +0 -222
- data/spec/unit/resource/timezone_spec.rb +0 -102
- data/spec/unit/resource/user/linux_user_spec.rb +0 -42
- data/spec/unit/resource/user/windows_user_spec.rb +0 -36
- data/spec/unit/resource/user_spec.rb +0 -121
- data/spec/unit/resource/user_ulimit_spec.rb +0 -66
- data/spec/unit/resource/windows_ad_join_spec.rb +0 -55
- data/spec/unit/resource/windows_audit_policy_spec.rb +0 -64
- data/spec/unit/resource/windows_auto_run_spec.rb +0 -50
- data/spec/unit/resource/windows_certificate_spec.rb +0 -95
- data/spec/unit/resource/windows_defender_exclusion_spec.rb +0 -62
- data/spec/unit/resource/windows_defender_spec.rb +0 -71
- data/spec/unit/resource/windows_dfs_folder_spec.rb +0 -39
- data/spec/unit/resource/windows_dfs_namespace_spec.rb +0 -39
- data/spec/unit/resource/windows_dfs_server_spec.rb +0 -34
- data/spec/unit/resource/windows_dns_record_spec.rb +0 -55
- data/spec/unit/resource/windows_dns_zone_spec.rb +0 -51
- data/spec/unit/resource/windows_env_spec.rb +0 -75
- data/spec/unit/resource/windows_feature_dism_spec.rb +0 -57
- data/spec/unit/resource/windows_feature_powershell_spec.rb +0 -83
- data/spec/unit/resource/windows_feature_spec.rb +0 -64
- data/spec/unit/resource/windows_firewall_profile_spec.rb +0 -77
- data/spec/unit/resource/windows_firewall_rule_spec.rb +0 -510
- data/spec/unit/resource/windows_font_spec.rb +0 -43
- data/spec/unit/resource/windows_package_spec.rb +0 -125
- data/spec/unit/resource/windows_pagefile_spec.rb +0 -44
- data/spec/unit/resource/windows_path_spec.rb +0 -40
- data/spec/unit/resource/windows_printer_port_spec.rb +0 -62
- data/spec/unit/resource/windows_printer_spec.rb +0 -52
- data/spec/unit/resource/windows_service_spec.rb +0 -122
- data/spec/unit/resource/windows_share_spec.rb +0 -48
- data/spec/unit/resource/windows_shortcut_spec.rb +0 -38
- data/spec/unit/resource/windows_task_spec.rb +0 -403
- data/spec/unit/resource/windows_uac_spec.rb +0 -50
- data/spec/unit/resource/windows_update_settings_spec.rb +0 -64
- data/spec/unit/resource/windows_user_privilege_spec.rb +0 -55
- data/spec/unit/resource/windows_workgroup_spec.rb +0 -74
- data/spec/unit/resource/yum_package_spec.rb +0 -159
- data/spec/unit/resource/yum_repository_spec.rb +0 -156
- data/spec/unit/resource/zypper_package_spec.rb +0 -51
- data/spec/unit/resource/zypper_repository_spec.rb +0 -115
- data/spec/unit/resource_builder_spec.rb +0 -1
- data/spec/unit/resource_collection/resource_list_spec.rb +0 -137
- data/spec/unit/resource_collection/resource_set_spec.rb +0 -244
- data/spec/unit/resource_collection/stepable_iterator_spec.rb +0 -144
- data/spec/unit/resource_collection_spec.rb +0 -408
- data/spec/unit/resource_definition_spec.rb +0 -117
- data/spec/unit/resource_inspector_spec.rb +0 -101
- data/spec/unit/resource_reporter_spec.rb +0 -802
- data/spec/unit/resource_resolver_spec.rb +0 -52
- data/spec/unit/resource_spec.rb +0 -1484
- data/spec/unit/role_spec.rb +0 -363
- data/spec/unit/run_context/child_run_context_spec.rb +0 -126
- data/spec/unit/run_context/cookbook_compiler_spec.rb +0 -236
- data/spec/unit/run_context_spec.rb +0 -257
- data/spec/unit/run_list/run_list_expansion_spec.rb +0 -147
- data/spec/unit/run_list/run_list_item_spec.rb +0 -117
- data/spec/unit/run_list/versioned_recipe_list_spec.rb +0 -197
- data/spec/unit/run_list_spec.rb +0 -312
- data/spec/unit/run_lock_spec.rb +0 -144
- data/spec/unit/run_status_spec.rb +0 -144
- data/spec/unit/runner_spec.rb +0 -397
- data/spec/unit/scan_access_control_spec.rb +0 -183
- data/spec/unit/search/query_spec.rb +0 -291
- data/spec/unit/secret_fetcher/akeyless_vault_spec.rb +0 -37
- data/spec/unit/secret_fetcher/aws_secrets_manager_spec.rb +0 -70
- data/spec/unit/secret_fetcher/azure_key_vault_spec.rb +0 -149
- data/spec/unit/secret_fetcher/hashi_vault_spec.rb +0 -126
- data/spec/unit/secret_fetcher_spec.rb +0 -82
- data/spec/unit/server_api_spec.rb +0 -151
- data/spec/unit/server_api_versions_spec.rb +0 -66
- data/spec/unit/shell/model_wrapper_spec.rb +0 -96
- data/spec/unit/shell/shell_ext_spec.rb +0 -196
- data/spec/unit/shell/shell_session_spec.rb +0 -218
- data/spec/unit/shell_spec.rb +0 -178
- data/spec/unit/train_transport_spec.rb +0 -85
- data/spec/unit/user_spec.rb +0 -275
- data/spec/unit/user_v1_spec.rb +0 -585
- data/spec/unit/util/backup_spec.rb +0 -141
- data/spec/unit/util/diff_spec.rb +0 -562
- data/spec/unit/util/dsc/configuration_generator_spec.rb +0 -272
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +0 -248
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +0 -192
- data/spec/unit/util/dsc/resource_store.rb +0 -78
- data/spec/unit/util/editor_spec.rb +0 -152
- data/spec/unit/util/file_edit_spec.rb +0 -224
- data/spec/unit/util/powershell/ps_credential_spec.rb +0 -51
- data/spec/unit/util/selinux_spec.rb +0 -160
- data/spec/unit/util/threaded_job_queue_spec.rb +0 -60
- data/spec/unit/util/windows/logon_session_spec.rb +0 -285
- data/spec/unit/version/platform_spec.rb +0 -60
- data/spec/unit/version_class_spec.rb +0 -171
- data/spec/unit/version_constraint/platform_spec.rb +0 -45
- data/spec/unit/version_constraint_spec.rb +0 -179
- data/spec/unit/version_string_spec.rb +0 -79
- data/spec/unit/win32/error_spec.rb +0 -77
- data/spec/unit/win32/link_spec.rb +0 -73
- data/spec/unit/win32/registry_spec.rb +0 -394
- data/spec/unit/win32/security_spec.rb +0 -136
- data/tasks/rspec.rb +0 -87
data/spec/unit/resource_spec.rb
DELETED
@@ -1,1484 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Author:: Christopher Walters (<cw@chef.io>)
|
4
|
-
# Author:: Tim Hinderliter (<tim@chef.io>)
|
5
|
-
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
6
|
-
# Copyright:: Copyright (c) Chef Software Inc.
|
7
|
-
# License:: Apache License, Version 2.0
|
8
|
-
#
|
9
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
10
|
-
# you may not use this file except in compliance with the License.
|
11
|
-
# You may obtain a copy of the License at
|
12
|
-
#
|
13
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
14
|
-
#
|
15
|
-
# Unless required by applicable law or agreed to in writing, software
|
16
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
17
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
18
|
-
# See the License for the specific language governing permissions and
|
19
|
-
# limitations under the License.
|
20
|
-
#
|
21
|
-
|
22
|
-
require "spec_helper"
|
23
|
-
|
24
|
-
describe Chef::Resource do
|
25
|
-
let(:cookbook_repo_path) { File.join(CHEF_SPEC_DATA, "cookbooks") }
|
26
|
-
let(:cookbook_collection) { Chef::CookbookCollection.new(Chef::CookbookLoader.new(cookbook_repo_path)) }
|
27
|
-
let(:node) { Chef::Node.new }
|
28
|
-
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
29
|
-
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
|
30
|
-
let(:resource) { resource_class.new("funk", run_context) }
|
31
|
-
let(:resource_class) { Chef::Resource }
|
32
|
-
|
33
|
-
it "should mixin shell_out" do
|
34
|
-
expect(resource.respond_to?(:shell_out)).to be true
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should mixin shell_out!" do
|
38
|
-
expect(resource.respond_to?(:shell_out!)).to be true
|
39
|
-
end
|
40
|
-
|
41
|
-
describe "when inherited" do
|
42
|
-
|
43
|
-
it "adds an entry to a list of subclasses" do
|
44
|
-
subclass = Class.new(Chef::Resource)
|
45
|
-
expect(Chef::Resource.resource_classes).to include(subclass)
|
46
|
-
end
|
47
|
-
|
48
|
-
it "keeps track of subclasses of subclasses" do
|
49
|
-
subclass = Class.new(Chef::Resource)
|
50
|
-
subclass_of_subclass = Class.new(subclass)
|
51
|
-
expect(Chef::Resource.resource_classes).to include(subclass_of_subclass)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "when declaring the identity attribute" do
|
57
|
-
it "has :name as identity attribute by default" do
|
58
|
-
expect(Chef::Resource.identity_attr).to eq(:name)
|
59
|
-
end
|
60
|
-
|
61
|
-
it "sets an identity attribute" do
|
62
|
-
resource_class = Class.new(Chef::Resource)
|
63
|
-
resource_class.identity_attr(:path)
|
64
|
-
expect(resource_class.identity_attr).to eq(:path)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "inherits an identity attribute from a superclass" do
|
68
|
-
resource_class = Class.new(Chef::Resource)
|
69
|
-
resource_subclass = Class.new(resource_class)
|
70
|
-
resource_class.identity_attr(:package_name)
|
71
|
-
expect(resource_subclass.identity_attr).to eq(:package_name)
|
72
|
-
end
|
73
|
-
|
74
|
-
it "overrides the identity attribute from a superclass when the identity attr is set" do
|
75
|
-
resource_class = Class.new(Chef::Resource)
|
76
|
-
resource_subclass = Class.new(resource_class)
|
77
|
-
resource_class.identity_attr(:package_name)
|
78
|
-
resource_subclass.identity_attr(:something_else)
|
79
|
-
expect(resource_subclass.identity_attr).to eq(:something_else)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
describe "when no identity attribute has been declared" do
|
84
|
-
let(:resource_sans_id) { Chef::Resource.new("my-name") }
|
85
|
-
|
86
|
-
# Would rather force identity attributes to be set for everything,
|
87
|
-
# but that's not plausible for back compat reasons.
|
88
|
-
it "uses the name as the identity" do
|
89
|
-
expect(resource_sans_id.identity).to eq("my-name")
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
describe "when an identity attribute has been declared" do
|
94
|
-
let(:file_resource) do
|
95
|
-
file_resource_class = Class.new(Chef::Resource) do
|
96
|
-
identity_attr :path
|
97
|
-
attr_accessor :path
|
98
|
-
end
|
99
|
-
|
100
|
-
file_resource = file_resource_class.new("identity-attr-test")
|
101
|
-
file_resource.path = "/tmp/foo.txt"
|
102
|
-
file_resource
|
103
|
-
end
|
104
|
-
|
105
|
-
it "gives the value of its identity attribute" do
|
106
|
-
expect(file_resource.identity).to eq("/tmp/foo.txt")
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
describe "when declaring state attributes" do
|
111
|
-
it "has no state_attrs by default" do
|
112
|
-
expect(Chef::Resource.state_attrs).to be_empty
|
113
|
-
end
|
114
|
-
|
115
|
-
it "sets a list of state attributes" do
|
116
|
-
resource_class = Class.new(Chef::Resource)
|
117
|
-
resource_class.state_attrs(:checksum, :owner, :group, :mode)
|
118
|
-
expect(resource_class.state_attrs).to match_array(%i{checksum owner group mode})
|
119
|
-
end
|
120
|
-
|
121
|
-
it "inherits state attributes from the superclass" do
|
122
|
-
resource_class = Class.new(Chef::Resource)
|
123
|
-
resource_subclass = Class.new(resource_class)
|
124
|
-
resource_class.state_attrs(:checksum, :owner, :group, :mode)
|
125
|
-
expect(resource_subclass.state_attrs).to match_array(%i{checksum owner group mode})
|
126
|
-
end
|
127
|
-
|
128
|
-
it "combines inherited state attributes with non-inherited state attributes" do
|
129
|
-
resource_class = Class.new(Chef::Resource)
|
130
|
-
resource_subclass = Class.new(resource_class)
|
131
|
-
resource_class.state_attrs(:checksum, :owner)
|
132
|
-
resource_subclass.state_attrs(:group, :mode)
|
133
|
-
expect(resource_subclass.state_attrs).to match_array(%i{checksum owner group mode})
|
134
|
-
end
|
135
|
-
|
136
|
-
end
|
137
|
-
|
138
|
-
describe "when a set of state attributes has been declared" do
|
139
|
-
let(:file_resource) do
|
140
|
-
file_resource_class = Class.new(Chef::Resource) do
|
141
|
-
|
142
|
-
state_attrs :checksum, :owner, :group, :mode
|
143
|
-
|
144
|
-
attr_accessor :checksum
|
145
|
-
attr_accessor :owner
|
146
|
-
attr_accessor :group
|
147
|
-
attr_accessor :mode
|
148
|
-
end
|
149
|
-
|
150
|
-
file_resource = file_resource_class.new("describe-state-test")
|
151
|
-
file_resource.checksum = "abc123"
|
152
|
-
file_resource.owner = "root"
|
153
|
-
file_resource.group = "wheel"
|
154
|
-
file_resource.mode = "0644"
|
155
|
-
file_resource
|
156
|
-
end
|
157
|
-
|
158
|
-
it "describes its state" do
|
159
|
-
resource_state = file_resource.state_for_resource_reporter
|
160
|
-
expect(resource_state.keys).to match_array(%i{checksum owner group mode})
|
161
|
-
expect(resource_state[:checksum]).to eq("abc123")
|
162
|
-
expect(resource_state[:owner]).to eq("root")
|
163
|
-
expect(resource_state[:group]).to eq("wheel")
|
164
|
-
expect(resource_state[:mode]).to eq("0644")
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe "#state_for_resource_reporter" do
|
169
|
-
context "when a property is marked as sensitive" do
|
170
|
-
it "suppresses the sensitive property's value" do
|
171
|
-
resource_class = Class.new(Chef::Resource) { property :foo, String, sensitive: true }
|
172
|
-
resource = resource_class.new("sensitive_property_tests")
|
173
|
-
resource.foo = "some value"
|
174
|
-
expect(resource.state_for_resource_reporter[:foo]).to eq("*sensitive value suppressed*")
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
context "when a property is not marked as sensitive" do
|
179
|
-
it "does not suppress the property's value" do
|
180
|
-
resource_class = Class.new(Chef::Resource) { property :foo, String }
|
181
|
-
resource = resource_class.new("sensitive_property_tests")
|
182
|
-
resource.foo = "some value"
|
183
|
-
expect(resource.state_for_resource_reporter[:foo]).to eq("some value")
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
describe "load_from" do
|
189
|
-
let(:prior_resource) do
|
190
|
-
prior_resource = Chef::Resource.new("funk")
|
191
|
-
prior_resource.source_line
|
192
|
-
prior_resource.allowed_actions << :funkytown
|
193
|
-
prior_resource.action(:funkytown)
|
194
|
-
prior_resource
|
195
|
-
end
|
196
|
-
before(:each) do
|
197
|
-
resource.allowed_actions << :funkytown
|
198
|
-
run_context.resource_collection << prior_resource
|
199
|
-
end
|
200
|
-
|
201
|
-
it "should load the attributes of a prior resource" do
|
202
|
-
resource.load_from(prior_resource)
|
203
|
-
end
|
204
|
-
|
205
|
-
it "should not inherit the action from the prior resource" do
|
206
|
-
resource.load_from(prior_resource)
|
207
|
-
expect(resource.action).not_to eq(prior_resource.action)
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
describe "name" do
|
212
|
-
it "should have a name" do
|
213
|
-
expect(resource.name).to eql("funk")
|
214
|
-
end
|
215
|
-
|
216
|
-
it "should let you set a new name" do
|
217
|
-
resource.name "monkey"
|
218
|
-
expect(resource.name).to eql("monkey")
|
219
|
-
end
|
220
|
-
|
221
|
-
it "coerces arrays to names" do
|
222
|
-
expect(resource.name %w{a b}).to eql("a, b")
|
223
|
-
end
|
224
|
-
|
225
|
-
it "should coerce objects to a string" do
|
226
|
-
expect(resource.name Object.new).to be_a(String)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
describe "notifies" do
|
231
|
-
it "should make notified resources appear in the actions hash" do
|
232
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
233
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee")
|
234
|
-
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
|
235
|
-
end
|
236
|
-
|
237
|
-
it "should make notified resources be capable of acting immediately" do
|
238
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
239
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee"), :immediate
|
240
|
-
expect(resource.immediate_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
|
241
|
-
end
|
242
|
-
|
243
|
-
it "should raise an exception if told to act in other than :delay or :immediate(ly)" do
|
244
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
245
|
-
expect do
|
246
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee"), :someday
|
247
|
-
end.to raise_error(ArgumentError)
|
248
|
-
end
|
249
|
-
|
250
|
-
it "should allow multiple notified resources appear in the actions hash" do
|
251
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
252
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee")
|
253
|
-
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee" && e.action == :reload }).not_to be_nil
|
254
|
-
|
255
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("beans")
|
256
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "beans")
|
257
|
-
expect(resource.delayed_notifications.detect { |e| e.resource.name == "beans" && e.action == :reload }).not_to be_nil
|
258
|
-
end
|
259
|
-
|
260
|
-
it "creates a notification for a resource that is not yet in the resource collection" do
|
261
|
-
resource.notifies(:restart, service: "apache")
|
262
|
-
expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
|
263
|
-
expect(resource.delayed_notifications).to include(expected_notification)
|
264
|
-
end
|
265
|
-
|
266
|
-
it "notifies another resource immediately" do
|
267
|
-
resource.notifies_immediately(:restart, service: "apache")
|
268
|
-
expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
|
269
|
-
expect(resource.immediate_notifications).to include(expected_notification)
|
270
|
-
end
|
271
|
-
|
272
|
-
it "notifies a resource to take action at the end of the chef run" do
|
273
|
-
resource.notifies_delayed(:restart, service: "apache")
|
274
|
-
expected_notification = Chef::Resource::Notification.new({ service: "apache" }, :restart, resource)
|
275
|
-
expect(resource.delayed_notifications).to include(expected_notification)
|
276
|
-
end
|
277
|
-
|
278
|
-
it "notifies a resource with an array for its name via its prettified string name" do
|
279
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new(%w{coffee tea})
|
280
|
-
resource.notifies :reload, run_context.resource_collection.find(zen_master: "coffee, tea")
|
281
|
-
expect(resource.delayed_notifications.detect { |e| e.resource.name == "coffee, tea" && e.action == :reload }).not_to be_nil
|
282
|
-
end
|
283
|
-
|
284
|
-
it "notifies a resource without a name via a string name with brackets" do
|
285
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("")
|
286
|
-
resource.notifies :reload, "zen_master[]"
|
287
|
-
end
|
288
|
-
|
289
|
-
it "notifies a resource without a name via a string name without brackets" do
|
290
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("")
|
291
|
-
resource.notifies :reload, "zen_master"
|
292
|
-
expect(resource.delayed_notifications.first.resource).to eql("zen_master")
|
293
|
-
end
|
294
|
-
|
295
|
-
it "notifies a resource without a name via a hash name with an empty string" do
|
296
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("")
|
297
|
-
resource.notifies :reload, zen_master: ""
|
298
|
-
expect(resource.delayed_notifications.first.resource).to eql(zen_master: "")
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
describe "subscribes" do
|
303
|
-
context "with syntax error in resources parameter" do
|
304
|
-
it "raises an exception immediately" do
|
305
|
-
expect do
|
306
|
-
resource.subscribes(:run, "typo[missing-closing-bracket")
|
307
|
-
end.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
it "should make resources appear in the actions hash of subscribed nodes" do
|
312
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
313
|
-
zr = run_context.resource_collection.find(zen_master: "coffee")
|
314
|
-
resource.subscribes :reload, zr
|
315
|
-
expect(zr.delayed_notifications.detect { |e| e.resource.name == "funk" && e.action == :reload }).not_to be_nil
|
316
|
-
end
|
317
|
-
|
318
|
-
it "should make resources appear in the actions hash of subscribed nodes" do
|
319
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
320
|
-
zr = run_context.resource_collection.find(zen_master: "coffee")
|
321
|
-
resource.subscribes :reload, zr
|
322
|
-
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
323
|
-
|
324
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("bean", run_context)
|
325
|
-
zrb = run_context.resource_collection.find(zen_master: "bean")
|
326
|
-
zrb.subscribes :reload, zr
|
327
|
-
expect(zr.delayed_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
328
|
-
end
|
329
|
-
|
330
|
-
it "should make subscribed resources be capable of acting immediately" do
|
331
|
-
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee", run_context)
|
332
|
-
zr = run_context.resource_collection.find(zen_master: "coffee")
|
333
|
-
resource.subscribes :reload, zr, :immediately
|
334
|
-
expect(zr.immediate_notifications.detect { |e| e.resource.name == resource.name && e.action == :reload }).not_to be_nil
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
describe "defined_at" do
|
339
|
-
it "should correctly parse source_line on unix-like operating systems" do
|
340
|
-
resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'"
|
341
|
-
expect(resource.defined_at).to eq("/some/path/to/file.rb line 80")
|
342
|
-
end
|
343
|
-
|
344
|
-
it "should correctly parse source_line on Windows" do
|
345
|
-
resource.source_line = "C:/some/path/to/file.rb:80 in 1`wombat_tears'"
|
346
|
-
expect(resource.defined_at).to eq("C:/some/path/to/file.rb line 80")
|
347
|
-
end
|
348
|
-
|
349
|
-
it "should include the cookbook and recipe when it knows it" do
|
350
|
-
resource.source_line = "/some/path/to/file.rb:80:in `wombat_tears'"
|
351
|
-
resource.recipe_name = "wombats"
|
352
|
-
resource.cookbook_name = "animals"
|
353
|
-
expect(resource.defined_at).to eq("animals::wombats line 80")
|
354
|
-
end
|
355
|
-
|
356
|
-
it "should recognize dynamically defined resources" do
|
357
|
-
expect(resource.defined_at).to eq("dynamically defined")
|
358
|
-
end
|
359
|
-
|
360
|
-
it "should return nil for the cookbook_version when the cookbook_name is @recipe_files" do
|
361
|
-
resource.cookbook_name = "@recipe_files"
|
362
|
-
expect(resource.cookbook_version).to be nil
|
363
|
-
end
|
364
|
-
end
|
365
|
-
|
366
|
-
describe "to_s" do
|
367
|
-
it "should become a string like resource_name[name]" do
|
368
|
-
zm = Chef::Resource::ZenMaster.new("coffee")
|
369
|
-
expect(zm.to_s).to eql("zen_master[coffee]")
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
describe "to_text" do
|
374
|
-
|
375
|
-
let(:sensitive_property_masked_value) { "sensitive value suppressed" }
|
376
|
-
|
377
|
-
it "prints nice message" do
|
378
|
-
resource_class = Class.new(Chef::Resource) { property :foo, String }
|
379
|
-
resource = resource_class.new("sensitive_property_tests")
|
380
|
-
resource.foo = "some value"
|
381
|
-
expect(resource.to_text).to match(/foo "some value"/)
|
382
|
-
end
|
383
|
-
|
384
|
-
context "when property is sensitive" do
|
385
|
-
it "suppresses that properties value" do
|
386
|
-
resource_class = Class.new(Chef::Resource) { property :foo, String, sensitive: true }
|
387
|
-
resource = resource_class.new("sensitive_property_tests")
|
388
|
-
resource.foo = "some value"
|
389
|
-
expect(resource.to_text).to match(/foo "\*#{sensitive_property_masked_value}\*"/)
|
390
|
-
end
|
391
|
-
it "suppresses that properties value irrespective of desired state (false) " do
|
392
|
-
resource_class = Class.new(Chef::Resource) {
|
393
|
-
property :suppressed_content, String, sensitive: true, desired_state: false
|
394
|
-
}
|
395
|
-
resource = resource_class.new("desired_state_property_tests")
|
396
|
-
resource.suppressed_content = "some value"
|
397
|
-
expect(resource.to_text).to match(/suppressed_content "\*#{sensitive_property_masked_value}\*"/)
|
398
|
-
end
|
399
|
-
|
400
|
-
it "suppresses that properties value irrespective of desired state (true) " do
|
401
|
-
resource_class = Class.new(Chef::Resource) {
|
402
|
-
property :desired_state_content, String, sensitive: true, desired_state: true
|
403
|
-
}
|
404
|
-
resource = resource_class.new("desired_state_property_tests")
|
405
|
-
resource.desired_state_content = "some value"
|
406
|
-
expect(resource.to_text).to match(/desired_state_content "\*#{sensitive_property_masked_value}\*"/)
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
context "when property is required" do
|
411
|
-
it "does not propagate validation errors" do
|
412
|
-
resource_class = Class.new(Chef::Resource) { property :foo, String, required: true }
|
413
|
-
resource = resource_class.new("required_property_tests")
|
414
|
-
expect { resource.to_text }.to_not raise_error
|
415
|
-
end
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
context "Documentation of resources" do
|
420
|
-
it "can have a description" do
|
421
|
-
c = Class.new(Chef::Resource) do
|
422
|
-
description "my description"
|
423
|
-
end
|
424
|
-
expect(c.description).to eq "my description"
|
425
|
-
end
|
426
|
-
|
427
|
-
it "can say when it was introduced" do
|
428
|
-
c = Class.new(Chef::Resource) do
|
429
|
-
introduced "14.0"
|
430
|
-
end
|
431
|
-
expect(c.introduced).to eq "14.0"
|
432
|
-
end
|
433
|
-
|
434
|
-
it "can have some examples" do
|
435
|
-
c = Class.new(Chef::Resource) do
|
436
|
-
examples <<~EOH
|
437
|
-
resource "foo" do
|
438
|
-
foo foo
|
439
|
-
end
|
440
|
-
EOH
|
441
|
-
end
|
442
|
-
expect(c.examples).to eq <<~EOH
|
443
|
-
resource "foo" do
|
444
|
-
foo foo
|
445
|
-
end
|
446
|
-
EOH
|
447
|
-
end
|
448
|
-
end
|
449
|
-
|
450
|
-
describe "self.resource_name" do
|
451
|
-
context "When resource_name is not set" do
|
452
|
-
it "and there are no provides lines, resource_name is nil" do
|
453
|
-
c = Class.new(Chef::Resource) do
|
454
|
-
end
|
455
|
-
|
456
|
-
r = c.new("hi")
|
457
|
-
r.declared_type = :d
|
458
|
-
expect(c.resource_name).to be_nil
|
459
|
-
expect(r.resource_name).to be_nil
|
460
|
-
expect(r.declared_type).to eq :d
|
461
|
-
end
|
462
|
-
|
463
|
-
it "and there are no provides lines, resource_name is used" do
|
464
|
-
c = Class.new(Chef::Resource) do
|
465
|
-
def initialize(*args, &block)
|
466
|
-
@resource_name = :blah
|
467
|
-
super
|
468
|
-
end
|
469
|
-
end
|
470
|
-
|
471
|
-
r = c.new("hi")
|
472
|
-
r.declared_type = :d
|
473
|
-
expect(c.resource_name).to be_nil
|
474
|
-
expect(r.resource_name).to eq :blah
|
475
|
-
expect(r.declared_type).to eq :d
|
476
|
-
end
|
477
|
-
|
478
|
-
it "and the resource class gets a late-bound name, resource_name is nil" do
|
479
|
-
c = Class.new(Chef::Resource) do
|
480
|
-
def self.name
|
481
|
-
"ResourceSpecNameTest"
|
482
|
-
end
|
483
|
-
end
|
484
|
-
|
485
|
-
r = c.new("hi")
|
486
|
-
r.declared_type = :d
|
487
|
-
expect(c.resource_name).to be_nil
|
488
|
-
expect(r.resource_name).to be_nil
|
489
|
-
expect(r.declared_type).to eq :d
|
490
|
-
end
|
491
|
-
end
|
492
|
-
|
493
|
-
it "resource_name without provides is honored" do
|
494
|
-
c = Class.new(Chef::Resource) do
|
495
|
-
resource_name "blah"
|
496
|
-
end
|
497
|
-
|
498
|
-
r = c.new("hi")
|
499
|
-
r.declared_type = :d
|
500
|
-
expect(c.resource_name).to eq :blah
|
501
|
-
expect(r.resource_name).to eq :blah
|
502
|
-
expect(r.declared_type).to eq :d
|
503
|
-
end
|
504
|
-
it "setting class.resource_name with 'resource_name = blah' overrides declared_type" do
|
505
|
-
c = Class.new(Chef::Resource) do
|
506
|
-
provides :self_resource_name_test_2
|
507
|
-
end
|
508
|
-
c.resource_name = :blah
|
509
|
-
|
510
|
-
r = c.new("hi")
|
511
|
-
r.declared_type = :d
|
512
|
-
expect(c.resource_name).to eq :blah
|
513
|
-
expect(r.resource_name).to eq :blah
|
514
|
-
expect(r.declared_type).to eq :d
|
515
|
-
end
|
516
|
-
it "setting class.resource_name with 'resource_name blah' overrides declared_type" do
|
517
|
-
c = Class.new(Chef::Resource) do
|
518
|
-
resource_name :blah
|
519
|
-
provides :self_resource_name_test_3
|
520
|
-
end
|
521
|
-
|
522
|
-
r = c.new("hi")
|
523
|
-
r.declared_type = :d
|
524
|
-
expect(c.resource_name).to eq :blah
|
525
|
-
expect(r.resource_name).to eq :blah
|
526
|
-
expect(r.declared_type).to eq :d
|
527
|
-
end
|
528
|
-
|
529
|
-
# This tests some somewhat confusing behavior that used to occur due to the resource_name call
|
530
|
-
# automatically wiring up the old canonical provides line.
|
531
|
-
it "setting resoure_name does not override provides in prior resource" do
|
532
|
-
c1 = Class.new(Chef::Resource) do
|
533
|
-
resource_name :self_resource_name_test_4
|
534
|
-
provides :self_resource_name_test_4
|
535
|
-
end
|
536
|
-
c2 = Class.new(Chef::Resource) do
|
537
|
-
resource_name :self_resource_name_test_4
|
538
|
-
provides(:self_resource_name_test_4) { false } # simulates any filter that does not match
|
539
|
-
end
|
540
|
-
expect(Chef::Resource.resource_for_node(:self_resource_name_test_4, node)).to eql(c1)
|
541
|
-
end
|
542
|
-
end
|
543
|
-
|
544
|
-
describe "to_json" do
|
545
|
-
it "should serialize to json" do
|
546
|
-
json = resource.to_json
|
547
|
-
expect(json).to match(/json_class/)
|
548
|
-
expect(json).to match(/instance_vars/)
|
549
|
-
end
|
550
|
-
|
551
|
-
include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
|
552
|
-
let(:jsonable) { resource }
|
553
|
-
end
|
554
|
-
end
|
555
|
-
|
556
|
-
describe "to_hash" do
|
557
|
-
context "when the resource has a property with a default" do
|
558
|
-
let(:resource_class) { Class.new(Chef::Resource) { property :a, default: 1 } }
|
559
|
-
it "should include the default in the hash" do
|
560
|
-
expect(resource.to_hash.keys.sort).to eq(%i{a allowed_actions params provider updated
|
561
|
-
updated_by_last_action before
|
562
|
-
name source_line
|
563
|
-
action elapsed_time
|
564
|
-
default_guard_interpreter guard_interpreter}.sort)
|
565
|
-
expect(resource.to_hash[:name]).to eq "funk"
|
566
|
-
expect(resource.to_hash[:a]).to eq 1
|
567
|
-
end
|
568
|
-
end
|
569
|
-
|
570
|
-
it "should convert to a hash" do
|
571
|
-
hash = resource.to_hash
|
572
|
-
expected_keys = %i{allowed_actions params provider updated
|
573
|
-
updated_by_last_action before
|
574
|
-
name source_line
|
575
|
-
action elapsed_time
|
576
|
-
default_guard_interpreter guard_interpreter}
|
577
|
-
expect(hash.keys - expected_keys).to eq([])
|
578
|
-
expect(expected_keys - hash.keys).to eq([])
|
579
|
-
expect(hash[:name]).to eql("funk")
|
580
|
-
end
|
581
|
-
end
|
582
|
-
|
583
|
-
describe "self.json_create" do
|
584
|
-
it "should deserialize itself from json" do
|
585
|
-
json = Chef::JSONCompat.to_json(resource)
|
586
|
-
serialized_node = Chef::Resource.from_json(json)
|
587
|
-
expect(serialized_node).to be_a_kind_of(Chef::Resource)
|
588
|
-
expect(serialized_node.name).to eql(resource.name)
|
589
|
-
end
|
590
|
-
end
|
591
|
-
|
592
|
-
describe "ignore_failure" do
|
593
|
-
it "should default to throwing an error if a provider fails for a resource" do
|
594
|
-
expect(resource.ignore_failure).to eq(false)
|
595
|
-
end
|
596
|
-
|
597
|
-
it "should allow you to set whether a provider should throw exceptions with ignore_failure" do
|
598
|
-
resource.ignore_failure(true)
|
599
|
-
expect(resource.ignore_failure).to eq(true)
|
600
|
-
end
|
601
|
-
|
602
|
-
it "should allow you to set quiet ignore_failure as a symbol" do
|
603
|
-
resource.ignore_failure(:quiet)
|
604
|
-
expect(resource.ignore_failure).to eq(:quiet)
|
605
|
-
end
|
606
|
-
|
607
|
-
it "should allow you to set quiet ignore_failure as a string" do
|
608
|
-
resource.ignore_failure("quiet")
|
609
|
-
expect(resource.ignore_failure).to eq("quiet")
|
610
|
-
end
|
611
|
-
end
|
612
|
-
|
613
|
-
describe "retries" do
|
614
|
-
let(:retriable_resource) do
|
615
|
-
retriable_resource = Chef::Resource::Cat.new("precious", run_context)
|
616
|
-
retriable_resource.provider = Chef::Provider::SnakeOil
|
617
|
-
retriable_resource.action = :purr
|
618
|
-
retriable_resource
|
619
|
-
end
|
620
|
-
|
621
|
-
before do
|
622
|
-
node.automatic_attrs[:platform] = "fubuntu"
|
623
|
-
node.automatic_attrs[:platform_version] = "10.04"
|
624
|
-
end
|
625
|
-
|
626
|
-
it "should default to not retrying if a provider fails for a resource" do
|
627
|
-
expect(retriable_resource.retries).to eq(0)
|
628
|
-
end
|
629
|
-
|
630
|
-
it "should allow you to set how many retries a provider should attempt after a failure" do
|
631
|
-
retriable_resource.retries(2)
|
632
|
-
expect(retriable_resource.retries).to eq(2)
|
633
|
-
end
|
634
|
-
|
635
|
-
it "should default to a retry delay of 2 seconds" do
|
636
|
-
expect(retriable_resource.retry_delay).to eq(2)
|
637
|
-
end
|
638
|
-
|
639
|
-
it "should allow you to set the retry delay" do
|
640
|
-
retriable_resource.retry_delay(10)
|
641
|
-
expect(retriable_resource.retry_delay).to eq(10)
|
642
|
-
end
|
643
|
-
|
644
|
-
it "should keep given value of retries intact after the provider fails for a resource" do
|
645
|
-
retriable_resource.retries(3)
|
646
|
-
retriable_resource.retry_delay(0) # No need to wait.
|
647
|
-
|
648
|
-
provider = Chef::Provider::SnakeOil.new(retriable_resource, run_context)
|
649
|
-
allow(Chef::Provider::SnakeOil).to receive(:new).and_return(provider)
|
650
|
-
allow(provider).to receive(:action_purr).and_raise
|
651
|
-
|
652
|
-
expect(retriable_resource).to receive(:sleep).exactly(3).times
|
653
|
-
expect { retriable_resource.run_action(:purr) }.to raise_error(RuntimeError)
|
654
|
-
expect(retriable_resource.retries).to eq(3)
|
655
|
-
end
|
656
|
-
|
657
|
-
it "should not rescue from non-StandardError exceptions" do
|
658
|
-
retriable_resource.retries(3)
|
659
|
-
retriable_resource.retry_delay(0) # No need to wait.
|
660
|
-
|
661
|
-
provider = Chef::Provider::SnakeOil.new(retriable_resource, run_context)
|
662
|
-
allow(Chef::Provider::SnakeOil).to receive(:new).and_return(provider)
|
663
|
-
allow(provider).to receive(:action_purr).and_raise(LoadError)
|
664
|
-
|
665
|
-
expect(retriable_resource).not_to receive(:sleep)
|
666
|
-
expect { retriable_resource.run_action(:purr) }.to raise_error(LoadError)
|
667
|
-
end
|
668
|
-
end
|
669
|
-
|
670
|
-
it "runs an action by finding its provider, loading the current resource and then running the action" do
|
671
|
-
skip
|
672
|
-
end
|
673
|
-
|
674
|
-
describe "when updated by a provider" do
|
675
|
-
before do
|
676
|
-
resource.updated_by_last_action(true)
|
677
|
-
end
|
678
|
-
|
679
|
-
it "records that it was updated" do
|
680
|
-
expect(resource).to be_updated
|
681
|
-
end
|
682
|
-
|
683
|
-
it "records that the last action updated the resource" do
|
684
|
-
expect(resource).to be_updated_by_last_action
|
685
|
-
end
|
686
|
-
|
687
|
-
describe "and then run again without being updated" do
|
688
|
-
before do
|
689
|
-
resource.updated_by_last_action(false)
|
690
|
-
end
|
691
|
-
|
692
|
-
it "reports that it is updated" do
|
693
|
-
expect(resource).to be_updated
|
694
|
-
end
|
695
|
-
|
696
|
-
it "reports that it was not updated by the last action" do
|
697
|
-
expect(resource).not_to be_updated_by_last_action
|
698
|
-
end
|
699
|
-
|
700
|
-
end
|
701
|
-
|
702
|
-
end
|
703
|
-
|
704
|
-
describe "when invoking its action" do
|
705
|
-
let(:resource) do
|
706
|
-
resource = Chef::Resource.new("provided", run_context)
|
707
|
-
resource.provider = Chef::Provider::SnakeOil
|
708
|
-
resource
|
709
|
-
end
|
710
|
-
before do
|
711
|
-
node.automatic_attrs[:platform] = "fubuntu"
|
712
|
-
node.automatic_attrs[:platform_version] = "10.04"
|
713
|
-
end
|
714
|
-
|
715
|
-
it "does not run only_if if no only_if command is given" do
|
716
|
-
expect_any_instance_of(Chef::Resource::Conditional).not_to receive(:evaluate)
|
717
|
-
resource.only_if.clear
|
718
|
-
resource.run_action(:purr)
|
719
|
-
end
|
720
|
-
|
721
|
-
it "runs runs an only_if when one is given" do
|
722
|
-
snitch_variable = nil
|
723
|
-
resource.only_if { snitch_variable = true }
|
724
|
-
expect(resource.only_if.first.positivity).to eq(:only_if)
|
725
|
-
# Chef::Mixin::Command.should_receive(:only_if).with(true, {}).and_return(false)
|
726
|
-
resource.run_action(:purr)
|
727
|
-
expect(snitch_variable).to be_truthy
|
728
|
-
end
|
729
|
-
|
730
|
-
it "runs multiple only_if conditionals" do
|
731
|
-
snitch_var1, snitch_var2 = nil, nil
|
732
|
-
resource.only_if { snitch_var1 = 1 }
|
733
|
-
resource.only_if { snitch_var2 = 2 }
|
734
|
-
resource.run_action(:purr)
|
735
|
-
expect(snitch_var1).to eq(1)
|
736
|
-
expect(snitch_var2).to eq(2)
|
737
|
-
end
|
738
|
-
|
739
|
-
it "accepts command options for only_if conditionals" do
|
740
|
-
expect_any_instance_of(Chef::Resource::Conditional).to receive(:evaluate_command).at_least(1).times
|
741
|
-
resource.only_if("true", cwd: "/tmp")
|
742
|
-
expect(resource.only_if.first.command_opts).to eq({ cwd: "/tmp" })
|
743
|
-
resource.run_action(:purr)
|
744
|
-
end
|
745
|
-
|
746
|
-
it "runs not_if as a command when it is a string" do
|
747
|
-
expect_any_instance_of(Chef::Resource::Conditional).to receive(:evaluate_command).at_least(1).times
|
748
|
-
resource.not_if "pwd"
|
749
|
-
resource.run_action(:purr)
|
750
|
-
end
|
751
|
-
|
752
|
-
it "runs not_if as a block when it is a ruby block" do
|
753
|
-
expect_any_instance_of(Chef::Resource::Conditional).to receive(:evaluate_block).at_least(1).times
|
754
|
-
resource.not_if { puts "foo" }
|
755
|
-
resource.run_action(:purr)
|
756
|
-
end
|
757
|
-
|
758
|
-
it "does not run not_if if no not_if command is given" do
|
759
|
-
expect_any_instance_of(Chef::Resource::Conditional).not_to receive(:evaluate)
|
760
|
-
resource.not_if.clear
|
761
|
-
resource.run_action(:purr)
|
762
|
-
end
|
763
|
-
|
764
|
-
it "accepts command options for not_if conditionals" do
|
765
|
-
resource.not_if("pwd" , cwd: "/tmp")
|
766
|
-
expect(resource.not_if.first.command_opts).to eq({ cwd: "/tmp" })
|
767
|
-
end
|
768
|
-
|
769
|
-
it "accepts multiple not_if conditionals" do
|
770
|
-
snitch_var1, snitch_var2 = true, true
|
771
|
-
resource.not_if { snitch_var1 = nil }
|
772
|
-
resource.not_if { snitch_var2 = false }
|
773
|
-
resource.run_action(:purr)
|
774
|
-
expect(snitch_var1).to be_nil
|
775
|
-
expect(snitch_var2).to be_falsey
|
776
|
-
end
|
777
|
-
|
778
|
-
it "reports 0 elapsed time if actual elapsed time is < 0" do
|
779
|
-
expected = Time.now
|
780
|
-
allow(Time).to receive(:now).and_return(expected, expected - 1)
|
781
|
-
resource.run_action(:purr)
|
782
|
-
expect(resource.elapsed_time).to eq(0)
|
783
|
-
end
|
784
|
-
|
785
|
-
describe "guard_interpreter attribute" do
|
786
|
-
it "should be set to :default by default" do
|
787
|
-
expect(resource.guard_interpreter).to eq(:default)
|
788
|
-
end
|
789
|
-
|
790
|
-
it "if set to :default should return :default when read" do
|
791
|
-
resource.guard_interpreter(:default)
|
792
|
-
expect(resource.guard_interpreter).to eq(:default)
|
793
|
-
end
|
794
|
-
|
795
|
-
it "should raise Chef::Exceptions::ValidationFailed on an attempt to set the guard_interpreter attribute to something other than a Symbol" do
|
796
|
-
expect { resource.guard_interpreter("command_dot_com") }.to raise_error(Chef::Exceptions::ValidationFailed)
|
797
|
-
end
|
798
|
-
|
799
|
-
it "should not raise an exception when setting the guard interpreter attribute to a Symbol" do
|
800
|
-
allow(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:new).and_return(nil)
|
801
|
-
expect { resource.guard_interpreter(:command_dot_com) }.not_to raise_error
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
|
806
|
-
describe "when using resource partials" do
|
807
|
-
let(:resource_using_core_partial) do
|
808
|
-
Class.new(Chef::Resource) do
|
809
|
-
use "core::core_partial"
|
810
|
-
end
|
811
|
-
end
|
812
|
-
|
813
|
-
let(:resource_using_cookbook_partial) do
|
814
|
-
Class.new(Chef::Resource) do
|
815
|
-
use "my_local_partial"
|
816
|
-
end
|
817
|
-
end
|
818
|
-
|
819
|
-
let(:resource_using_nested_partials) do
|
820
|
-
FakeCaller = Struct.new(:label, :path, keyword_init: true)
|
821
|
-
NonDynamicResource = Chef::Resource.dup
|
822
|
-
|
823
|
-
# Fake a caller_locations array, as RSpec uses a different execution path
|
824
|
-
NonDynamicResource.define_singleton_method(:caller_locations) do
|
825
|
-
[
|
826
|
-
FakeCaller.new(label: "use", path: File.join(__dir__, "resource.rb")),
|
827
|
-
FakeCaller.new(label: "noise", path: File.join(__dir__, "no_file")),
|
828
|
-
FakeCaller.new(label: "class_from_file", path: File.join(__dir__, "_level3_partial.rb")),
|
829
|
-
FakeCaller.new(label: "noise", path: File.join(__dir__, "no_file")),
|
830
|
-
FakeCaller.new(label: "class_from_file", path: File.join(__dir__, "_level2_partial.rb")),
|
831
|
-
FakeCaller.new(label: "noise", path: File.join(__dir__, "no_file")),
|
832
|
-
FakeCaller.new(label: "class_from_file", path: File.join(__dir__, "_level1_partial.rb")),
|
833
|
-
FakeCaller.new(label: "noise", path: File.join(__dir__, "no_file")),
|
834
|
-
FakeCaller.new(label: "class_from_file", path: File.join(__dir__, "_level0_partial.rb")),
|
835
|
-
]
|
836
|
-
end
|
837
|
-
|
838
|
-
Class.new(NonDynamicResource) do
|
839
|
-
use "level3_partial"
|
840
|
-
end
|
841
|
-
end
|
842
|
-
|
843
|
-
it "correcly includes a core partial" do
|
844
|
-
expected_path = File.expand_path(File.join(__dir__, "../..", "lib/chef", "resource/_core_partial.rb"))
|
845
|
-
partial = "property :addon_property, default: true"
|
846
|
-
|
847
|
-
expect(IO).to receive(:read).with(expected_path).and_return(partial)
|
848
|
-
expect(resource_using_core_partial.properties.keys).to include(:addon_property)
|
849
|
-
end
|
850
|
-
|
851
|
-
it "correctly includes a cookbook partial" do
|
852
|
-
expected_path = File.expand_path(File.join(__dir__, "_my_local_partial.rb"))
|
853
|
-
partial = "property :addon_property, default: true"
|
854
|
-
|
855
|
-
expect(IO).to receive(:read).with(expected_path).and_return(partial)
|
856
|
-
expect(resource_using_cookbook_partial.properties.keys).to include(:addon_property)
|
857
|
-
end
|
858
|
-
|
859
|
-
it "correctly includes nested partials" do
|
860
|
-
level0_path = File.expand_path(File.join(__dir__, "_level0_partial.rb"))
|
861
|
-
level0_partial = "property :level0_property, default: true"
|
862
|
-
expect(IO).to receive(:read).with(level0_path).and_return(level0_partial)
|
863
|
-
|
864
|
-
level1_path = File.expand_path(File.join(__dir__, "_level1_partial.rb"))
|
865
|
-
level1_partial = <<-EOF
|
866
|
-
use 'level0_partial'
|
867
|
-
property :level1_property, default: true
|
868
|
-
EOF
|
869
|
-
expect(IO).to receive(:read).with(level1_path).and_return(level1_partial)
|
870
|
-
|
871
|
-
level2_path = File.expand_path(File.join(__dir__, "_level2_partial.rb"))
|
872
|
-
level2_partial = <<-EOF
|
873
|
-
use 'level1_partial'
|
874
|
-
property :level2_property, default: true
|
875
|
-
EOF
|
876
|
-
expect(IO).to receive(:read).with(level2_path).and_return(level2_partial)
|
877
|
-
|
878
|
-
level3_path = File.expand_path(File.join(__dir__, "_level3_partial.rb"))
|
879
|
-
level3_partial = <<-EOF
|
880
|
-
use 'level2_partial'
|
881
|
-
property :level3_property, default: true
|
882
|
-
EOF
|
883
|
-
expect(IO).to receive(:read).with(level3_path).and_return(level3_partial)
|
884
|
-
|
885
|
-
expect(resource_using_nested_partials.properties.keys).to include(:level0_property)
|
886
|
-
expect(resource_using_nested_partials.properties.keys).to include(:level1_property)
|
887
|
-
expect(resource_using_nested_partials.properties.keys).to include(:level2_property)
|
888
|
-
expect(resource_using_nested_partials.properties.keys).to include(:level3_property)
|
889
|
-
end
|
890
|
-
end
|
891
|
-
|
892
|
-
describe "should_skip?" do
|
893
|
-
before do
|
894
|
-
resource = Chef::Resource::Cat.new("sugar", run_context)
|
895
|
-
end
|
896
|
-
|
897
|
-
it "should return false by default" do
|
898
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
899
|
-
end
|
900
|
-
|
901
|
-
it "should return false when only_if is met" do
|
902
|
-
resource.only_if { true }
|
903
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
904
|
-
end
|
905
|
-
|
906
|
-
it "should return true when only_if is not met" do
|
907
|
-
resource.only_if { false }
|
908
|
-
expect(resource.should_skip?(:purr)).to be_truthy
|
909
|
-
end
|
910
|
-
|
911
|
-
it "should return true when not_if is met" do
|
912
|
-
resource.not_if { true }
|
913
|
-
expect(resource.should_skip?(:purr)).to be_truthy
|
914
|
-
end
|
915
|
-
|
916
|
-
it "should return false when not_if is not met" do
|
917
|
-
resource.not_if { false }
|
918
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
919
|
-
end
|
920
|
-
|
921
|
-
it "should return true when only_if is met but also not_if is met" do
|
922
|
-
resource.only_if { true }
|
923
|
-
resource.not_if { true }
|
924
|
-
expect(resource.should_skip?(:purr)).to be_truthy
|
925
|
-
end
|
926
|
-
|
927
|
-
it "should return false when only_if is met and also not_if is not met" do
|
928
|
-
resource.only_if { true }
|
929
|
-
resource.not_if { false }
|
930
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
931
|
-
end
|
932
|
-
|
933
|
-
it "should return true when one of multiple only_if's is not met" do
|
934
|
-
resource.only_if { true }
|
935
|
-
resource.only_if { false }
|
936
|
-
resource.only_if { true }
|
937
|
-
expect(resource.should_skip?(:purr)).to be_truthy
|
938
|
-
end
|
939
|
-
|
940
|
-
it "should return true when one of multiple not_if's is met" do
|
941
|
-
resource.not_if { false }
|
942
|
-
resource.not_if { true }
|
943
|
-
resource.not_if { false }
|
944
|
-
expect(resource.should_skip?(:purr)).to be_truthy
|
945
|
-
end
|
946
|
-
|
947
|
-
it "should return false when all of multiple only_if's are met" do
|
948
|
-
resource.only_if { true }
|
949
|
-
resource.only_if { true }
|
950
|
-
resource.only_if { true }
|
951
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
952
|
-
end
|
953
|
-
|
954
|
-
it "should return false when all of multiple not_if's are not met" do
|
955
|
-
resource.not_if { false }
|
956
|
-
resource.not_if { false }
|
957
|
-
resource.not_if { false }
|
958
|
-
expect(resource.should_skip?(:purr)).to be_falsey
|
959
|
-
end
|
960
|
-
|
961
|
-
it "should return true when action is :nothing" do
|
962
|
-
expect(resource.should_skip?(:nothing)).to be_truthy
|
963
|
-
end
|
964
|
-
|
965
|
-
it "should return true when action is :nothing ignoring only_if/not_if conditionals" do
|
966
|
-
resource.only_if { true }
|
967
|
-
resource.not_if { false }
|
968
|
-
expect(resource.should_skip?(:nothing)).to be_truthy
|
969
|
-
end
|
970
|
-
|
971
|
-
it "should print \"skipped due to action :nothing\" message for doc formatter when action is :nothing" do
|
972
|
-
fdoc = Chef::Formatters.new(:doc, STDOUT, STDERR)
|
973
|
-
allow(run_context).to receive(:events).and_return(fdoc)
|
974
|
-
expect(fdoc).to receive(:puts).with(" (skipped due to action :nothing)", anything)
|
975
|
-
resource.should_skip?(:nothing)
|
976
|
-
end
|
977
|
-
|
978
|
-
end
|
979
|
-
|
980
|
-
describe "when resource action is :nothing" do
|
981
|
-
let(:resource1) do
|
982
|
-
resource1 = Chef::Resource::Cat.new("sugar", run_context)
|
983
|
-
resource1.action = :nothing
|
984
|
-
resource1
|
985
|
-
end
|
986
|
-
before do
|
987
|
-
node.automatic_attrs[:platform] = "fubuntu"
|
988
|
-
node.automatic_attrs[:platform_version] = "10.04"
|
989
|
-
end
|
990
|
-
|
991
|
-
it "should not run only_if/not_if conditionals (CHEF-972)" do
|
992
|
-
snitch_var1 = 0
|
993
|
-
resource1.only_if { snitch_var1 = 1 }
|
994
|
-
resource1.not_if { snitch_var1 = 2 }
|
995
|
-
resource1.run_action(:nothing)
|
996
|
-
expect(snitch_var1).to eq(0)
|
997
|
-
end
|
998
|
-
|
999
|
-
it "should run only_if/not_if conditionals when notified to run another action (CHEF-972)" do
|
1000
|
-
snitch_var1 = snitch_var2 = 0
|
1001
|
-
runner = Chef::Runner.new(run_context)
|
1002
|
-
|
1003
|
-
Chef::Provider::SnakeOil.provides :cat
|
1004
|
-
|
1005
|
-
resource1.only_if { snitch_var1 = 1 }
|
1006
|
-
resource1.not_if { snitch_var2 = 2 }
|
1007
|
-
resource2 = Chef::Resource::Cat.new("coffee", run_context)
|
1008
|
-
resource2.notifies :purr, resource1
|
1009
|
-
resource2.action = :purr
|
1010
|
-
|
1011
|
-
run_context.resource_collection << resource1
|
1012
|
-
run_context.resource_collection << resource2
|
1013
|
-
runner.converge
|
1014
|
-
|
1015
|
-
expect(snitch_var1).to eq(1)
|
1016
|
-
expect(snitch_var2).to eq(2)
|
1017
|
-
end
|
1018
|
-
end
|
1019
|
-
|
1020
|
-
describe "building the platform map" do
|
1021
|
-
|
1022
|
-
let(:klz) { Class.new(Chef::Resource) }
|
1023
|
-
|
1024
|
-
before do
|
1025
|
-
Chef::Resource::Klz = klz
|
1026
|
-
end
|
1027
|
-
|
1028
|
-
after do
|
1029
|
-
Chef::Resource.send(:remove_const, :Klz)
|
1030
|
-
end
|
1031
|
-
|
1032
|
-
it "adds mappings for a single platform" do
|
1033
|
-
expect(Chef.resource_handler_map).to receive(:set).with(
|
1034
|
-
:dinobot, Chef::Resource::Klz, { platform: ["autobots"] }
|
1035
|
-
)
|
1036
|
-
klz.provides :dinobot, platform: ["autobots"]
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
it "adds mappings for multiple platforms" do
|
1040
|
-
expect(Chef.resource_handler_map).to receive(:set).with(
|
1041
|
-
:energy, Chef::Resource::Klz, { platform: %w{autobots decepticons} }
|
1042
|
-
)
|
1043
|
-
klz.provides :energy, platform: %w{autobots decepticons}
|
1044
|
-
end
|
1045
|
-
|
1046
|
-
it "adds mappings for all platforms", ruby: "< 2.7" do
|
1047
|
-
expect(Chef.resource_handler_map).to receive(:set).with(
|
1048
|
-
:tape_deck, Chef::Resource::Klz, {}
|
1049
|
-
)
|
1050
|
-
klz.provides :tape_deck
|
1051
|
-
end
|
1052
|
-
|
1053
|
-
it "adds mappings for all platforms", ruby: ">= 2.7" do
|
1054
|
-
expect(Chef.resource_handler_map).to receive(:set).with(
|
1055
|
-
:tape_deck, Chef::Resource::Klz
|
1056
|
-
)
|
1057
|
-
klz.provides :tape_deck
|
1058
|
-
end
|
1059
|
-
|
1060
|
-
end
|
1061
|
-
|
1062
|
-
describe "resource_for_node" do
|
1063
|
-
describe "lookups from the platform map" do
|
1064
|
-
let(:klz1) { Class.new(Chef::Resource) }
|
1065
|
-
|
1066
|
-
before(:each) do
|
1067
|
-
Chef::Resource::Klz1 = klz1
|
1068
|
-
node = Chef::Node.new
|
1069
|
-
node.name("bumblebee")
|
1070
|
-
node.automatic[:platform] = "autobots"
|
1071
|
-
node.automatic[:platform_version] = "6.1"
|
1072
|
-
Object.const_set(:Soundwave, klz1)
|
1073
|
-
klz1.provides :soundwave
|
1074
|
-
end
|
1075
|
-
|
1076
|
-
after(:each) do
|
1077
|
-
Object.send(:remove_const, :Soundwave)
|
1078
|
-
Chef::Resource.send(:remove_const, :Klz1)
|
1079
|
-
end
|
1080
|
-
|
1081
|
-
it "returns a resource by short_name if nothing else matches" do
|
1082
|
-
expect(Chef::Resource.resource_for_node(:soundwave, node)).to eql(klz1)
|
1083
|
-
end
|
1084
|
-
end
|
1085
|
-
|
1086
|
-
describe "lookups from the platform map" do
|
1087
|
-
let(:klz2) { Class.new(Chef::Resource) }
|
1088
|
-
|
1089
|
-
before(:each) do
|
1090
|
-
Chef::Resource::Klz2 = klz2
|
1091
|
-
node.name("bumblebee")
|
1092
|
-
node.automatic[:platform] = "autobots"
|
1093
|
-
node.automatic[:platform_version] = "6.1"
|
1094
|
-
klz2.provides :dinobot, platform: ["autobots"]
|
1095
|
-
Object.const_set(:Grimlock, klz2)
|
1096
|
-
klz2.provides :grimlock
|
1097
|
-
end
|
1098
|
-
|
1099
|
-
after(:each) do
|
1100
|
-
Object.send(:remove_const, :Grimlock)
|
1101
|
-
Chef::Resource.send(:remove_const, :Klz2)
|
1102
|
-
end
|
1103
|
-
|
1104
|
-
it "returns a resource by short_name and node" do
|
1105
|
-
expect(Chef::Resource.resource_for_node(:dinobot, node)).to eql(klz2)
|
1106
|
-
end
|
1107
|
-
end
|
1108
|
-
|
1109
|
-
describe "chef_version constraints and the platform map" do
|
1110
|
-
let(:klz3) { Class.new(Chef::Resource) }
|
1111
|
-
|
1112
|
-
it "doesn't wire up the provides when chef_version is < 1" do
|
1113
|
-
klz3.provides :bulbasaur, chef_version: "< 1.0" # this should be false
|
1114
|
-
expect { Chef::Resource.resource_for_node(:bulbasaur, node) }.to raise_error(Chef::Exceptions::NoSuchResourceType)
|
1115
|
-
end
|
1116
|
-
|
1117
|
-
it "wires up the provides when chef_version is > 1" do
|
1118
|
-
klz3.provides :bulbasaur, chef_version: "> 1.0" # this should be true
|
1119
|
-
expect(Chef::Resource.resource_for_node(:bulbasaur, node)).to eql(klz3)
|
1120
|
-
end
|
1121
|
-
|
1122
|
-
it "wires up the default when chef_version is < 1" do
|
1123
|
-
klz3.chef_version_for_provides("< 1.0") # this should be false
|
1124
|
-
klz3.provides :bulbasaur
|
1125
|
-
expect { Chef::Resource.resource_for_node(:bulbasaur, node) }.to raise_error(Chef::Exceptions::NoSuchResourceType)
|
1126
|
-
end
|
1127
|
-
|
1128
|
-
it "wires up the default when chef_version is > 1" do
|
1129
|
-
klz3.chef_version_for_provides("> 1.0") # this should be true
|
1130
|
-
klz3.provides :bulbasaur
|
1131
|
-
expect(Chef::Resource.resource_for_node(:bulbasaur, node)).to eql(klz3)
|
1132
|
-
end
|
1133
|
-
end
|
1134
|
-
|
1135
|
-
end
|
1136
|
-
|
1137
|
-
describe "when creating notifications" do
|
1138
|
-
|
1139
|
-
describe "with a string resource spec" do
|
1140
|
-
|
1141
|
-
it "creates a delayed notification when timing is not specified" do
|
1142
|
-
resource.notifies(:run, "execute[foo]")
|
1143
|
-
expect(run_context.delayed_notification_collection.size).to eq(1)
|
1144
|
-
end
|
1145
|
-
|
1146
|
-
it "creates a delayed notification when :delayed is not specified" do
|
1147
|
-
resource.notifies(:run, "execute[foo]", :delayed)
|
1148
|
-
expect(run_context.delayed_notification_collection.size).to eq(1)
|
1149
|
-
end
|
1150
|
-
|
1151
|
-
it "creates an immediate notification when :immediate is specified" do
|
1152
|
-
resource.notifies(:run, "execute[foo]", :immediate)
|
1153
|
-
expect(run_context.immediate_notification_collection.size).to eq(1)
|
1154
|
-
end
|
1155
|
-
|
1156
|
-
it "creates an immediate notification when :immediately is specified" do
|
1157
|
-
resource.notifies(:run, "execute[foo]", :immediately)
|
1158
|
-
expect(run_context.immediate_notification_collection.size).to eq(1)
|
1159
|
-
end
|
1160
|
-
|
1161
|
-
describe "with a syntax error in the resource spec" do
|
1162
|
-
|
1163
|
-
it "raises an exception immediately" do
|
1164
|
-
expect do
|
1165
|
-
resource.notifies(:run, "typo[missing-closing-bracket")
|
1166
|
-
end.to raise_error(Chef::Exceptions::InvalidResourceSpecification)
|
1167
|
-
end
|
1168
|
-
end
|
1169
|
-
end
|
1170
|
-
|
1171
|
-
describe "with a resource reference" do
|
1172
|
-
let(:notified_resource) { Chef::Resource.new("punk", run_context) }
|
1173
|
-
|
1174
|
-
it "creates a delayed notification when timing is not specified" do
|
1175
|
-
resource.notifies(:run, notified_resource)
|
1176
|
-
expect(run_context.delayed_notification_collection.size).to eq(1)
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
it "creates a delayed notification when :delayed is not specified" do
|
1180
|
-
resource.notifies(:run, notified_resource, :delayed)
|
1181
|
-
expect(run_context.delayed_notification_collection.size).to eq(1)
|
1182
|
-
end
|
1183
|
-
|
1184
|
-
it "creates an immediate notification when :immediate is specified" do
|
1185
|
-
resource.notifies(:run, notified_resource, :immediate)
|
1186
|
-
expect(run_context.immediate_notification_collection.size).to eq(1)
|
1187
|
-
end
|
1188
|
-
|
1189
|
-
it "creates an immediate notification when :immediately is specified" do
|
1190
|
-
resource.notifies(:run, notified_resource, :immediately)
|
1191
|
-
expect(run_context.immediate_notification_collection.size).to eq(1)
|
1192
|
-
end
|
1193
|
-
end
|
1194
|
-
|
1195
|
-
end
|
1196
|
-
|
1197
|
-
describe "resource sensitive attribute" do
|
1198
|
-
let(:resource_file) { Chef::Resource::File.new("/nonexistent/CHEF-5098/file", run_context) }
|
1199
|
-
let(:action) { :create }
|
1200
|
-
|
1201
|
-
def compiled_resource_data(resource, action, err)
|
1202
|
-
error_inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(resource, action, err)
|
1203
|
-
description = Chef::Formatters::ErrorDescription.new("test")
|
1204
|
-
error_inspector.add_explanation(description)
|
1205
|
-
Chef::Log.info("description: #{description.inspect},error_inspector: #{error_inspector}")
|
1206
|
-
description.sections[1]["Compiled Resource:"]
|
1207
|
-
end
|
1208
|
-
|
1209
|
-
it "set to false by default" do
|
1210
|
-
expect(resource.sensitive).to be_falsey
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
it "when set to false should show compiled resource for failed resource" do
|
1214
|
-
expect { resource_file.run_action(action) }.to raise_error { |err|
|
1215
|
-
expect(compiled_resource_data(resource_file, action, err)).to match 'path "/nonexistent/CHEF-5098/file"'
|
1216
|
-
}
|
1217
|
-
end
|
1218
|
-
|
1219
|
-
it "when set to true should show compiled resource for failed resource" do
|
1220
|
-
resource_file.sensitive true
|
1221
|
-
expect { resource_file.run_action(action) }.to raise_error { |err|
|
1222
|
-
expect(compiled_resource_data(resource_file, action, err)).to eql("suppressed sensitive resource output")
|
1223
|
-
}
|
1224
|
-
end
|
1225
|
-
|
1226
|
-
end
|
1227
|
-
|
1228
|
-
describe "#action" do
|
1229
|
-
let(:resource_class) do
|
1230
|
-
Class.new(described_class) do
|
1231
|
-
allowed_actions(%i{one two})
|
1232
|
-
end
|
1233
|
-
end
|
1234
|
-
let(:resource) { resource_class.new("test", nil) }
|
1235
|
-
subject { resource.action }
|
1236
|
-
|
1237
|
-
context "with a no action" do
|
1238
|
-
it { is_expected.to eq [:nothing] }
|
1239
|
-
end
|
1240
|
-
|
1241
|
-
context "with a default action" do
|
1242
|
-
let(:resource_class) do
|
1243
|
-
Class.new(described_class) do
|
1244
|
-
default_action(:one)
|
1245
|
-
end
|
1246
|
-
end
|
1247
|
-
it { is_expected.to eq [:one] }
|
1248
|
-
end
|
1249
|
-
|
1250
|
-
context "with a symbol action" do
|
1251
|
-
before { resource.action(:one) }
|
1252
|
-
it { is_expected.to eq [:one] }
|
1253
|
-
end
|
1254
|
-
|
1255
|
-
context "with a string action" do
|
1256
|
-
before { resource.action("two") }
|
1257
|
-
it { is_expected.to eq [:two] }
|
1258
|
-
end
|
1259
|
-
|
1260
|
-
context "with an array action" do
|
1261
|
-
before { resource.action(%i{two one}) }
|
1262
|
-
it { is_expected.to eq %i{two one} }
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
context "with an assignment" do
|
1266
|
-
before { resource.action = :one }
|
1267
|
-
it { is_expected.to eq [:one] }
|
1268
|
-
end
|
1269
|
-
|
1270
|
-
context "with an array assignment" do
|
1271
|
-
before { resource.action = %i{two one} }
|
1272
|
-
it { is_expected.to eq %i{two one} }
|
1273
|
-
end
|
1274
|
-
|
1275
|
-
context "with an invalid action" do
|
1276
|
-
it { expect { resource.action(:three) }.to raise_error Chef::Exceptions::ValidationFailed }
|
1277
|
-
end
|
1278
|
-
|
1279
|
-
context "with an invalid assignment action" do
|
1280
|
-
it { expect { resource.action = :three }.to raise_error Chef::Exceptions::ValidationFailed }
|
1281
|
-
end
|
1282
|
-
end
|
1283
|
-
|
1284
|
-
describe "#action_description" do
|
1285
|
-
class TestResource < ::Chef::Resource
|
1286
|
-
action :symbol_action, description: "a symbol test" do; end
|
1287
|
-
action "string_action", description: "a string test" do; end
|
1288
|
-
action :base_action0 do; end
|
1289
|
-
action :base_action1, description: "unmodified base action 1 desc" do; end
|
1290
|
-
action :base_action2, description: "unmodified base action 2 desc" do; end
|
1291
|
-
action :base_action3, description: "unmodified base action 3 desc" do; end
|
1292
|
-
end
|
1293
|
-
|
1294
|
-
let(:resource_inst) { TestResource.new("TestResource", nil) }
|
1295
|
-
|
1296
|
-
it "returns nil when no description was provided for the action" do
|
1297
|
-
expect(resource_inst.action_description(:base_action0)).to eql(nil)
|
1298
|
-
end
|
1299
|
-
|
1300
|
-
context "when action definition is a string" do
|
1301
|
-
it "returns the description whether a symbol or string is used to look it up" do
|
1302
|
-
expect(resource_inst.action_description("string_action")).to eql("a string test")
|
1303
|
-
expect(resource_inst.action_description(:string_action)).to eql("a string test")
|
1304
|
-
end
|
1305
|
-
end
|
1306
|
-
|
1307
|
-
context "when action definition is a symbol" do
|
1308
|
-
it "returns the description whether a symbol or string is used to look up" do
|
1309
|
-
expect(resource_inst.action_description("symbol_action")).to eql("a symbol test")
|
1310
|
-
expect(resource_inst.action_description(:symbol_action)).to eql("a symbol test")
|
1311
|
-
end
|
1312
|
-
end
|
1313
|
-
|
1314
|
-
context "when inheriting from an existing resource" do
|
1315
|
-
class TestResourceChild < TestResource
|
1316
|
-
action :base_action2, description: "modified base action 2 desc" do; end
|
1317
|
-
action :base_action3 do; end
|
1318
|
-
end
|
1319
|
-
|
1320
|
-
class TestResourceChild2 < TestResource
|
1321
|
-
# We should never see this description
|
1322
|
-
action :base_action2, description: "if you see this in an error, TestResourceChild was polluted with this description" do; end
|
1323
|
-
end
|
1324
|
-
let(:resource_inst) { TestResourceChild.new("TestResource", nil) }
|
1325
|
-
|
1326
|
-
it "returns original description when a described action is not overridden in child resource" do
|
1327
|
-
expect(resource_inst.action_description(:base_action1)).to eq "unmodified base action 1 desc"
|
1328
|
-
end
|
1329
|
-
it "returns original description when the child resource overrides an inherited action but NOT its description" do
|
1330
|
-
expect(resource_inst.action_description(:base_action3)).to eq "unmodified base action 3 desc"
|
1331
|
-
end
|
1332
|
-
it "returns new description when the child resource overrides an inherited action and its description" do
|
1333
|
-
expect(resource_inst.action_description(:base_action2)).to eq "modified base action 2 desc"
|
1334
|
-
end
|
1335
|
-
it "returns new description when the child resource overrides an inherited action and its description" do
|
1336
|
-
expect(resource_inst.action_description(:base_action2)).to eq "modified base action 2 desc"
|
1337
|
-
end
|
1338
|
-
end
|
1339
|
-
end
|
1340
|
-
|
1341
|
-
describe ".default_action" do
|
1342
|
-
let(:default_action) {}
|
1343
|
-
let(:resource_class) do
|
1344
|
-
actions = default_action
|
1345
|
-
Class.new(described_class) do
|
1346
|
-
default_action(actions) if actions
|
1347
|
-
end
|
1348
|
-
end
|
1349
|
-
subject { resource_class.default_action }
|
1350
|
-
|
1351
|
-
context "with no default actions" do
|
1352
|
-
it { is_expected.to eq [:nothing] }
|
1353
|
-
end
|
1354
|
-
|
1355
|
-
context "with a symbol default action" do
|
1356
|
-
let(:default_action) { :one }
|
1357
|
-
it { is_expected.to eq [:one] }
|
1358
|
-
end
|
1359
|
-
|
1360
|
-
context "with a string default action" do
|
1361
|
-
let(:default_action) { "one" }
|
1362
|
-
it { is_expected.to eq [:one] }
|
1363
|
-
end
|
1364
|
-
|
1365
|
-
context "with an array default action" do
|
1366
|
-
let(:default_action) { %i{two one} }
|
1367
|
-
it { is_expected.to eq %i{two one} }
|
1368
|
-
end
|
1369
|
-
end
|
1370
|
-
|
1371
|
-
describe ".preview_resource" do
|
1372
|
-
let(:klass) { Class.new(Chef::Resource) }
|
1373
|
-
|
1374
|
-
before do
|
1375
|
-
allow(Chef::DSL::Resources).to receive(:add_resource_dsl).with(:test_resource)
|
1376
|
-
end
|
1377
|
-
|
1378
|
-
it "defaults to false" do
|
1379
|
-
expect(klass.preview_resource).to eq false
|
1380
|
-
end
|
1381
|
-
|
1382
|
-
it "can be set to true" do
|
1383
|
-
klass.preview_resource(true)
|
1384
|
-
expect(klass.preview_resource).to eq true
|
1385
|
-
end
|
1386
|
-
|
1387
|
-
it "does not affect provides by default" do
|
1388
|
-
expect(Chef.resource_handler_map).to receive(:set).with(:test_resource, klass, any_args)
|
1389
|
-
klass.provides(:test_resource)
|
1390
|
-
end
|
1391
|
-
end
|
1392
|
-
|
1393
|
-
describe "tagged" do
|
1394
|
-
let(:recipe) do
|
1395
|
-
Chef::Recipe.new("hjk", "test", run_context)
|
1396
|
-
end
|
1397
|
-
|
1398
|
-
describe "with the default node object" do
|
1399
|
-
let(:node) { Chef::Node.new }
|
1400
|
-
|
1401
|
-
it "should return false for any tags" do
|
1402
|
-
expect(resource.tagged?("foo")).to be(false)
|
1403
|
-
end
|
1404
|
-
end
|
1405
|
-
|
1406
|
-
it "should return true from tagged? if node is tagged" do
|
1407
|
-
recipe.tag "foo"
|
1408
|
-
expect(resource.tagged?("foo")).to be(true)
|
1409
|
-
end
|
1410
|
-
|
1411
|
-
it "should return false from tagged? if node is not tagged" do
|
1412
|
-
expect(resource.tagged?("foo")).to be(false)
|
1413
|
-
end
|
1414
|
-
end
|
1415
|
-
|
1416
|
-
describe "#with_umask" do
|
1417
|
-
let(:resource) { Chef::Resource.new("testy testerson") }
|
1418
|
-
let!(:original_umask) { ::File.umask }
|
1419
|
-
|
1420
|
-
after do
|
1421
|
-
::File.umask(original_umask)
|
1422
|
-
end
|
1423
|
-
|
1424
|
-
it "does not affect the umask by default" do
|
1425
|
-
block_value = nil
|
1426
|
-
|
1427
|
-
resource.with_umask do
|
1428
|
-
block_value = ::File.umask
|
1429
|
-
end
|
1430
|
-
|
1431
|
-
expect(block_value).to eq(original_umask)
|
1432
|
-
end
|
1433
|
-
|
1434
|
-
if windows?
|
1435
|
-
it "is a no-op on Windows" do
|
1436
|
-
resource.umask = "0123"
|
1437
|
-
|
1438
|
-
block_value = nil
|
1439
|
-
|
1440
|
-
resource.with_umask do
|
1441
|
-
block_value = ::File.umask
|
1442
|
-
end
|
1443
|
-
|
1444
|
-
# Format the returned value so a potential error message is easier to understand.
|
1445
|
-
actual_value = block_value.to_s(8).rjust(4, "0")
|
1446
|
-
|
1447
|
-
expect(actual_value).to eq("0000")
|
1448
|
-
end
|
1449
|
-
else
|
1450
|
-
it "changes the umask in the block to the set value" do
|
1451
|
-
resource.umask = "0123"
|
1452
|
-
|
1453
|
-
block_value = nil
|
1454
|
-
|
1455
|
-
resource.with_umask do
|
1456
|
-
block_value = ::File.umask
|
1457
|
-
end
|
1458
|
-
|
1459
|
-
# Format the returned value so a potential error message is easier to understand.
|
1460
|
-
actual_value = block_value.to_s(8).rjust(4, "0")
|
1461
|
-
|
1462
|
-
expect(actual_value).to eq("0123")
|
1463
|
-
end
|
1464
|
-
end
|
1465
|
-
|
1466
|
-
it "resets the umask afterwards" do
|
1467
|
-
resource.umask = "0123"
|
1468
|
-
|
1469
|
-
resource.with_umask do
|
1470
|
-
"noop"
|
1471
|
-
end
|
1472
|
-
|
1473
|
-
expect(::File.umask).to eq(original_umask)
|
1474
|
-
end
|
1475
|
-
|
1476
|
-
it "resets the umask if the block raises an error" do
|
1477
|
-
resource.umask = "0123"
|
1478
|
-
|
1479
|
-
expect { resource.with_umask { 1 / 0 } }.to raise_error(ZeroDivisionError)
|
1480
|
-
|
1481
|
-
expect(::File.umask).to eq(original_umask)
|
1482
|
-
end
|
1483
|
-
end
|
1484
|
-
end
|