microwave 1.0.4 → 11.400.2
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.
- data/CONTRIBUTING.md +155 -0
- data/README.md +89 -0
- data/Rakefile +2 -2
- data/bin/chef-apply +25 -0
- data/bin/chef-shell +34 -0
- data/bin/chef-solo +0 -2
- data/bin/shef +6 -5
- data/lib/chef.rb +2 -4
- data/spec/data/big_json.json +2 -1
- data/spec/data/big_json_plus_one.json +2 -1
- data/spec/data/cookbooks/chefignore +2 -0
- data/spec/data/cookbooks/openldap/attributes/default.rb +10 -9
- data/spec/data/cookbooks/openldap/attributes/smokey.rb +1 -1
- 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/lwrp/providers/inline_compiler.rb +26 -0
- data/spec/data/nodes/default.rb +3 -3
- data/spec/data/nodes/test.example.com.rb +3 -3
- data/spec/data/nodes/test.rb +3 -3
- data/spec/data/partial_one.erb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep1/attributes/default.rb +4 -0
- data/spec/data/run_context/cookbooks/circular-dep1/definitions/circular_dep1_res.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep1/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep1/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep1/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep1/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/circular-dep1/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep2/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/circular-dep2/definitions/circular_dep2_res.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep2/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep2/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/circular-dep2/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/circular-dep2/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/circular-dep2/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/aa_first.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/default.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/attributes/zz_last.rb +3 -0
- data/spec/data/run_context/cookbooks/dependency1/definitions/dependency1_res.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency1/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency1/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency1/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/dependency2/definitions/dependency2_res.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/dependency2/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/dependency2/recipes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/dependency2/resources/resource.rb +1 -0
- data/spec/data/run_context/cookbooks/no-default-attr/attributes/server.rb +3 -0
- data/spec/data/run_context/cookbooks/no-default-attr/definitions/no_default-attr_res.rb +1 -0
- data/spec/data/run_context/cookbooks/no-default-attr/providers/provider.rb +1 -0
- 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 +1 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/definitions/test_with-circular-deps_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/libraries/lib.rb +2 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/metadata.rb +2 -0
- data/spec/data/run_context/cookbooks/test-with-circular-deps/providers/provider.rb +1 -0
- 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 +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/attributes/default.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-deps/definitions/test_with-deps_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/libraries/lib.rb +1 -0
- data/spec/data/run_context/cookbooks/test-with-deps/metadata.rb +3 -0
- data/spec/data/run_context/cookbooks/test-with-deps/providers/provider.rb +1 -0
- 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 +1 -0
- data/spec/data/run_context/cookbooks/test/attributes/default.rb +0 -0
- data/spec/data/run_context/cookbooks/test/attributes/george.rb +1 -1
- data/spec/data/run_context/cookbooks/test/definitions/test_res.rb +1 -0
- data/spec/data/run_context/cookbooks/test/providers/provider.rb +1 -0
- data/spec/data/run_context/cookbooks/test/resources/resource.rb +1 -0
- data/spec/data/shef-config.rb +10 -0
- data/spec/functional/dsl/registry_helper_spec.rb +63 -0
- data/spec/functional/knife/cookbook_delete_spec.rb +0 -2
- data/spec/functional/knife/exec_spec.rb +4 -6
- data/spec/functional/knife/smoke_test.rb +34 -0
- data/spec/functional/knife/ssh_spec.rb +64 -3
- data/spec/functional/resource/cookbook_file_spec.rb +33 -2
- data/spec/functional/resource/deploy_revision_spec.rb +515 -0
- data/spec/functional/resource/directory_spec.rb +4 -0
- data/spec/functional/resource/file_spec.rb +56 -22
- data/spec/functional/resource/link_spec.rb +12 -10
- data/spec/functional/resource/registry_spec.rb +572 -0
- data/spec/functional/resource/remote_directory_spec.rb +142 -36
- data/spec/functional/resource/remote_file_spec.rb +28 -3
- data/spec/functional/resource/template_spec.rb +23 -2
- data/spec/functional/run_lock_spec.rb +238 -0
- data/spec/functional/shell_spec.rb +101 -0
- data/spec/functional/tiny_server_spec.rb +5 -4
- data/spec/functional/win32/registry_helper_spec.rb +632 -0
- data/spec/functional/win32/security_spec.rb +37 -0
- data/spec/spec_helper.rb +15 -3
- data/spec/stress/win32/security_spec.rb +5 -5
- data/spec/support/chef_helpers.rb +14 -3
- data/spec/support/lib/chef/resource/cat.rb +3 -5
- data/spec/support/lib/chef/resource/one_two_three_four.rb +8 -10
- data/spec/support/lib/chef/resource/zen_master.rb +8 -10
- data/spec/support/matchers/leak.rb +1 -1
- data/spec/support/platform_helpers.rb +18 -0
- data/spec/support/shared/functional/directory_resource.rb +85 -23
- data/spec/support/shared/functional/file_resource.rb +198 -53
- data/spec/support/shared/functional/securable_resource.rb +140 -105
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +375 -0
- data/spec/support/shared/unit/file_system_support.rb +110 -0
- data/spec/support/shared/unit/platform_introspector.rb +162 -0
- data/spec/tiny_server.rb +29 -10
- data/spec/unit/api_client/registration_spec.rb +172 -0
- data/spec/unit/api_client_spec.rb +156 -103
- data/spec/unit/application/apply.rb +84 -0
- data/spec/unit/application/knife_spec.rb +5 -0
- data/spec/unit/application_spec.rb +57 -2
- data/spec/unit/chef_fs/diff_spec.rb +329 -0
- data/spec/unit/chef_fs/file_pattern_spec.rb +526 -0
- data/spec/unit/chef_fs/file_system/chef_server_root_dir_spec.rb +237 -0
- data/spec/unit/chef_fs/file_system/cookbooks_dir_spec.rb +568 -0
- data/spec/unit/chef_fs/file_system/data_bags_dir_spec.rb +220 -0
- data/spec/unit/chef_fs/file_system_spec.rb +136 -0
- data/spec/unit/client_spec.rb +188 -16
- data/spec/unit/config_spec.rb +54 -4
- data/spec/unit/cookbook/chefignore_spec.rb +2 -1
- data/spec/unit/cookbook/syntax_check_spec.rb +48 -109
- data/spec/unit/cookbook_loader_spec.rb +153 -91
- data/spec/unit/cookbook_manifest_spec.rb +81 -81
- data/spec/unit/cookbook_spec.rb +3 -20
- data/spec/unit/cookbook_version_spec.rb +23 -122
- data/spec/unit/digester_spec.rb +50 -0
- data/spec/unit/dsl/data_query_spec.rb +66 -0
- data/spec/unit/dsl/platform_introspection_spec.rb +130 -0
- data/spec/unit/dsl/regsitry_helper_spec.rb +55 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +126 -10
- data/spec/unit/environment_spec.rb +0 -130
- data/spec/unit/exceptions_spec.rb +2 -3
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +23 -3
- data/spec/unit/json_compat_spec.rb +69 -0
- data/spec/unit/knife/bootstrap_spec.rb +81 -28
- data/spec/unit/knife/client_reregister_spec.rb +23 -22
- data/spec/unit/knife/configure_spec.rb +29 -26
- data/spec/unit/knife/cookbook_metadata_spec.rb +11 -4
- data/spec/unit/knife/cookbook_site_install_spec.rb +12 -2
- data/spec/unit/knife/cookbook_test_spec.rb +1 -0
- data/spec/unit/knife/cookbook_upload_spec.rb +41 -2
- data/spec/unit/knife/core/bootstrap_context_spec.rb +8 -1
- data/spec/unit/knife/core/ui_spec.rb +156 -7
- data/spec/unit/knife/data_bag_create_spec.rb +14 -0
- data/spec/unit/knife/data_bag_edit_spec.rb +14 -4
- data/spec/unit/knife/data_bag_from_file_spec.rb +17 -5
- data/spec/unit/knife/data_bag_show_spec.rb +11 -4
- data/spec/unit/knife/index_rebuild_spec.rb +96 -33
- data/spec/unit/knife/knife_help.rb +7 -7
- data/spec/unit/knife/node_run_list_remove_spec.rb +2 -1
- data/spec/unit/knife/ssh_spec.rb +121 -15
- data/spec/unit/knife/status_spec.rb +2 -2
- data/spec/unit/knife/user_create_spec.rb +86 -0
- data/spec/unit/knife/user_delete_spec.rb +39 -0
- data/spec/unit/knife/user_edit_spec.rb +42 -0
- data/spec/unit/knife/user_list_spec.rb +32 -0
- data/spec/unit/knife/user_reregister_spec.rb +53 -0
- data/spec/unit/knife/user_show_spec.rb +41 -0
- data/spec/unit/knife_spec.rb +53 -0
- data/spec/unit/lwrp_spec.rb +59 -17
- data/spec/unit/mixin/checksum_spec.rb +2 -2
- data/spec/unit/mixin/deep_merge_spec.rb +56 -491
- data/spec/unit/mixin/deprecation_spec.rb +23 -0
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +6 -1
- data/spec/unit/mixin/params_validate_spec.rb +4 -2
- data/spec/unit/mixin/securable_spec.rb +5 -3
- data/spec/unit/mixin/template_spec.rb +119 -0
- data/spec/unit/node/attribute_spec.rb +272 -137
- data/spec/unit/node/immutable_collections_spec.rb +139 -0
- data/spec/unit/node_spec.rb +411 -339
- data/spec/unit/platform_spec.rb +8 -8
- data/spec/unit/provider/breakpoint_spec.rb +8 -8
- data/spec/unit/provider/cookbook_file_spec.rb +4 -8
- data/spec/unit/provider/deploy/revision_spec.rb +2 -8
- data/spec/unit/provider/deploy_spec.rb +6 -40
- data/spec/unit/provider/directory_spec.rb +103 -68
- data/spec/unit/provider/erl_call_spec.rb +0 -2
- data/spec/unit/provider/file_spec.rb +69 -59
- data/spec/unit/provider/git_spec.rb +0 -10
- data/spec/unit/provider/group/groupadd_spec.rb +1 -1
- data/spec/unit/provider/group/usermod_spec.rb +2 -2
- data/spec/unit/provider/http_request_spec.rb +28 -69
- data/spec/unit/provider/ifconfig_spec.rb +2 -2
- data/spec/unit/provider/link_spec.rb +1 -1
- data/spec/unit/provider/ohai_spec.rb +4 -4
- data/spec/unit/provider/package/apt_spec.rb +0 -1
- data/spec/unit/provider/package/ips_spec.rb +0 -1
- data/spec/unit/provider/package/rubygems_spec.rb +0 -18
- data/spec/unit/provider/package/yum_spec.rb +79 -15
- data/spec/unit/provider/package_spec.rb +7 -5
- data/spec/unit/provider/registry_key_spec.rb +269 -0
- data/spec/unit/provider/remote_directory_spec.rb +24 -7
- data/spec/unit/provider/remote_file_spec.rb +36 -0
- data/spec/unit/provider/route_spec.rb +3 -6
- data/spec/unit/provider/ruby_block_spec.rb +8 -0
- data/spec/unit/provider/service/arch_service_spec.rb +4 -4
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/freebsd_service_spec.rb +4 -4
- data/spec/unit/provider/service/init_service_spec.rb +26 -3
- data/spec/unit/provider/service/insserv_service_spec.rb +1 -1
- data/spec/unit/provider/service/invokercd_service_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +1 -1
- data/spec/unit/provider/service/simple_service_spec.rb +3 -3
- data/spec/unit/provider/service/upstart_service_spec.rb +7 -7
- data/spec/unit/provider/service_spec.rb +2 -2
- data/spec/unit/provider/subversion_spec.rb +1 -1
- data/spec/unit/provider/template_spec.rb +35 -11
- data/spec/unit/provider/user/dscl_spec.rb +57 -31
- data/spec/unit/provider/user_spec.rb +7 -16
- data/spec/unit/provider_spec.rb +4 -3
- data/spec/unit/recipe_spec.rb +10 -8
- data/spec/unit/registry_helper_spec.rb +376 -0
- data/spec/unit/resource/log_spec.rb +9 -0
- data/spec/unit/resource/registry_key_spec.rb +171 -0
- data/spec/unit/resource/remote_file_spec.rb +21 -23
- data/spec/unit/resource/ruby_block_spec.rb +7 -3
- data/spec/unit/resource/service_spec.rb +11 -0
- data/spec/unit/resource_spec.rb +27 -4
- data/spec/unit/rest/auth_credentials_spec.rb +2 -14
- data/spec/unit/rest_spec.rb +122 -187
- data/spec/unit/run_context/cookbook_compiler_spec.rb +181 -0
- data/spec/unit/run_context_spec.rb +18 -4
- data/spec/unit/run_list_spec.rb +0 -209
- data/spec/unit/run_lock_spec.rb +37 -0
- data/spec/unit/runner_spec.rb +101 -2
- data/spec/unit/scan_access_control_spec.rb +4 -4
- data/spec/unit/{shef → shell}/model_wrapper_spec.rb +5 -5
- data/spec/unit/{shef/shef_ext_spec.rb → shell/shell_ext_spec.rb} +21 -21
- data/spec/unit/{shef/shef_session_spec.rb → shell/shell_session_spec.rb} +12 -12
- data/spec/unit/shell_out_spec.rb +18 -0
- data/spec/unit/{shef_spec.rb → shell_spec.rb} +20 -20
- data/spec/unit/user_spec.rb +255 -0
- metadata +162 -157
- data/README.rdoc +0 -177
- data/spec/unit/certificate_spec.rb +0 -76
- data/spec/unit/checksum_cache_spec.rb +0 -209
- data/spec/unit/checksum_spec.rb +0 -94
- data/spec/unit/couchdb_spec.rb +0 -274
- data/spec/unit/index_queue_spec.rb +0 -391
- data/spec/unit/json_compat_spect.rb +0 -53
- data/spec/unit/mixin/language_spec.rb +0 -305
- data/spec/unit/openid_registration_spec.rb +0 -153
- data/spec/unit/solr_query/query_transform_spec.rb +0 -454
- data/spec/unit/solr_query/solr_http_request_spec.rb +0 -244
- data/spec/unit/solr_query_spec.rb +0 -203
- data/spec/unit/webui_user_spec.rb +0 -238
data/spec/data/nodes/default.rb
CHANGED
@@ -6,10 +6,10 @@ name "test.example.com-default"
|
|
6
6
|
##
|
7
7
|
# Nodes can set arbitrary arguments
|
8
8
|
##
|
9
|
-
sunshine "in"
|
10
|
-
something "else"
|
9
|
+
default[:sunshine] = "in"
|
10
|
+
default[:something] = "else"
|
11
11
|
|
12
12
|
##
|
13
13
|
# Nodes should have recipes
|
14
14
|
##
|
15
|
-
|
15
|
+
run_list "operations-master", "operations-monitoring"
|
@@ -6,12 +6,12 @@ name "test.example.com"
|
|
6
6
|
##
|
7
7
|
# Nodes can set arbitrary arguments
|
8
8
|
##
|
9
|
-
sunshine "in"
|
10
|
-
something "else"
|
9
|
+
normal[:sunshine] = "in"
|
10
|
+
normal[:something] = "else"
|
11
11
|
|
12
12
|
##
|
13
13
|
# Nodes should have recipes
|
14
14
|
##
|
15
|
-
|
15
|
+
run_list "operations-master", "operations-monitoring"
|
16
16
|
|
17
17
|
chef_environment "dev"
|
data/spec/data/nodes/test.rb
CHANGED
@@ -6,10 +6,10 @@ name "test.example.com-short"
|
|
6
6
|
##
|
7
7
|
# Nodes can set arbitrary arguments
|
8
8
|
##
|
9
|
-
sunshine "in"
|
10
|
-
something "else"
|
9
|
+
default[:sunshine] = "in"
|
10
|
+
default[:something] = "else"
|
11
11
|
|
12
12
|
##
|
13
13
|
# Nodes should have recipes
|
14
14
|
##
|
15
|
-
|
15
|
+
run_list "operations-master", "operations-monitoring"
|
@@ -0,0 +1 @@
|
|
1
|
+
partial one <%= render 'test.erb', :cookbook => 'openldap' %> calling home
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep1-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep1-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep1-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep2-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep2-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('circular-dep2-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency1-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency1-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency1-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency2-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency2-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('dependency2-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('no-default-attr-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('no-default-attr-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('no-default-attr-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-circular-deps-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-circular-deps-provider')
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-circular-deps-resource')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-deps-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record("test-with-deps")
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-deps-provider')
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-with-deps-resource')
|
File without changes
|
@@ -1 +1 @@
|
|
1
|
-
george "washington"
|
1
|
+
default[:george] = "washington"
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-definition')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-provider')
|
@@ -0,0 +1 @@
|
|
1
|
+
LibraryLoadOrder.record('test-resource')
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners'
|
2
|
+
Ohai::Config[:disabled_plugins] << "virtualization" << "darwin::virtualization"
|
3
|
+
Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java'
|
4
|
+
Ohai::Config[:disabled_plugins] << "linux::block_device" << "linux::kernel" << "linux::ssh_host_key" << "linux::virtualization"
|
5
|
+
Ohai::Config[:disabled_plugins] << "linux::cpu" << "linux::memory" << "ec2" << "rackspace" << "eucalyptus" << "ip_scopes"
|
6
|
+
Ohai::Config[:disabled_plugins] << "solaris2::cpu" << "solaris2::dmi" << "solaris2::filesystem" << "solaris2::kernel"
|
7
|
+
Ohai::Config[:disabled_plugins] << "solaris2::virtualization" << "solaris2::zpools"
|
8
|
+
Ohai::Config[:disabled_plugins] << 'c' << 'php' << 'mono' << 'groovy' << 'lua' << 'erlang'
|
9
|
+
Ohai::Config[:disabled_plugins] << "kernel" << "linux::filesystem" << "ruby"
|
10
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Prajakta Purohit (<prajakta@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2011 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/dsl/registry_helper"
|
20
|
+
require "spec_helper"
|
21
|
+
|
22
|
+
describe Chef::Resource::RegistryKey, :windows_only do
|
23
|
+
|
24
|
+
before (:all) do
|
25
|
+
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root"
|
26
|
+
::Win32::Registry::HKEY_CURRENT_USER.create "Software\\Root\\Branch"
|
27
|
+
::Win32::Registry::HKEY_CURRENT_USER.open('Software\\Root', Win32::Registry::KEY_ALL_ACCESS) do |reg|
|
28
|
+
reg['RootType1', Win32::Registry::REG_SZ] = 'fibrous'
|
29
|
+
reg.write('Roots', Win32::Registry::REG_MULTI_SZ, ["strong roots", "healthy tree"])
|
30
|
+
end
|
31
|
+
|
32
|
+
events = Chef::EventDispatch::Dispatcher.new
|
33
|
+
node = Chef::Node.new
|
34
|
+
ohai = Ohai::System.new
|
35
|
+
ohai.all_plugins
|
36
|
+
node.consume_external_attrs(ohai.data,{})
|
37
|
+
run_context = Chef::RunContext.new(node, {}, events)
|
38
|
+
@resource = Chef::Resource.new("foo", run_context)
|
39
|
+
end
|
40
|
+
|
41
|
+
context "tests registry dsl" do
|
42
|
+
it "returns true if registry_key_exists" do
|
43
|
+
@resource.registry_key_exists?("HKCU\\Software\\Root").should == true
|
44
|
+
end
|
45
|
+
it "returns true if registry has specified value" do
|
46
|
+
values = @resource.registry_get_values("HKCU\\Software\\Root")
|
47
|
+
values.include?({:name=>"RootType1",:type=>:string,:data=>"fibrous"}).should == true
|
48
|
+
end
|
49
|
+
it "returns true if specified registry_has_subkey" do
|
50
|
+
@resource.registry_has_subkeys?("HKCU\\Software\\Root").should == true
|
51
|
+
end
|
52
|
+
it "returns true if specified key has specified subkey" do
|
53
|
+
subkeys = @resource.registry_get_subkeys("HKCU\\Software\\Root")
|
54
|
+
subkeys.include?("Branch").should == true
|
55
|
+
end
|
56
|
+
it "returns true if registry_value_exists" do
|
57
|
+
@resource.registry_value_exists?("HKCU\\Software\\Root", {:name=>"RootType1", :type=>:string, :data=>"fibrous"}).should == true
|
58
|
+
end
|
59
|
+
it "returns true if data_value_exists" do
|
60
|
+
@resource.registry_data_exists?("HKCU\\Software\\Root", {:name=>"RootType1", :type=>:string, :data=>"fibrous"}).should == true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -6,9 +6,9 @@
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
7
|
# you may not use this file except in compliance with the License.
|
8
8
|
# You may obtain a copy of the License at
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# Unless required by applicable law or agreed to in writing, software
|
13
13
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
14
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -23,8 +23,6 @@ describe Chef::Knife::Exec do
|
|
23
23
|
before(:all) do
|
24
24
|
@original_config = Chef::Config.hash_dup
|
25
25
|
|
26
|
-
Thin::Logging.silent = false
|
27
|
-
|
28
26
|
@server = TinyServer::Manager.new#(:debug => true)
|
29
27
|
@server.start
|
30
28
|
end
|
@@ -46,9 +44,9 @@ describe Chef::Knife::Exec do
|
|
46
44
|
@server.stop
|
47
45
|
end
|
48
46
|
|
49
|
-
pending "executes a script in the context of the
|
47
|
+
pending "executes a script in the context of the chef-shell main context", :ruby_18_only
|
50
48
|
|
51
|
-
it "executes a script in the context of the
|
49
|
+
it "executes a script in the context of the chef-shell main context", :ruby_19_only do
|
52
50
|
@node = Chef::Node.new
|
53
51
|
@node.name("ohai-world")
|
54
52
|
response = {"rows" => [@node],"start" => 0,"total" => 1}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Daniel DeLeo (<dan@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2010 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'spec_helper'
|
20
|
+
|
21
|
+
describe "knife smoke tests" do
|
22
|
+
|
23
|
+
# Since our specs load all code, there could be a case where knife does not
|
24
|
+
# run correctly b/c of a missing require, but is not caught by other tests.
|
25
|
+
#
|
26
|
+
# We run `knife -v` to verify that knife at least loads all its code.
|
27
|
+
it "can run and print its version" do
|
28
|
+
knife_path = File.expand_path("../../bin/knife", CHEF_SPEC_DATA)
|
29
|
+
knife_cmd = Mixlib::ShellOut.new("#{knife_path} -v")
|
30
|
+
knife_cmd.run_command
|
31
|
+
knife_cmd.error!
|
32
|
+
knife_cmd.stdout.should include(Chef::VERSION)
|
33
|
+
end
|
34
|
+
end
|
@@ -23,14 +23,15 @@ describe Chef::Knife::Ssh do
|
|
23
23
|
|
24
24
|
before(:all) do
|
25
25
|
@original_config = Chef::Config.hash_dup
|
26
|
+
@original_knife_config = Chef::Config[:knife].dup
|
26
27
|
Chef::Knife::Ssh.load_deps
|
27
|
-
Thin::Logging.silent = true
|
28
28
|
@server = TinyServer::Manager.new
|
29
29
|
@server.start
|
30
30
|
end
|
31
31
|
|
32
32
|
after(:all) do
|
33
33
|
Chef::Config.configuration = @original_config
|
34
|
+
Chef::Config[:knife] = @original_knife_config
|
34
35
|
@server.stop
|
35
36
|
end
|
36
37
|
|
@@ -90,6 +91,19 @@ describe Chef::Knife::Ssh do
|
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
94
|
+
describe "port" do
|
95
|
+
context "when -p 31337 is provided" do
|
96
|
+
before do
|
97
|
+
setup_knife(['-p 31337', '*:*', 'uptime'])
|
98
|
+
end
|
99
|
+
|
100
|
+
it "uses the ssh_port" do
|
101
|
+
@knife.run
|
102
|
+
@knife.config[:ssh_port].should == "31337"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
93
107
|
describe "user" do
|
94
108
|
context "when knife[:ssh_user] is set" do
|
95
109
|
before do
|
@@ -141,7 +155,7 @@ describe Chef::Knife::Ssh do
|
|
141
155
|
|
142
156
|
it "uses the default" do
|
143
157
|
@knife.run
|
144
|
-
@knife.config[:ssh_user].should ==
|
158
|
+
@knife.config[:ssh_user].should == "root"
|
145
159
|
end
|
146
160
|
end
|
147
161
|
end
|
@@ -193,9 +207,56 @@ describe Chef::Knife::Ssh do
|
|
193
207
|
end
|
194
208
|
end
|
195
209
|
|
210
|
+
describe "gateway" do
|
211
|
+
context "when knife[:ssh_gateway] is set" do
|
212
|
+
before do
|
213
|
+
setup_knife(['*:*', 'uptime'])
|
214
|
+
Chef::Config[:knife][:ssh_gateway] = "user@ec2.public_hostname"
|
215
|
+
end
|
216
|
+
|
217
|
+
it "uses the ssh_gateway" do
|
218
|
+
@knife.session.should_receive(:via).with("ec2.public_hostname", "user", {})
|
219
|
+
@knife.run
|
220
|
+
@knife.config[:ssh_gateway].should == "user@ec2.public_hostname"
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context "when -G user@ec2.public_hostname is provided" do
|
225
|
+
before do
|
226
|
+
setup_knife(['-G user@ec2.public_hostname', '*:*', 'uptime'])
|
227
|
+
Chef::Config[:knife][:ssh_gateway] = nil
|
228
|
+
end
|
229
|
+
|
230
|
+
it "uses the ssh_gateway" do
|
231
|
+
@knife.session.should_receive(:via).with("ec2.public_hostname", "user", {})
|
232
|
+
@knife.run
|
233
|
+
@knife.config[:ssh_gateway].should == "user@ec2.public_hostname"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
context "when the gateway requires a password" do
|
238
|
+
before do
|
239
|
+
setup_knife(['-G user@ec2.public_hostname', '*:*', 'uptime'])
|
240
|
+
Chef::Config[:knife][:ssh_gateway] = nil
|
241
|
+
@knife.session.stub(:via) do |host, user, options|
|
242
|
+
raise Net::SSH::AuthenticationFailed unless options[:password]
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should prompt the user for a password" do
|
247
|
+
@knife.ui.should_receive(:ask).with("Enter the password for user@ec2.public_hostname: ").and_return("password")
|
248
|
+
@knife.run
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
196
253
|
def setup_knife(params=[])
|
197
254
|
@knife = Chef::Knife::Ssh.new(params)
|
198
|
-
|
255
|
+
# We explicitly avoid running #configure_chef, which would read a knife.rb
|
256
|
+
# if available, but #merge_configs (which is called by #configure_chef) is
|
257
|
+
# necessary to have default options merged in.
|
258
|
+
@knife.merge_configs
|
259
|
+
@knife.stub!(:ssh_command).and_return { 0 }
|
199
260
|
@api = TinyServer::API.instance
|
200
261
|
@api.clear
|
201
262
|
|