microwave 1.0.4 → 11.400.2
Sign up to get free protection for your applications and to get access to all the features.
- 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/README.rdoc
DELETED
@@ -1,177 +0,0 @@
|
|
1
|
-
= Chef
|
2
|
-
|
3
|
-
== DESCRIPTION:
|
4
|
-
|
5
|
-
Chef is a configuration management tool designed to bring automation to your entire infrastructure.
|
6
|
-
|
7
|
-
The Chef Wiki is the definitive source of user documentation.
|
8
|
-
|
9
|
-
* http://wiki.opscode.com/display/chef/Home
|
10
|
-
|
11
|
-
This README focuses on developers who want to modify Chef source code. For users who just want to run the latest and greatest Chef development version in their environment, see:
|
12
|
-
|
13
|
-
* http://wiki.opscode.com/display/chef/Installing+Chef+from+HEAD
|
14
|
-
|
15
|
-
== DEVELOPMENT:
|
16
|
-
|
17
|
-
Before working on the code, if you plan to contribute your changes, you need to read the Opscode Contributing document.
|
18
|
-
|
19
|
-
* http://wiki.opscode.com/display/opscode/Contributing
|
20
|
-
|
21
|
-
You will also need to set up the repository with the appropriate branches. We document the process on the Chef Wiki.
|
22
|
-
|
23
|
-
* http://wiki.opscode.com/display/opscode/Working+with+Git
|
24
|
-
|
25
|
-
Once your repository is set up, you can start working on the code. We do use BDD/TDD with RSpec and Cucumber, so you'll need to get a development environment running.
|
26
|
-
|
27
|
-
== REQUIREMENTS:
|
28
|
-
|
29
|
-
Ruby 1.8.7+ [1]
|
30
|
-
|
31
|
-
[1] As of 2012-05-25 Ruby 1.8.6 should still work, except for CHEF-2329.
|
32
|
-
|
33
|
-
== ENVIRONMENT:
|
34
|
-
|
35
|
-
In order to have a development environment where changes to the Chef code can be tested, we'll need to install a few things after setting up the Git repository.
|
36
|
-
|
37
|
-
=== Non-Gem Dependencies
|
38
|
-
|
39
|
-
Install these via your platform's preferred method; for example apt, yum, ports, emerge, etc.
|
40
|
-
|
41
|
-
* Git[http://git-scm.com/]
|
42
|
-
* Erlang/OTP[http://www.erlang.org/]
|
43
|
-
* CouchDB[http://couchdb.apache.org/]
|
44
|
-
* RabbitMQ[http://www.rabbitmq.com/]
|
45
|
-
* GCC and C Standard Libraries, header files, etc. (i.e., build-essential on debian/ubuntu)
|
46
|
-
* Ruby development package
|
47
|
-
|
48
|
-
=== Runtime Rubygem Dependencies
|
49
|
-
==== Chef Client and Solo
|
50
|
-
* ohai
|
51
|
-
* bunny
|
52
|
-
* erubis
|
53
|
-
* highline
|
54
|
-
* json (1.4.4 - 1.4.6)
|
55
|
-
* mixlib-authentication
|
56
|
-
* mixlib-cli
|
57
|
-
* mixlib-config
|
58
|
-
* mixlib-log
|
59
|
-
* moneta
|
60
|
-
* rest-client
|
61
|
-
* uuidtools
|
62
|
-
* merb-core
|
63
|
-
* net-ssh
|
64
|
-
* fog
|
65
|
-
|
66
|
-
==== Chef Server, WebUI and Solr
|
67
|
-
All of the above, plus the following:
|
68
|
-
* coderay
|
69
|
-
* haml
|
70
|
-
* merb-assets
|
71
|
-
* merb-core
|
72
|
-
* merb-haml
|
73
|
-
* merb-helpers
|
74
|
-
* merb-param-protection
|
75
|
-
* ruby-openid
|
76
|
-
* thin
|
77
|
-
|
78
|
-
=== Development Rubygem Dependencies
|
79
|
-
* rake[http://rake.rubyforge.org/]
|
80
|
-
* rspec[http://rspec.info/]
|
81
|
-
* cucumber[http://cukes.info/]
|
82
|
-
|
83
|
-
Ohai is also by Opscode and available on GitHub, http://github.com/opscode/ohai/tree/master.
|
84
|
-
|
85
|
-
== Starting the Environment:
|
86
|
-
|
87
|
-
=== On Mac OS X:
|
88
|
-
For ease of debugging, Chef includes a script to start each of the required
|
89
|
-
daemons in a separate Terminal.app tab via applescript:
|
90
|
-
|
91
|
-
scripts/mac-dev-start features
|
92
|
-
|
93
|
-
=== On Linux and BSD
|
94
|
-
|
95
|
-
run the dev:features rake task. You may need to run it as root depending on how
|
96
|
-
your system is configured.
|
97
|
-
|
98
|
-
rake dev:features
|
99
|
-
|
100
|
-
=== Daemons
|
101
|
-
After starting the environment, you should have the following processes running:
|
102
|
-
* couchdb listening on port 5984
|
103
|
-
* rabbitmq listening on port 5672
|
104
|
-
* solr listening on port 8983
|
105
|
-
* chef-solr-indexer connected as a client to rabbitmq
|
106
|
-
* chef-server listening on port 4000
|
107
|
-
* chef-server-webui listening on port 4040
|
108
|
-
|
109
|
-
You'll know its running when you see:
|
110
|
-
|
111
|
-
merb : chef-server (api) : worker (port 4000) ~ Starting Thin at port 4000
|
112
|
-
merb : chef-server (api) : worker (port 4000) ~ Using Thin adapter on host 0.0.0.0 and port 4000.
|
113
|
-
merb : chef-server (api) : worker (port 4000) ~ Successfully bound to port 4000
|
114
|
-
|
115
|
-
You'll want to leave this terminal running the dev environment.
|
116
|
-
|
117
|
-
=== Web Interface:
|
118
|
-
|
119
|
-
With the dev environment running, you can now access the web interface via http://localhost:4040/.
|
120
|
-
|
121
|
-
== Spec testing:
|
122
|
-
|
123
|
-
We use RSpec for unit/spec tests. It is not necessary to start the development
|
124
|
-
environment to run the specs--they are completely standalone.
|
125
|
-
|
126
|
-
rake spec
|
127
|
-
|
128
|
-
== Integration testing:
|
129
|
-
|
130
|
-
We test integration with Cucumber. To run the full suite, run the rake task:
|
131
|
-
|
132
|
-
rake features
|
133
|
-
|
134
|
-
Subsets of the integration tests can be run with the various tasks in the
|
135
|
-
features namespace. To see the full list, run
|
136
|
-
|
137
|
-
rake -T
|
138
|
-
|
139
|
-
To run individual feature tests, you can take advantage of cucumber's tagging
|
140
|
-
support. Tag the feature you wish to run (tags are denoted with a leading `@'
|
141
|
-
sign), then use the cucumber command:
|
142
|
-
|
143
|
-
cucumber -t @my_tag
|
144
|
-
|
145
|
-
== LINKS:
|
146
|
-
|
147
|
-
Source:
|
148
|
-
|
149
|
-
* http://github.com/opscode/chef/tree/master
|
150
|
-
|
151
|
-
Tickets/Issues:
|
152
|
-
|
153
|
-
* http://tickets.opscode.com/
|
154
|
-
|
155
|
-
Documentation:
|
156
|
-
|
157
|
-
* http://wiki.opscode.com/display/chef/Home/
|
158
|
-
|
159
|
-
= LICENSE:
|
160
|
-
|
161
|
-
Chef - A configuration management system
|
162
|
-
|
163
|
-
Author:: Adam Jacob (<adam@opscode.com>)
|
164
|
-
Copyright:: Copyright (c) 2008-2012 Opscode, Inc.
|
165
|
-
License:: Apache License, Version 2.0
|
166
|
-
|
167
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
168
|
-
you may not use this file except in compliance with the License.
|
169
|
-
You may obtain a copy of the License at
|
170
|
-
|
171
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
172
|
-
|
173
|
-
Unless required by applicable law or agreed to in writing, software
|
174
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
175
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
176
|
-
See the License for the specific language governing permissions and
|
177
|
-
limitations under the License.
|
@@ -1,76 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Copyright:: Copyright (c) 2009 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
|
-
require 'chef/certificate'
|
22
|
-
require 'ostruct'
|
23
|
-
require 'tempfile'
|
24
|
-
|
25
|
-
class FakeFile
|
26
|
-
attr_accessor :data
|
27
|
-
|
28
|
-
def write(arg)
|
29
|
-
@data = arg
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe Chef::Certificate do
|
34
|
-
describe "generate_signing_ca" do
|
35
|
-
before(:each) do
|
36
|
-
Chef::Config[:signing_ca_user] = nil
|
37
|
-
Chef::Config[:signing_ca_group] = nil
|
38
|
-
FileUtils.stub!(:mkdir_p).and_return(true)
|
39
|
-
FileUtils.stub!(:chown).and_return(true)
|
40
|
-
File.stub!(:open).and_return(true)
|
41
|
-
File.stub!(:exists?).and_return(false)
|
42
|
-
@ca_cert = FakeFile.new
|
43
|
-
@ca_key = FakeFile.new
|
44
|
-
end
|
45
|
-
|
46
|
-
it "should generate a ca certificate" do
|
47
|
-
File.should_receive(:open).with(Chef::Config[:signing_ca_cert], "w").and_yield(@ca_cert)
|
48
|
-
Chef::Certificate.generate_signing_ca
|
49
|
-
@ca_cert.data.should =~ /BEGIN CERTIFICATE/
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should generate an RSA private key" do
|
53
|
-
File.should_receive(:open).with(Chef::Config[:signing_ca_key], File::WRONLY|File::EXCL|File::CREAT, 0600).and_yield(@ca_key)
|
54
|
-
FileUtils.should_not_receive(:chown)
|
55
|
-
Chef::Certificate.generate_signing_ca
|
56
|
-
@ca_key.data.should =~ /BEGIN RSA PRIVATE KEY/
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should generate an RSA private key with user and group" do
|
60
|
-
Chef::Config[:signing_ca_user] = "funky"
|
61
|
-
Chef::Config[:signing_ca_group] = "fresh"
|
62
|
-
File.should_receive(:open).with(Chef::Config[:signing_ca_key], File::WRONLY|File::EXCL|File::CREAT, 0600).and_yield(@ca_key)
|
63
|
-
FileUtils.should_receive(:chown).with(Chef::Config[:signing_ca_user], Chef::Config[:signing_ca_group], Chef::Config[:signing_ca_key])
|
64
|
-
Chef::Certificate.generate_signing_ca
|
65
|
-
@ca_key.data.should =~ /BEGIN RSA PRIVATE KEY/
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe "generate_keypair" do
|
70
|
-
it "should return a client certificate" do
|
71
|
-
public_key, private_key = Chef::Certificate.gen_keypair("oasis")
|
72
|
-
public_key.to_s.should =~ /(BEGIN RSA PUBLIC KEY|BEGIN PUBLIC KEY)/
|
73
|
-
private_key.to_s.should =~ /BEGIN RSA PRIVATE KEY/
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
@@ -1,209 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
# Author:: Daniel DeLeo (<dan@kallistec.com>)
|
4
|
-
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
5
|
-
# Copyright:: Copyright (c) 2009 Daniel DeLeo
|
6
|
-
# License:: Apache License, Version 2.0
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
#
|
20
|
-
|
21
|
-
require 'spec_helper'
|
22
|
-
|
23
|
-
describe Chef::ChecksumCache do
|
24
|
-
before(:each) do
|
25
|
-
Chef::Config[:cache_type] = "Memory"
|
26
|
-
Chef::Config[:cache_options] = { }
|
27
|
-
@cache = Chef::ChecksumCache.instance
|
28
|
-
@cache.reset!
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "loading the moneta backend" do
|
32
|
-
it "should build a Chef::ChecksumCache object" do
|
33
|
-
@cache.should be_a_kind_of(Chef::ChecksumCache)
|
34
|
-
end
|
35
|
-
|
36
|
-
it "should set up a Moneta Cache adaptor" do
|
37
|
-
@cache.moneta.should be_a_kind_of(Moneta::Memory)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should raise an exception if it cannot load the moneta adaptor" do
|
41
|
-
Chef::Log.should_receive(:fatal).with(/^Could not load Moneta back end/)
|
42
|
-
lambda {
|
43
|
-
c = Chef::ChecksumCache.instance.reset!('WTF')
|
44
|
-
}.should raise_error(LoadError)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "when caching checksums of cookbook files and templates" do
|
49
|
-
|
50
|
-
before do
|
51
|
-
@cache.reset!("Memory", {})
|
52
|
-
end
|
53
|
-
|
54
|
-
it "proxies the class method checksum_for_file to the instance" do
|
55
|
-
@cache.should_receive(:checksum_for_file).with("a_file_or_a_fail")
|
56
|
-
Chef::ChecksumCache.checksum_for_file("a_file_or_a_fail")
|
57
|
-
end
|
58
|
-
|
59
|
-
it "returns a cached checksum value" do
|
60
|
-
@cache.moneta["chef-file-riseofthemachines"] = {"mtime" => "12345", "checksum" => "123abc"}
|
61
|
-
fstat = mock("File.stat('riseofthemachines')", :mtime => Time.at(12345))
|
62
|
-
File.should_receive(:stat).with("riseofthemachines").and_return(fstat)
|
63
|
-
@cache.checksum_for_file("riseofthemachines").should == "123abc"
|
64
|
-
end
|
65
|
-
|
66
|
-
it "gives nil for a cache miss" do
|
67
|
-
@cache.moneta["chef-file-riseofthemachines"] = {"mtime" => "12345", "checksum" => "123abc"}
|
68
|
-
fstat = mock("File.stat('riseofthemachines')", :mtime => Time.at(555555))
|
69
|
-
@cache.lookup_checksum("chef-file-riseofthemachines", fstat).should be_nil
|
70
|
-
end
|
71
|
-
|
72
|
-
it "treats a non-matching mtime as a cache miss" do
|
73
|
-
@cache.moneta["chef-file-riseofthemachines"] = {"mtime" => "12345", "checksum" => "123abc"}
|
74
|
-
fstat = mock("File.stat('riseofthemachines')", :mtime => Time.at(555555))
|
75
|
-
@cache.lookup_checksum("chef-file-riseofthemachines", fstat).should be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
it "computes a checksum of a file" do
|
79
|
-
fixture_file = CHEF_SPEC_DATA + "/checksum/random.txt"
|
80
|
-
expected = "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394"
|
81
|
-
@cache.send(:checksum_file, fixture_file, Digest::SHA256.new).should == expected
|
82
|
-
end
|
83
|
-
|
84
|
-
it "computes a checksum and stores it in the cache" do
|
85
|
-
fstat = mock("File.stat('riseofthemachines')", :mtime => Time.at(555555))
|
86
|
-
@cache.should_receive(:checksum_file).with("riseofthemachines", an_instance_of(Digest::SHA256)).and_return("ohai2uChefz")
|
87
|
-
@cache.generate_checksum("chef-file-riseofthemachines", "riseofthemachines", fstat).should == "ohai2uChefz"
|
88
|
-
@cache.lookup_checksum("chef-file-riseofthemachines", fstat).should == "ohai2uChefz"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "returns a generated checksum if there is no cached value" do
|
92
|
-
fixture_file = CHEF_SPEC_DATA + "/checksum/random.txt"
|
93
|
-
expected = "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394"
|
94
|
-
@cache.checksum_for_file(fixture_file).should == expected
|
95
|
-
end
|
96
|
-
|
97
|
-
it "generates a key from a file name" do
|
98
|
-
file = "/this/is/a/test/random.rb"
|
99
|
-
@cache.generate_key(file).should == "chef-file--this-is-a-test-random-rb"
|
100
|
-
end
|
101
|
-
|
102
|
-
it "generates a key from a file name and group" do
|
103
|
-
file = "/this/is/a/test/random.rb"
|
104
|
-
@cache.generate_key(file, "spec").should == "spec-file--this-is-a-test-random-rb"
|
105
|
-
end
|
106
|
-
|
107
|
-
it "returns a cached checksum value using a user defined key" do
|
108
|
-
key = @cache.generate_key("riseofthemachines", "specs")
|
109
|
-
@cache.moneta[key] = {"mtime" => "12345", "checksum" => "123abc"}
|
110
|
-
fstat = mock("File.stat('riseofthemachines')", :mtime => Time.at(12345))
|
111
|
-
File.should_receive(:stat).with("riseofthemachines").and_return(fstat)
|
112
|
-
@cache.checksum_for_file("riseofthemachines", key).should == "123abc"
|
113
|
-
end
|
114
|
-
|
115
|
-
it "generates a checksum from a non-file IO object" do
|
116
|
-
io = StringIO.new("riseofthemachines\nriseofthechefs\n")
|
117
|
-
expected_md5 = '0e157ac1e2dd73191b76067fb6b4bceb'
|
118
|
-
@cache.generate_md5_checksum(io).should == expected_md5
|
119
|
-
end
|
120
|
-
|
121
|
-
end
|
122
|
-
|
123
|
-
describe "when cleaning up after outdated checksums" do
|
124
|
-
|
125
|
-
before do
|
126
|
-
Chef::ChecksumCache.reset_cache_validity
|
127
|
-
end
|
128
|
-
|
129
|
-
it "initially has no valid cached checksums" do
|
130
|
-
Chef::ChecksumCache.valid_cached_checksums.should be_empty
|
131
|
-
end
|
132
|
-
|
133
|
-
it "adds a checksum to the list of valid cached checksums when it's created" do
|
134
|
-
@cache.checksum_for_file(File.join(CHEF_SPEC_DATA, 'checksum', 'random.txt'))
|
135
|
-
Chef::ChecksumCache.valid_cached_checksums.should have(1).valid_checksum
|
136
|
-
end
|
137
|
-
|
138
|
-
it "adds a checksum to the list of valid cached checksums when it's read" do
|
139
|
-
@cache.checksum_for_file(File.join(CHEF_SPEC_DATA, 'checksum', 'random.txt'))
|
140
|
-
Chef::ChecksumCache.reset_cache_validity
|
141
|
-
@cache.checksum_for_file(File.join(CHEF_SPEC_DATA, 'checksum', 'random.txt'))
|
142
|
-
Chef::ChecksumCache.valid_cached_checksums.should have(1).valid_checksum
|
143
|
-
end
|
144
|
-
|
145
|
-
context "with an existing set of cached checksums" do
|
146
|
-
before do
|
147
|
-
Chef::Config[:cache_type] = "BasicFile"
|
148
|
-
Chef::Config[:cache_options] = {:path => File.join(CHEF_SPEC_DATA, "checksum_cache")}
|
149
|
-
|
150
|
-
@expected_cached_checksums = ["chef-file--tmp-chef-rendered-template20100929-10863-600hhz-0",
|
151
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-6m8zdk-0",
|
152
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-ahd2gq-0",
|
153
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-api8ux-0",
|
154
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-b0r1m1-0",
|
155
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-bfygsi-0",
|
156
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-el14l6-0",
|
157
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-ivrl3y-0",
|
158
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-kkbs85-0",
|
159
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-ory1ux-0",
|
160
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-pgsq76-0",
|
161
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-ra8uim-0",
|
162
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-t7k1g-0",
|
163
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-t8g0sv-0",
|
164
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-ufy6g3-0",
|
165
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-x2d6j9-0",
|
166
|
-
"chef-file--tmp-chef-rendered-template20100929-10863-xi0l6h-0"]
|
167
|
-
@expected_cached_checksums.sort!
|
168
|
-
end
|
169
|
-
|
170
|
-
after do
|
171
|
-
Chef::Config[:cache_type] = "Memory"
|
172
|
-
Chef::Config[:cache_options] = { }
|
173
|
-
@cache = Chef::ChecksumCache.instance
|
174
|
-
@cache.reset!
|
175
|
-
end
|
176
|
-
|
177
|
-
it "lists all of the cached checksums in the cache directory" do
|
178
|
-
Chef::ChecksumCache.all_cached_checksums.keys.sort.should == @expected_cached_checksums
|
179
|
-
end
|
180
|
-
|
181
|
-
it "clears all of the checksums not marked valid from the checksums directory" do
|
182
|
-
valid_cksum_key = "chef-file--tmp-chef-rendered-template20100929-10863-ivrl3y-0"
|
183
|
-
valid_cksum_file = File.join(CHEF_SPEC_DATA, "checksum_cache", valid_cksum_key)
|
184
|
-
@expected_cached_checksums.delete(valid_cksum_key)
|
185
|
-
|
186
|
-
Chef::ChecksumCache.valid_cached_checksums << valid_cksum_key
|
187
|
-
|
188
|
-
Chef::ChecksumCache.should_not_receive(:remove_unused_checksum).with(valid_cksum_file)
|
189
|
-
@expected_cached_checksums.each do |cksum_key|
|
190
|
-
full_path_to_cksum = File.join(CHEF_SPEC_DATA, "checksum_cache", cksum_key)
|
191
|
-
Chef::ChecksumCache.should_receive(:remove_unused_checksum).with(full_path_to_cksum)
|
192
|
-
end
|
193
|
-
|
194
|
-
Chef::ChecksumCache.cleanup_checksum_cache
|
195
|
-
end
|
196
|
-
|
197
|
-
it "cleans all 0byte checksum files when it encounters a Marshal error" do
|
198
|
-
@cache.moneta.stub!(:fetch).and_raise(ArgumentError)
|
199
|
-
# This cache file is 0 bytes, raises an argument error when
|
200
|
-
# attempting to Marshal.load
|
201
|
-
File.should_receive(:unlink).with(File.join(CHEF_SPEC_DATA, "checksum_cache", "chef-file--tmp-chef-rendered-template20100929-10863-6m8zdk-0"))
|
202
|
-
@cache.lookup_checksum("chef-file--tmp-chef-rendered-template20100929-10863-6m8zdk-0", "foo")
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
209
|
-
|