From 9bb4f151766d43b73a16cc14408f96c3555a2bf4 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Thu, 16 Oct 2014 06:36:38 +0530 Subject: knife node run_list remove issue #2186 fixes "knife node run_list remove" issue #2186 --- lib/chef/knife/node_run_list_remove.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb index 8519fd590a..2052ee6f1a 100644 --- a/lib/chef/knife/node_run_list_remove.rb +++ b/lib/chef/knife/node_run_list_remove.rb @@ -1,3 +1,6 @@ + + + # # Author:: Adam Jacob () # Copyright:: Copyright (c) 2009 Opscode, Inc. @@ -31,7 +34,16 @@ class Chef def run node = Chef::Node.load(@name_args[0]) - entries = @name_args[1].split(',') + + if @name_args.size > 2 + # Check for nested lists and create a single plain one + entries = @name_args[1..-1].map do |entry| + entry.split(',').map { |e| e.strip } + end.flatten + else + # Convert to array and remove the extra spaces + entries = @name_args[1].split(',').map { |e| e.strip } + end entries.each { |e| node.run_list.remove(e) } @@ -45,4 +57,3 @@ class Chef end end end - -- cgit v1.2.1 From bff30048892806916535f0877b50dcadf53ab774 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Thu, 16 Oct 2014 06:37:44 +0530 Subject: remove extra spaces --- lib/chef/knife/node_run_list_remove.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb index 2052ee6f1a..1a9555e2c1 100644 --- a/lib/chef/knife/node_run_list_remove.rb +++ b/lib/chef/knife/node_run_list_remove.rb @@ -1,6 +1,3 @@ - - - # # Author:: Adam Jacob () # Copyright:: Copyright (c) 2009 Opscode, Inc. -- cgit v1.2.1 From f760df982c37793fca33d9f0cd78f7c1d34b1ea4 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Sat, 18 Oct 2014 09:54:16 +0530 Subject: Updated banner --- lib/chef/knife/node_run_list_remove.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef/knife/node_run_list_remove.rb b/lib/chef/knife/node_run_list_remove.rb index 1a9555e2c1..4b8953a264 100644 --- a/lib/chef/knife/node_run_list_remove.rb +++ b/lib/chef/knife/node_run_list_remove.rb @@ -27,7 +27,7 @@ class Chef require 'chef/json_compat' end - banner "knife node run_list remove [NODE] [ENTRIES] (options)" + banner "knife node run_list remove [NODE] [ENTRY[,ENTRY]] (options)" def run node = Chef::Node.load(@name_args[0]) -- cgit v1.2.1 From 298040c6038065dc9d10d00af8766394c2b466c7 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Sat, 18 Oct 2014 10:08:45 +0530 Subject: added tests --- spec/unit/knife/node_run_list_remove_spec.rb | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb index 5a008a3e07..744c24596a 100644 --- a/spec/unit/knife/node_run_list_remove_spec.rb +++ b/spec/unit/knife/node_run_list_remove_spec.rb @@ -66,9 +66,24 @@ describe Chef::Knife::NodeRunListRemove do @node.run_list.should_not include('role[monkey]') @node.run_list.should_not include('recipe[duck::type]') end + + it "should remove the items from the run list when name args contains whitespace" do + @node.run_list << 'role[monkey]' + @node.run_list << 'recipe[duck::type]' + @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]' ] + @knife.run + @node.run_list.should_not include('role[monkey]') + @node.run_list.should_not include('recipe[duck::type]') + end + + it "should remove the items from the run list when name args contains multiple run lists" do + @node.run_list << 'role[monkey]' + @node.run_list << 'recipe[duck::type]' + @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]', 'role[blah]' ] + @knife.run + @node.run_list.should_not include('role[monkey]') + @node.run_list.should_not include('recipe[duck::type]') + end end end end - - - -- cgit v1.2.1 From 980cd1a4bc58d9cda786db35d86d8901dda52079 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Tue, 4 Nov 2014 06:23:46 +0530 Subject: swapped lines --- spec/unit/knife/node_run_list_remove_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb index 744c24596a..50b8248e46 100644 --- a/spec/unit/knife/node_run_list_remove_spec.rb +++ b/spec/unit/knife/node_run_list_remove_spec.rb @@ -77,8 +77,8 @@ describe Chef::Knife::NodeRunListRemove do end it "should remove the items from the run list when name args contains multiple run lists" do - @node.run_list << 'role[monkey]' - @node.run_list << 'recipe[duck::type]' + @node.run_list << 'role[blah]' + @node.run_list << 'recipe[duck::type' @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]', 'role[blah]' ] @knife.run @node.run_list.should_not include('role[monkey]') -- cgit v1.2.1 From 47dbeac97bcb57c0eb90a18992faa44272936db5 Mon Sep 17 00:00:00 2001 From: Anshul Sharma Date: Tue, 4 Nov 2014 10:18:34 +0530 Subject: Update node_run_list_remove_spec.rb --- spec/unit/knife/node_run_list_remove_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb index 50b8248e46..7c0627f091 100644 --- a/spec/unit/knife/node_run_list_remove_spec.rb +++ b/spec/unit/knife/node_run_list_remove_spec.rb @@ -78,7 +78,7 @@ describe Chef::Knife::NodeRunListRemove do it "should remove the items from the run list when name args contains multiple run lists" do @node.run_list << 'role[blah]' - @node.run_list << 'recipe[duck::type' + @node.run_list << 'recipe[duck::type]' @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]', 'role[blah]' ] @knife.run @node.run_list.should_not include('role[monkey]') -- cgit v1.2.1 From 5d999cc13d08eb0e3688466d6fafd7ea6623817c Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Sat, 8 Nov 2014 13:43:28 -0800 Subject: Fix some minor typos --- DOC_CHANGES.md | 4 ++-- README.md | 2 +- RELEASE_NOTES.md | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DOC_CHANGES.md b/DOC_CHANGES.md index 7eb85eb894..22294a3e39 100644 --- a/DOC_CHANGES.md +++ b/DOC_CHANGES.md @@ -165,7 +165,7 @@ and receive # snip other Ubuntu nodes ] ``` -If instead you wanted all the languages data (remember, `"languages"` is only one tiny piece of information the Chef Server stores about your node), you would have `:filter_result => {"languages" => ["laguages"]}` in your search query. +If instead you wanted all the languages data (remember, `"languages"` is only one tiny piece of information the Chef Server stores about your node), you would have `:filter_result => {"languages" => ["languages"]}` in your search query. For backwards compatibility, a `partial_search` method has been added to `Chef::Search::Query` which can be used in the same way as the `partial_search` method from the [partial_search cookbook](https://supermarket.getchef.com/cookbooks/partial_search). Note that this method has been deprecated and will be removed in future versions of Chef. @@ -539,7 +539,7 @@ For the`batch` resource, the `guard_interpreter` attribute it is set to `:batch` that if a string is supplied to an `only_if` or `not_if` attribute of a `batch` resource, the 64-bit version of the Windows default command interpreter, `cmd.exe`, will be used to evaluate the guard. It also means that other features available to the guard when `guard_interpreter` is set to something other than `:default`, such as inheritance of attributes and the specification of -process architectur of the guard process (i.e. 32-bit or 64-bit process) are available by default. +process architecture of the guard process (i.e. 32-bit or 64-bit process) are available by default. In versions of Chef prior to Chef 12, the value of the attribute was `:default` by default, which means the 32-bit version of the `cmd.exe` (batch script language) shell would be used to evaluate strings supplied to guards. diff --git a/README.md b/README.md index 306baba163..a0124fe1de 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Install these via your platform's preferred method (apt, yum, ports, emerge, etc.): * git -* C compiler, header files, etc. On Ubuntu/debian, use the +* C compiler, header files, etc. On Ubuntu/Debian, use the `build-essential` package. * ruby 1.9.3 or later * rubygems diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 924f189543..f404f111c7 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -42,12 +42,12 @@ when using `knife.rb`. Once third-party application developers have had sufficient time to adapt to the change, `knife.rb` will become deprecated and config.rb will be preferred. -## Boostrap Changes +## Bootstrap Changes Chef Client 12 introduces a set of changes to `knife bootstrap`. Here is the list of changes: * Unused / untested bootstrap templates that install Chef Client from rubygems are removed. The recommended installation path for Chef Client is to use the omnibus packages. `chef-full` template (which is the default) installs Chef Client using omnibus packages on all the supported platforms. -* `--distro` & `--template-file` options are deprecated in Chef 12 in favor of `--boostrap-template` option. This option can take a boostrap template name (e.g. 'chef-full') or the full path to a bootstrap template. +* `--distro` & `--template-file` options are deprecated in Chef 12 in favor of `--boostrap-template` option. This option can take a bootstrap template name (e.g. 'chef-full') or the full path to a bootstrap template. * Chef now configures `:ssl_verify_mode` & `:verify_api_cert` config options on the node that is being bootstrapped. This setting can be controlled by `:node_ssl_verify_mode` & `:node_verify_api_cert` CLI options. If these are not specified the configured value will be inferred from knife config. ## Solaris Mount Provider @@ -228,7 +228,7 @@ manifest for the cookbook will be deleted from the cookbook file cache. ## When given an override run list Chef does not clean the file_cache -In order to avoid redownloading the file_cache for all the cookbooks and files that are skipped when an +In order to avoid re-downloading the file_cache for all the cookbooks and files that are skipped when an override run list is used, when an override run list is set the file cache is not cleaned at all. ## Dropped Support For Ruby 1.8.7/1.9.1/1.9.2 @@ -278,9 +278,9 @@ Informational messages from knife are now sent to stderr, allowing you to pipe t The `data_bag_item` dsl method can be used to load encrypted data bag items when an additional `secret` String parameter is included. If no `secret` is provided but the data bag item is encrypted, `Chef::Config[:encrypted_data_bag_secret]` will be checked. -## 'group' provider on OSX properly uses 'dscl' to determine existing groups +## 'group' provider on OS X properly uses 'dscl' to determine existing groups -On OSX, the 'group' provider would use 'etc' to determine existing groups, +On OS X, the 'group' provider would use 'etc' to determine existing groups, but 'dscl' to add groups, causing broken idempotency if something existed in /etc/group. The provider now uses 'dscl' for both idempotenty checks and modifications. @@ -398,7 +398,7 @@ process behavior by supplying an architecture attribute to the guard as follows: ```ruby # The not_if will be evaluated with 64-bit cmd.exe by default, -# so you can verride it with the :architecture guard option to +# so you can override it with the :architecture guard option to # make it 32-bit as it is in Chef 11 batch 'make_safe_backup' do code 'copy %USERPROFILE%\\data\\nodes.json %SYSTEMROOT%\\system32\\data\\nodes.bak' -- cgit v1.2.1 From 5c489b2fb6f10e5ba39d804524d754139e0b2dc9 Mon Sep 17 00:00:00 2001 From: Veres Lajos Date: Sat, 8 Nov 2014 09:06:54 +0000 Subject: typo fixes - https://github.com/vlajos/misspell_fixer --- CHANGELOG.md | 2 +- RELEASE_NOTES.md | 2 +- distro/common/html/_static/searchtools.js | 2 +- distro/common/markdown/man1/knife-bootstrap.mkd | 2 +- distro/common/markdown/man1/knife-cookbook-site.mkd | 2 +- distro/common/markdown/man1/knife-data-bag.mkd | 2 +- distro/common/markdown/man1/knife-environment.mkd | 2 +- distro/common/markdown/man1/knife.mkd | 2 +- lib/chef/application.rb | 2 +- lib/chef/application/knife.rb | 2 +- lib/chef/config.rb | 2 +- lib/chef/cookbook/metadata.rb | 6 +++--- lib/chef/dsl/reboot_pending.rb | 2 +- lib/chef/event_dispatch/base.rb | 2 +- lib/chef/knife.rb | 2 +- lib/chef/knife/core/bootstrap_context.rb | 2 +- lib/chef/mixin/command.rb | 2 +- lib/chef/mixin/params_validate.rb | 4 ++-- lib/chef/provider/deploy.rb | 2 +- lib/chef/provider/package/rubygems.rb | 2 +- lib/chef/provider/package/yum-dump.py | 4 ++-- lib/chef/provider/remote_directory.rb | 2 +- lib/chef/provider/service/upstart.rb | 2 +- lib/chef/provider/user/dscl.rb | 2 +- lib/chef/recipe.rb | 2 +- lib/chef/resource_definition.rb | 2 +- lib/chef/util/file_edit.rb | 4 ++-- spec/functional/resource/aixinit_service_spec.rb | 2 +- spec/support/pedant/pedant_config.rb | 4 ++-- spec/support/shared/functional/file_resource.rb | 4 ++-- spec/support/shared/functional/http.rb | 2 +- spec/support/shared/unit/api_error_inspector.rb | 2 +- spec/unit/cookbook/metadata_spec.rb | 2 +- spec/unit/cookbook_version_spec.rb | 12 ++++++------ .../error_inspectors/resource_failure_inspector_spec.rb | 8 ++++---- spec/unit/handler_spec.rb | 2 +- spec/unit/knife_spec.rb | 2 +- spec/unit/lwrp_spec.rb | 2 +- spec/unit/node/immutable_collections_spec.rb | 2 +- spec/unit/resource_definition_spec.rb | 2 +- spec/unit/resource_spec.rb | 2 +- spec/unit/run_list/run_list_expansion_spec.rb | 4 ++-- spec/unit/shell_spec.rb | 2 +- spec/unit/util/dsc/configuration_generator_spec.rb | 2 +- spec/unit/workstation_config_loader_spec.rb | 2 +- 45 files changed, 61 insertions(+), 61 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 855ad7eeed..a16a903e7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -295,7 +295,7 @@ * [**Nikhil Benesch**](https://github.com/benesch): Implemented a threaded download queue for synchronizing cookbooks. (CHEF-4423) * [**Chulki Lee**](https://github.com/chulkilee): - Raise an error when source is accidently passed to apt_package (CHEF-5113) + Raise an error when source is accidentally passed to apt_package (CHEF-5113) * [**Cam Cope**](https://github.com/ccope): Add an open_timeout when opening an http connection (CHEF-5152) * [**Sander van Harmelen**](https://github.com/svanharmelen): diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 924f189543..359a181cd6 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -324,7 +324,7 @@ error when `client_fork false` is set. ## Interval sleep occurs before converge When running chef-client or chef-solo at intervals, the application will perform splay and interval sleep -before converging chef. (In previous releases, splay sleep occurred first, then convergance, then interval sleep). +before converging chef. (In previous releases, splay sleep occurred first, then convergence, then interval sleep). ## `--dry-run` option for knife cookbook site share "knife cookbook site share" command now accepts a new command line option `--dry-run`. When this option is specified, command diff --git a/distro/common/html/_static/searchtools.js b/distro/common/html/_static/searchtools.js index 6e1f06bd1b..fec94539f9 100644 --- a/distro/common/html/_static/searchtools.js +++ b/distro/common/html/_static/searchtools.js @@ -594,7 +594,7 @@ var Search = { * helper function to return a node containing the * search summary for a given text. keywords is a list * of stemmed words, hlwords is the list of normal, unstemmed - * words. the first one is used to find the occurance, the + * words. the first one is used to find the occurrence, the * latter for highlighting it. */ makeSearchSummary : function(text, keywords, hlwords) { diff --git a/distro/common/markdown/man1/knife-bootstrap.mkd b/distro/common/markdown/man1/knife-bootstrap.mkd index 5c5e456023..cb292de311 100644 --- a/distro/common/markdown/man1/knife-bootstrap.mkd +++ b/distro/common/markdown/man1/knife-bootstrap.mkd @@ -84,7 +84,7 @@ When this is complete, the bootstrapped node will have: - Latest Chef version installed from RubyGems or APT Packages from Opscode. This may be a later version than the local system. - Be validated with the configured Chef Server. - - Have run Chef with its default run list if one is specfied. + - Have run Chef with its default run list if one is specified. Additional custom bootstrap templates can be created and stored in `.chef/bootstrap/DISTRO.erb`, replacing __DISTRO__ with the value passed diff --git a/distro/common/markdown/man1/knife-cookbook-site.mkd b/distro/common/markdown/man1/knife-cookbook-site.mkd index 7c2b0fe31b..9496cf1765 100644 --- a/distro/common/markdown/man1/knife-cookbook-site.mkd +++ b/distro/common/markdown/man1/knife-cookbook-site.mkd @@ -26,7 +26,7 @@ repository. Running `knife cookbook site install` does the following: upstream; 2. All existing cookbooks are removed from the branch; 3. The cookbook is downloaded from the cookbook site in tarball form; -4. The downloaded cookbook is untarred, and its contents commited via git; +4. The downloaded cookbook is untarred, and its contents committed via git; 5. The pristine copy branch is merged into the master branch. By installing cookbook with this process, you can locally modify the diff --git a/distro/common/markdown/man1/knife-data-bag.mkd b/distro/common/markdown/man1/knife-data-bag.mkd index 67ec02158c..53abf95272 100644 --- a/distro/common/markdown/man1/knife-data-bag.mkd +++ b/distro/common/markdown/man1/knife-data-bag.mkd @@ -90,7 +90,7 @@ formatted according to the --format option. ## ENCRYPTION SUPPORT Data Bag Items may be encrypted to keep their contents secret. This may -be desireable when storing sensitive information such as database +be desirable when storing sensitive information such as database passwords, API keys, etc. Data Bag Item encryption uses the AES-256 CBC symmetric key algorithm. diff --git a/distro/common/markdown/man1/knife-environment.mkd b/distro/common/markdown/man1/knife-environment.mkd index 2eebffbce6..98ca4997bd 100644 --- a/distro/common/markdown/man1/knife-environment.mkd +++ b/distro/common/markdown/man1/knife-environment.mkd @@ -73,7 +73,7 @@ represented as a single JSON object, like this: {"apache2": ">= 1.5.0"} -In the Ruby format, the cookbook version contraints for an environment +In the Ruby format, the cookbook version constraints for an environment are represented as a Ruby Hash, like this: {"apache2" => ">= 1.5.0"} diff --git a/distro/common/markdown/man1/knife.mkd b/distro/common/markdown/man1/knife.mkd index 61e0c7f8b9..c3add163f9 100644 --- a/distro/common/markdown/man1/knife.mkd +++ b/distro/common/markdown/man1/knife.mkd @@ -174,7 +174,7 @@ recommended though, and git fits with a lot of the workflow paradigms. ## ENVIRONMENT * `EDITOR`: The text editor to use for editing data. The --editor option takes - precedence over this value, and the --disable-editing option supresses + precedence over this value, and the --disable-editing option suppresses data editing entirely. ## SEE ALSO diff --git a/lib/chef/application.rb b/lib/chef/application.rb index a2718e7556..7214afc5be 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -226,7 +226,7 @@ class Chef private def can_fork? # win32-process gem exposes some form of :fork for Process - # class. So we are seperately ensuring that the platform we're + # class. So we are separately ensuring that the platform we're # running on is not windows before forking. Chef::Config[:client_fork] && Process.respond_to?(:fork) && !Chef::Platform.windows? end diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index d3e2f55757..ca5a9c9900 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -64,7 +64,7 @@ class Chef::Application::Knife < Chef::Application :long => "--disable-editing", :description => "Do not open EDITOR, just accept the data as is", :boolean => true, - :defaut => false + :default => false option :help, :short => "-h", diff --git a/lib/chef/config.rb b/lib/chef/config.rb index d3871c38e8..2ff591ced5 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -271,7 +271,7 @@ class Chef # * :fatal # These work as you'd expect. There is also a special `:auto` setting. # When set to :auto, Chef will auto adjust the log verbosity based on - # context. When a tty is available (usually becase the user is running chef + # context. When a tty is available (usually because the user is running chef # in a console), the log level is set to :warn, and output formatters are # used as the primary mode of output. When a tty is not available, the # logger is the primary mode of output, and the log level is set to :info diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 54e930135d..781d3b40b0 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -227,11 +227,11 @@ class Chef ) end - # Sets the current cookbook version, or returns it. Can be two or three digits, seperated + # Sets the current cookbook version, or returns it. Can be two or three digits, separated # by dots. ie: '2.1', '1.5.4' or '0.9'. # # === Parameters - # version:: The curent version, as a string + # version:: The current version, as a string # # === Returns # version:: Returns the current version @@ -246,7 +246,7 @@ class Chef # Sets the name of the cookbook, or returns it. # # === Parameters - # name:: The curent cookbook name. + # name:: The current cookbook name. # # === Returns # name:: Returns the current cookbook name. diff --git a/lib/chef/dsl/reboot_pending.rb b/lib/chef/dsl/reboot_pending.rb index a81debce99..7af67e94a5 100644 --- a/lib/chef/dsl/reboot_pending.rb +++ b/lib/chef/dsl/reboot_pending.rb @@ -47,7 +47,7 @@ class Chef # Vista + Server 2008 and newer may have reboots pending from CBS registry_key_exists?('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootRequired') || - # The mere existance of the UpdateExeVolatile key should indicate a pending restart for certain updates + # The mere existence of the UpdateExeVolatile key should indicate a pending restart for certain updates # http://support.microsoft.com/kb/832475 (registry_key_exists?('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile') && !registry_get_values('HKLM\SOFTWARE\Microsoft\Updates\UpdateExeVolatile').select { |v| v[:name] == "Flags" }[0].nil? && diff --git a/lib/chef/event_dispatch/base.rb b/lib/chef/event_dispatch/base.rb index bfd4503097..50d261cecd 100644 --- a/lib/chef/event_dispatch/base.rb +++ b/lib/chef/event_dispatch/base.rb @@ -193,7 +193,7 @@ class Chef def definition_file_load_failed(path, exception) end - # Called when resource defintions are done loading + # Called when resource definitions are done loading def definition_load_complete end diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 0c079792a4..c000ca4d0a 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -252,7 +252,7 @@ class Chef OFFICIAL_PLUGINS = %w[ec2 rackspace windows openstack terremark bluebox] # :nodoc: - # Error out and print usage. probably becuase the arguments given by the + # Error out and print usage. probably because the arguments given by the # user could not be resolved to a subcommand. def self.subcommand_not_found!(args) ui.fatal("Cannot find sub command for: '#{args.join(' ')}'") diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index e681d7a49b..81e9f0d933 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -23,7 +23,7 @@ class Chef class Knife module Core # Instances of BootstrapContext are the context objects (i.e., +self+) for - # bootstrap templates. For backwards compatability, they +must+ set the + # bootstrap templates. For backwards compatibility, they +must+ set the # following instance variables: # * @config - a hash of knife's config values # * @run_list - the run list for the node to boostrap diff --git a/lib/chef/mixin/command.rb b/lib/chef/mixin/command.rb index c92315e718..d9a9c4f006 100644 --- a/lib/chef/mixin/command.rb +++ b/lib/chef/mixin/command.rb @@ -82,7 +82,7 @@ class Chef end # works same as above, except that it returns stdout and stderr - # requirement => platforms like solaris 9,10 has wierd issues where + # requirement => platforms like solaris 9,10 has weird issues where # even in command failure the exit code is zero, so we need to lookup stderr. def run_command_and_return_stdout_stderr(args={}) command_output = "" diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb index bedc67f357..78d72dc801 100644 --- a/lib/chef/mixin/params_validate.rb +++ b/lib/chef/mixin/params_validate.rb @@ -42,8 +42,8 @@ class Chef # method names. # :required:: Raise an exception if this parameter is missing. Valid values are true or false, # by default, options are not required. - # :regex:: Match the value of the paramater against a regular expression. - # :equal_to:: Match the value of the paramater with ==. An array means it can be equal to any + # :regex:: Match the value of the parameter against a regular expression. + # :equal_to:: Match the value of the parameter with ==. An array means it can be equal to any # of the values. def validate(opts, map) #-- diff --git a/lib/chef/provider/deploy.rb b/lib/chef/provider/deploy.rb index b30f7ed17e..26c677643b 100644 --- a/lib/chef/provider/deploy.rb +++ b/lib/chef/provider/deploy.rb @@ -126,7 +126,7 @@ class Chef # * Move release_path directory before deploy and move it back when error occurs # * Rollback to previous commit # * Do nothing - because deploy is force, it will be retried in short time - # Because last is simpliest, keep it + # Because last is simplest, keep it deploy end diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 3c0ca40693..2ce7420621 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -130,7 +130,7 @@ class Chef ## # Determines the candidate version for a gem from a .gem file on disk - # and checks if it matches the version contraints in +gem_dependency+ + # and checks if it matches the version constraints in +gem_dependency+ # === Returns # Gem::Version a singular gem version object is returned if the gem # is available diff --git a/lib/chef/provider/package/yum-dump.py b/lib/chef/provider/package/yum-dump.py index 8b09dedbf0..c9f6a1fcea 100644 --- a/lib/chef/provider/package/yum-dump.py +++ b/lib/chef/provider/package/yum-dump.py @@ -23,7 +23,7 @@ # and dump the results to stdout. # # yum-dump invokes yum similarly to the command line interface which makes it -# subject to most of the configuration paramaters in yum.conf. yum-dump will +# subject to most of the configuration parameters in yum.conf. yum-dump will # also load yum plugins in the same manor as yum - these can affect the output. # # Can be run as non root, but that won't update the cache. @@ -70,7 +70,7 @@ def setup(yb, options): else: yb.doConfigSetup(errorlevel=0, debuglevel=0) except yum.Errors.ConfigError, e: - # supresses an ignored exception at exit + # suppresses an ignored exception at exit yb.preconf = None print >> sys.stderr, "yum-dump Config Error: %s" % e return 1 diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb index 9a7416e318..eaccce46cf 100644 --- a/lib/chef/provider/remote_directory.rb +++ b/lib/chef/provider/remote_directory.rb @@ -44,7 +44,7 @@ class Chef # Transfer files files_to_transfer.each do |cookbook_file_relative_path| create_cookbook_file(cookbook_file_relative_path) - # parent directories and file being transfered are removed from the purge list + # parent directories and file being transferred are removed from the purge list Pathname.new(Chef::Util::PathHelper.cleanpath(::File.join(@new_resource.path, cookbook_file_relative_path))).descend do |d| files_to_purge.delete(d.to_s) end diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 41bd850d6a..359b8c1579 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -38,7 +38,7 @@ class Chef # In chef, when we ask a service to start, we expect it to have started before performing the next step # since we have top down dependencies. Which is to say we may follow witha resource next that requires # that service to be running. According to [2] we can trust that sending a 'goal' such as start will not - # return until that 'goal' is reached, or some error has occured. + # return until that 'goal' is reached, or some error has occurred. # # [1] http://upstart.ubuntu.com/wiki/JobStates # [2] http://www.netsplit.com/2008/04/27/upstart-05-events/ diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 84f5145c52..39746f0018 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -39,7 +39,7 @@ class Chef # > 10.7 => password shadow calculation format SALTED-SHA512-PBKDF2 # => stored in: /var/db/dslocal/nodes/Default/users/#{name}.plist # => shadow binary length 128 bytes - # => Salt / Iterations are stored seperately in the same file + # => Salt / Iterations are stored separately in the same file # # This provider only supports Mac OSX versions 10.7 and above class Dscl < Chef::Provider::User diff --git a/lib/chef/recipe.rb b/lib/chef/recipe.rb index de72a8d0c4..e54a1d98e3 100644 --- a/lib/chef/recipe.rb +++ b/lib/chef/recipe.rb @@ -82,7 +82,7 @@ class Chef run_context.resource_collection.find(*args) end - # This was moved to Chef::Node#tag, redirecting here for compatability + # This was moved to Chef::Node#tag, redirecting here for compatibility def tag(*tags) run_context.node.tag(*tags) end diff --git a/lib/chef/resource_definition.rb b/lib/chef/resource_definition.rb index 278114e209..9d6844129c 100644 --- a/lib/chef/resource_definition.rb +++ b/lib/chef/resource_definition.rb @@ -54,7 +54,7 @@ class Chef end # When we do the resource definition, we're really just setting new values for - # the paramaters we prototyped at the top. This method missing is as simple as + # the parameters we prototyped at the top. This method missing is as simple as # it gets. def method_missing(symbol, *args) @params[symbol] = args.length == 1 ? args[0] : args diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb index 92cefb4bb4..4d2a9c03eb 100644 --- a/lib/chef/util/file_edit.rb +++ b/lib/chef/util/file_edit.rb @@ -47,7 +47,7 @@ class Chef end #search the file line by line and match each line with the given regex - #if matched, replace the match (all occurances) with the replace parameter + #if matched, replace the match (all occurrences) with the replace parameter def search_file_replace(regex, replace) @changes = (editor.replace(regex, replace) > 0) || @changes end @@ -59,7 +59,7 @@ class Chef end #search the file line by line and match each line with the given regex - #if matched, delete the match (all occurances) from the line + #if matched, delete the match (all occurrences) from the line def search_file_delete(regex) search_file_replace(regex, '') end diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb index 3d3234f0f7..19b65ca2a0 100755 --- a/spec/functional/resource/aixinit_service_spec.rb +++ b/spec/functional/resource/aixinit_service_spec.rb @@ -28,7 +28,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do # Platform specific validation routines. def service_should_be_started(file_name) - # The existance of this file indicates that the service was started. + # The existence of this file indicates that the service was started. expect(File.exists?("/tmp/#{file_name}")).to be_truthy end diff --git a/spec/support/pedant/pedant_config.rb b/spec/support/pedant/pedant_config.rb index f7d14d8f17..3f8219fc59 100644 --- a/spec/support/pedant/pedant_config.rb +++ b/spec/support/pedant/pedant_config.rb @@ -26,7 +26,7 @@ # If you are doing development testing, you can specify the address of # the Solr server. The presence of this parameter will enable tests -# to force commits to Solr, greatly decreasing the amout of time +# to force commits to Solr, greatly decreasing the amount of time # needed for testing the search endpoint. This is only an # optimization for development! If you are testing a "live" Chef # Server, or otherwise do not have access to the Solr server from your @@ -36,7 +36,7 @@ #search_server "http://localhost:8983" # Related to the 'search_server' parameter, this specifies the maximum -# amout of time (in seconds) that search endpoint requests should be +# amount of time (in seconds) that search endpoint requests should be # retried before giving up. If not explicitly set, it will default to # 65 seconds; only set it if you know that your Solr commit interval # differs significantly from this. diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb index bcc2a7da25..4f8e2f5b71 100644 --- a/spec/support/shared/functional/file_resource.rb +++ b/spec/support/shared/functional/file_resource.rb @@ -813,7 +813,7 @@ shared_examples_for "a configured file resource" do # Regression test for http://tickets.opscode.com/browse/CHEF-4082 context "when notification is configured" do - describe "when path is specified with normal seperator" do + describe "when path is specified with normal separator" do before do @notified_resource = Chef::Resource.new("punk", resource.run_context) resource.notifies(:run, @notified_resource, :immediately) @@ -826,7 +826,7 @@ shared_examples_for "a configured file resource" do end end - describe "when path is specified with windows seperator", :windows_only do + describe "when path is specified with windows separator", :windows_only do let(:path) { File.join(test_file_dir, make_tmpname(file_base)).gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR) } diff --git a/spec/support/shared/functional/http.rb b/spec/support/shared/functional/http.rb index 9a3389306d..963fbf1c5b 100644 --- a/spec/support/shared/functional/http.rb +++ b/spec/support/shared/functional/http.rb @@ -131,7 +131,7 @@ module ChefHTTPShared } # - # in the presense of a transfer-encoding header, we must ignore the content-length (this bad content-length should work) + # in the presence of a transfer-encoding header, we must ignore the content-length (this bad content-length should work) # # (expected_content should be uncompressed) diff --git a/spec/support/shared/unit/api_error_inspector.rb b/spec/support/shared/unit/api_error_inspector.rb index e85fa971e9..29faa07f29 100644 --- a/spec/support/shared/unit/api_error_inspector.rb +++ b/spec/support/shared/unit/api_error_inspector.rb @@ -23,7 +23,7 @@ # runs without error, but don't make assertions about the output. This is # because aspects such as how information gets formatted, what's included, etc. # are still in flux. When testing an inspector, change the outputter to use -# STDOUT and manually check the ouput. +# STDOUT and manually check the output. shared_examples_for "an api error inspector" do diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb index a1903a1948..760ae5dd2a 100644 --- a/spec/unit/cookbook/metadata_spec.rb +++ b/spec/unit/cookbook/metadata_spec.rb @@ -441,7 +441,7 @@ describe Chef::Cookbook::Metadata do }.not_to raise_error end - it "should let type be hash (backwards compatability only)" do + it "should let type be hash (backwards compatibility only)" do expect { metadata.attribute("db/mysql/databases", :type => "hash") }.not_to raise_error diff --git a/spec/unit/cookbook_version_spec.rb b/spec/unit/cookbook_version_spec.rb index 3d0348553b..6dd3429ffc 100644 --- a/spec/unit/cookbook_version_spec.rb +++ b/spec/unit/cookbook_version_spec.rb @@ -396,7 +396,7 @@ describe Chef::CookbookVersion do expect(@cookbook_version).to have_template_for_node(@node, ["test.erb"]) end - it "should see a template using an array lookup with non-existant elements" do + it "should see a template using an array lookup with non-existent elements" do expect(@cookbook_version).to have_template_for_node(@node, ["missing.txt", "test.erb"]) end @@ -408,23 +408,23 @@ describe Chef::CookbookVersion do expect(@cookbook_version).to have_cookbook_file_for_node(@node, ["test.txt"]) end - it "should see a file using an array lookup with non-existant elements" do + it "should see a file using an array lookup with non-existent elements" do expect(@cookbook_version).to have_cookbook_file_for_node(@node, ["missing.txt", "test.txt"]) end - it "should not see a non-existant template" do + it "should not see a non-existent template" do expect(@cookbook_version).not_to have_template_for_node(@node, "missing.erb") end - it "should not see a non-existant template using an array lookup" do + it "should not see a non-existent template using an array lookup" do expect(@cookbook_version).not_to have_template_for_node(@node, ["missing.erb"]) end - it "should not see a non-existant file" do + it "should not see a non-existent file" do expect(@cookbook_version).not_to have_cookbook_file_for_node(@node, "missing.txt") end - it "should not see a non-existant file using an array lookup" do + it "should not see a non-existent file using an array lookup" do expect(@cookbook_version).not_to have_cookbook_file_for_node(@node, ["missing.txt"]) end diff --git a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb index ee957ed450..a42d234601 100644 --- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb @@ -114,20 +114,20 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do describe "recipe_snippet" do before do # fake code to run through #recipe_snippet - source_file = [ "if true", "var = non_existant", "end" ] + source_file = [ "if true", "var = non_existent", "end" ] allow(IO).to receive(:readlines).and_return(source_file) allow(File).to receive(:exists?).and_return(true) end it "parses a Windows path" do - source_line = "C:/Users/btm/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existant' for main:Object (NameError)" + source_line = "C:/Users/btm/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)" @resource.source_line = source_line @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) expect(@inspector.recipe_snippet).to match(/^# In C:\/Users\/btm/) end it "parses a unix path" do - source_line = "/home/btm/src/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existant' for main:Object (NameError)" + source_line = "/home/btm/src/chef/chef/spec/unit/fake_file.rb:2: undefined local variable or method `non_existent' for main:Object (NameError)" @resource.source_line = source_line @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) expect(@inspector.recipe_snippet).to match(/^# In \/home\/btm/) @@ -145,7 +145,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do expect(@inspector.recipe_snippet).to be_nil end - it "does not raise an exception trying to load a non-existant file (CHEF-3411)" do + it "does not raise an exception trying to load a non-existent file (CHEF-3411)" do @resource.source_line = "/somewhere/in/space" @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) expect { @inspector.recipe_snippet }.not_to raise_error diff --git a/spec/unit/handler_spec.rb b/spec/unit/handler_spec.rb index a9aa0e0b50..e7f67405fc 100644 --- a/spec/unit/handler_spec.rb +++ b/spec/unit/handler_spec.rb @@ -84,7 +84,7 @@ describe Chef::Handler do end it "has a shortcut for the success? and failed? predicates" do - expect(@handler.success?).to be_falsey # becuase there's an exception + expect(@handler.success?).to be_falsey # because there's an exception expect(@handler.failed?).to be_truthy end diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index d35ba4fa5f..49fa4a85ca 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -64,7 +64,7 @@ describe Chef::Knife do expect(KnifeSpecs::TestNameMapping.subcommand_category).to eq('test') end - it "has an explictly defined category if set" do + it "has an explicitly defined category if set" do expect(KnifeSpecs::TestExplicitCategory.subcommand_category).to eq('cookbook site') end diff --git a/spec/unit/lwrp_spec.rb b/spec/unit/lwrp_spec.rb index 0fb0ea7cab..35963dec64 100644 --- a/spec/unit/lwrp_spec.rb +++ b/spec/unit/lwrp_spec.rb @@ -247,7 +247,7 @@ describe "LWRP" do end end - it "ammends actions when they are already defined" do + it "amends actions when they are already defined" do raise_if_deprecated! expect(child.actions).to eq([:eat, :sleep, :drink]) end diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb index b1e7b9169b..d0ec81c7f7 100644 --- a/spec/unit/node/immutable_collections_spec.rb +++ b/spec/unit/node/immutable_collections_spec.rb @@ -33,7 +33,7 @@ describe Chef::Node::ImmutableMash do expect(@immutable_mash[:top][:second_level]).to eq("some value") end - it "elelment references like a regular Mash" do + it "element references like a regular Mash" do expect(@immutable_mash[:top_level_2]).to eq(%w[array of values]) end diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb index 01e28bf091..1371a8b9a6 100644 --- a/spec/unit/resource_definition_spec.rb +++ b/spec/unit/resource_definition_spec.rb @@ -85,7 +85,7 @@ describe Chef::ResourceDefinition do expect(defn.recipe.call).to eql("I am what I am") end - it "should set paramaters based on method_missing" do + it "should set parameters based on method_missing" do defn.mind "to fly" expect(defn.params[:mind]).to eql("to fly") end diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index bb02d91b23..335956009f 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -324,7 +324,7 @@ describe Chef::Resource do expect(zm.is("one", "two", "three")).to eq(%w|one two three|) end - it "should allow arguments preceeded by is to methods" do + it "should allow arguments preceded by is to methods" do @resource.noop(@resource.is(true)) expect(@resource.noop).to eql(true) end diff --git a/spec/unit/run_list/run_list_expansion_spec.rb b/spec/unit/run_list/run_list_expansion_spec.rb index 927257875e..859219d346 100644 --- a/spec/unit/run_list/run_list_expansion_spec.rb +++ b/spec/unit/run_list/run_list_expansion_spec.rb @@ -97,7 +97,7 @@ describe Chef::RunList::RunListExpansion do expect(@expansion.recipes).to eq(['lobster', 'crabrevenge', 'fist']) end - it "has the merged attributes from the roles with outer roles overridding inner" do + it "has the merged attributes from the roles with outer roles overriding inner" do expect(@expansion.default_attrs).to eq({'foo' => 'bar'}) expect(@expansion.override_attrs).to eq({'baz' => 'qux'}) end @@ -109,7 +109,7 @@ describe Chef::RunList::RunListExpansion do end - describe "after expanding a run list with a non existant role" do + describe "after expanding a run list with a non existent role" do before do allow(@expansion).to receive(:fetch_role) { @expansion.role_not_found('crabrevenge', "role[base]") } @expansion.expand diff --git a/spec/unit/shell_spec.rb b/spec/unit/shell_spec.rb index 58dea4c988..0e028f4359 100644 --- a/spec/unit/shell_spec.rb +++ b/spec/unit/shell_spec.rb @@ -47,7 +47,7 @@ describe Shell do describe "reporting its status" do - it "alway says it is running" do + it "always says it is running" do expect(Shell).to be_running end diff --git a/spec/unit/util/dsc/configuration_generator_spec.rb b/spec/unit/util/dsc/configuration_generator_spec.rb index c39c949991..e75e285d43 100644 --- a/spec/unit/util/dsc/configuration_generator_spec.rb +++ b/spec/unit/util/dsc/configuration_generator_spec.rb @@ -137,7 +137,7 @@ describe Chef::Util::DSC::ConfigurationGenerator do describe "#find_configuration_document" do it "should find the mof file" do - # These tests seem way too implementation specific. Unfortunatly, File and Dir + # These tests seem way too implementation specific. Unfortunately, File and Dir # need to be mocked because they are OS specific allow(File).to receive(:join) do |a, b| [a,b].join("++") diff --git a/spec/unit/workstation_config_loader_spec.rb b/spec/unit/workstation_config_loader_spec.rb index 0f60e3ec38..a865103188 100644 --- a/spec/unit/workstation_config_loader_spec.rb +++ b/spec/unit/workstation_config_loader_spec.rb @@ -219,7 +219,7 @@ describe Chef::WorkstationConfigLoader do end - context "when an explict config is given but it doesn't exist" do + context "when an explicit config is given but it doesn't exist" do let(:explicit_config_location) { "/nope/nope/nope/frab/jab/nab" } -- cgit v1.2.1 From dea11068107381b618936b07c99ec4abe34a87b1 Mon Sep 17 00:00:00 2001 From: Jon Cowie Date: Fri, 14 Nov 2014 10:11:05 +0000 Subject: Adding MAINTAINERS.md file per RFC-030 and proposing myself as maintainer for Core & Enterprise Linux --- MAINTAINERS.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 MAINTAINERS.md diff --git a/MAINTAINERS.md b/MAINTAINERS.md new file mode 100644 index 0000000000..36bdf9d7f4 --- /dev/null +++ b/MAINTAINERS.md @@ -0,0 +1,86 @@ +# Maintainers + +This file lists how the Chef project is maintained. When making changes to the system, this +file tells you who needs to review your patch - you need a simple majority of maintainers +for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need +to not receive a veto from a Lieutenant or the Project Lead. + +Check out [How Chef is Maintained](https://github.com/opscode/chef-rfc/blob/master/rfc030-maintenance-policy.md#how-the-project-is-maintained) for details on the process, how to become +a maintainer, lieutenant, or the project lead. + +# Project Lead + +[Adam Jacob](http://github.com/adamhjk) + +# Components + +## Chef Core + +Handles the core parts of the Chef DSL, base resource and provider +infrastructure, and the Chef applications. Includes anything not covered by +another component. + +### Lieutenant + +### Maintainers + +[Jon Cowie](http://github.com/jonlives) + +## Dev Tools + +Chef Zero, Knife, Chef Apply and Chef Shell. + +### Lieutenant + +### Maintainers + +## Test Tools + +ChefSpec, Berkshelf (the chef bits), Test Kitchen (the Chef bits) + +### Lieutenant + +### Maintainers + +## Platform Specific Components + +The specific components of Chef related to a given platform - including (but not limited to) resources, providers, and the core DSL. + +## Enterprise Linux + +### Lieutenant + +### Maintainers + +[Jon Cowie](http://github.com/jonlives) + +## Ubuntu + +### Lieutenant + +### Maintainers + +## Windows + +### Lieutenant + +### Maintainers + +## Solaris + +### Lieutenant + +### Maintainers + +## AIX + +### Lieutenant + +### Maintainers + +## Mac OS X + +### Lieutenant + +### Maintainers + -- cgit v1.2.1 From 82a6e4a4fd85d13eb445fc57c24ff841c46c6376 Mon Sep 17 00:00:00 2001 From: Jon Cowie Date: Fri, 14 Nov 2014 21:54:00 +0000 Subject: Add @jaymzh as core maintainer --- MAINTAINERS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 36bdf9d7f4..0f6b25aee0 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -26,6 +26,8 @@ another component. [Jon Cowie](http://github.com/jonlives) +[Phil Dibowitz](https://github.com/jaymzh) + ## Dev Tools Chef Zero, Knife, Chef Apply and Chef Shell. -- cgit v1.2.1 From 3cd6b335ff0a39563318ffe79dca1cca22d84b62 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Tue, 18 Nov 2014 15:15:46 -0500 Subject: Revert 7ff6de20561ba20b0a6876c66e1ddd3271a10084 as we don't need it anymore; bug has been fixed plus we don't care about Ruby 1.8.7. --- .travis.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index b2b002d8b7..0d4abd8224 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,3 @@ -# Temporary workaround for issue with rubygems 2.2.0 with bundler 1.5 on ruby -# 1.8.7. -# -# A fix has been merged to rubygems but not yet released. See: -# https://github.com/rubygems/rubygems/commit/f8e0f1d5f67cfc4e1966cc1e2db367aebf8a09e4 -# -# See also CHEF-4916 -# -# This workaround should be removed when that fix is released. -before_install: -- gem update --system 2.1.11 -- gem --version - branches: only: - master -- cgit v1.2.1 From 043613e6dcac669a930e5fd0c2e2ae0a3c91bcd6 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Tue, 18 Nov 2014 17:09:59 -0500 Subject: Put back "gem update --system" --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0d4abd8224..2ce7238619 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ +# Early warning system to catch if Rubygems breaks something +before_install: + gem update --system + branches: only: - master -- cgit v1.2.1 From 924d75fd5b79b03e623cc657c5bef73e96f94465 Mon Sep 17 00:00:00 2001 From: lucywyman Date: Wed, 19 Nov 2014 13:38:29 -0800 Subject: Setting version to an empty string in tests Check for nil and length on version in package/rubygems tests In gemspec test change @new_resource.instance_variable_set() to @new_resource.version() --- lib/chef/provider/package/rubygems.rb | 2 +- spec/unit/provider/package/rubygems_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 6304a7ef63..dd731adee4 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -536,7 +536,7 @@ class Chef else src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org" end - if version + if !version.nil? && version.length > 0 shell_out!("#{gem_binary_path} install #{name} -q --no-rdoc --no-ri -v \"#{version}\"#{src}#{opts}", :env=>nil) else shell_out!("#{gem_binary_path} install \"#{name}\" -q --no-rdoc --no-ri #{src}#{opts}", :env=>nil) diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb index a3a4772229..b4960b2af3 100644 --- a/spec/unit/provider/package/rubygems_spec.rb +++ b/spec/unit/provider/package/rubygems_spec.rb @@ -536,6 +536,14 @@ describe Chef::Provider::Package::Rubygems do expect(@provider.action_install).to be_truthy end + it "installs the gem by shelling out when options are provided but no version is given" do + @new_resource.options('-i /alt/install/location') + @new_resource.version('') + expected ="gem install \"rspec-core\" -q --no-rdoc --no-ri -i /alt/install/location" + expect(@provider).to receive(:shell_out!).with(expected, :env => nil) + expect(@provider.action_install).to be_truthy + end + it "installs the gem via the gems api when options are given as a Hash" do @new_resource.options(:install_dir => '/alt/install/location') expect(@provider.gem_env).to receive(:install).with(@gem_dep, :sources => nil, :install_dir => '/alt/install/location') -- cgit v1.2.1 From 2245bb63b946b985f7c76a38368348c7fcde1bd2 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 11:48:54 -0800 Subject: add partial deep merge cache --- lib/chef/node.rb | 23 ++++++++-------- lib/chef/node/attribute.rb | 49 +++++++++++++++++++++++++++++++++- lib/chef/node/attribute_collections.rb | 5 ++++ 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/lib/chef/node.rb b/lib/chef/node.rb index dbb7852586..6055f0e1e9 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -127,6 +127,7 @@ class Chef # Set a normal attribute of this node, but auto-vivify any Mashes that # might be missing def normal + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.normal end @@ -136,14 +137,17 @@ class Chef # Set a normal attribute of this node, auto-vivifying any mashes that are # missing, but if the final value already exists, don't set it def normal_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.normal end + alias_method :set_unless, :normal_unless # Set a default of this node, but auto-vivify any Mashes that might # be missing def default + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.default end @@ -151,6 +155,7 @@ class Chef # Set a default attribute of this node, auto-vivifying any mashes that are # missing, but if the final value already exists, don't set it def default_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.default end @@ -158,6 +163,7 @@ class Chef # Set an override attribute of this node, but auto-vivify any Mashes that # might be missing def override + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.override end @@ -165,35 +171,30 @@ class Chef # Set an override attribute of this node, auto-vivifying any mashes that # are missing, but if the final value already exists, don't set it def override_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.override end - def override_attrs - attributes.override - end + alias :override_attrs :override + alias :default_attrs :default + alias :normal_attrs :normal def override_attrs=(new_values) attributes.override = new_values end - def default_attrs - attributes.default - end - def default_attrs=(new_values) attributes.default = new_values end - def normal_attrs - attributes.normal - end - def normal_attrs=(new_values) attributes.normal = new_values end def automatic_attrs + attributes.top_level_breadcrumb = nil + attributes.set_unless_value_present = false attributes.automatic end diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 6130925aea..c780650aac 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -175,6 +175,13 @@ class Chef # return the automatic level attribute component attr_reader :automatic + # this is used to track the top level key as we descend through method chaining into + # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here) + attr_accessor :top_level_breadcrumb + + # cache of deep merged values by top-level key + attr_accessor :deep_merge_cache + def initialize(normal, default, override, automatic) @set_unless_present = false @@ -195,6 +202,8 @@ class Chef @merged_attributes = nil @combined_override = nil @combined_default = nil + @top_level_breadcrumb = nil + @deep_merge_cache = {} end # Debug what's going on with an attribute. +args+ is a path spec to the @@ -230,51 +239,71 @@ class Chef @set_unless_present = setting end + def reset_cache(path = nil) + if path.nil? + @deep_merge_cache = {} + else + deep_merge_cache.delete(path) + end + end + + alias :reset :reset_cache + # Set the cookbook level default attribute component to +new_data+. def default=(new_data) + reset @default = VividMash.new(self, new_data) end # Set the role level default attribute component to +new_data+ def role_default=(new_data) + reset @role_default = VividMash.new(self, new_data) end # Set the environment level default attribute component to +new_data+ def env_default=(new_data) + reset @env_default = VividMash.new(self, new_data) end # Set the force_default (+default!+) level attributes to +new_data+ def force_default=(new_data) + reset @force_default = VividMash.new(self, new_data) end # Set the normal level attribute component to +new_data+ def normal=(new_data) + reset @normal = VividMash.new(self, new_data) end # Set the cookbook level override attribute component to +new_data+ def override=(new_data) + reset @override = VividMash.new(self, new_data) end # Set the role level override attribute component to +new_data+ def role_override=(new_data) + reset @role_override = VividMash.new(self, new_data) end # Set the environment level override attribute component to +new_data+ def env_override=(new_data) + reset @env_override = VividMash.new(self, new_data) end def force_override=(new_data) + reset @force_override = VividMash.new(self, new_data) end def automatic=(new_data) + reset @automatic = VividMash.new(self, new_data) end @@ -284,6 +313,7 @@ class Chef # clears attributes from all precedence levels def rm(*args) + reset(args[0]) # just easier to compute our retval, rather than collect+merge sub-retvals ret = args.inject(merged_attributes) do |attr, arg| if attr.nil? || !attr.respond_to?(:[]) @@ -314,6 +344,7 @@ class Chef # # equivalent to: force_default!['foo']['bar'].delete('baz') def rm_default(*args) + reset(args[0]) remove_from_precedence_level(force_default!(autovivify: false), *args) end @@ -321,6 +352,7 @@ class Chef # # equivalent to: normal!['foo']['bar'].delete('baz') def rm_normal(*args) + reset(args[0]) remove_from_precedence_level(normal!(autovivify: false), *args) end @@ -328,6 +360,7 @@ class Chef # # equivalent to: force_override!['foo']['bar'].delete('baz') def rm_override(*args) + reset(args[0]) remove_from_precedence_level(force_override!(autovivify: false), *args) end @@ -337,26 +370,36 @@ class Chef # sets default attributes without merging def default!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @default, [], opts) end # sets normal attributes without merging def normal!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @normal, [], opts) end # sets override attributes without merging def override!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @override, [], opts) end # clears from all default precedence levels and then sets force_default def force_default!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @force_default, [@default, @env_default, @role_default], opts) end # clears from all override precedence levels and then sets force_override def force_override!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @force_override, [@override, @env_override, @role_override], opts) end @@ -377,7 +420,11 @@ class Chef end def [](key) - merged_attributes(key) + if deep_merge_cache.has_key?(key) + deep_merge_cache[key] + else + deep_merge_cache[key] = merged_attributes(key) + end end def []=(key, value) diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb index 3b19a14d1c..333f4864c6 100644 --- a/lib/chef/node/attribute_collections.rb +++ b/lib/chef/node/attribute_collections.rb @@ -63,6 +63,7 @@ class Chef MUTATOR_METHODS.each do |mutator| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator}(*args, &block) + root.reset_cache(root.top_level_breadcrumb) super end METHOD_DEFN @@ -127,6 +128,7 @@ class Chef MUTATOR_METHODS.each do |mutator| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator}(*args, &block) + root.reset_cache(root.top_level_breadcrumb) super end METHOD_DEFN @@ -138,6 +140,7 @@ class Chef end def [](key) + root.top_level_breadcrumb ||= key value = super if !key?(key) value = self.class.new(root) @@ -148,9 +151,11 @@ class Chef end def []=(key, value) + root.top_level_breadcrumb ||= key if set_unless? && key?(key) self[key] else + root.reset_cache(root.top_level_breadcrumb) super end end -- cgit v1.2.1 From b5d398a8530daa8a42be6616a09b37b5c4ad4bd1 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 12:53:13 -0800 Subject: add more commentary --- lib/chef/node/attribute.rb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index c780650aac..03e199781f 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -175,11 +175,17 @@ class Chef # return the automatic level attribute component attr_reader :automatic - # this is used to track the top level key as we descend through method chaining into - # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here) + # This is used to track the top level key as we descend through method chaining into + # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here). We + # need this so that when we hit the end of a method chain which results in a mutator method + # that we can invalidate the whole top-level deep merge cache for the top-level key. It is + # the responsibility of the accessor on the Chef::Node object to reset this to nil, and then + # the first VividMash#[] call can ||= and set this to the first key we encounter. attr_accessor :top_level_breadcrumb - # cache of deep merged values by top-level key + # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the + # top-level keys of the node object, and we save the computed deep-merge for that key here. There is + # no cache of subtrees. attr_accessor :deep_merge_cache def initialize(normal, default, override, automatic) @@ -239,6 +245,10 @@ class Chef @set_unless_present = setting end + # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate + # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']= + # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call + # must invalidate the entire cache and re-deep-merge the entire node object. def reset_cache(path = nil) if path.nil? @deep_merge_cache = {} @@ -404,7 +414,11 @@ class Chef end # - # Accessing merged attributes + # Accessing merged attributes. + # + # Note that merged_attributes('foo', 'bar', 'baz') can be called to compute only the + # deep merge of node['foo']['bar']['baz'], but in practice we currently always compute + # all of node['foo'] even if the user only requires node['foo']['bar']['baz']. # def merged_attributes(*path) @@ -421,8 +435,10 @@ class Chef def [](key) if deep_merge_cache.has_key?(key) + # return the cache of the deep merged values by top-level key deep_merge_cache[key] else + # save all the work of computing node[key] deep_merge_cache[key] = merged_attributes(key) end end -- cgit v1.2.1 From 5c86c554f1a08cdc39abcacbb43107c597b6d14a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 19:07:52 -0800 Subject: adding some more specs around to_hash --- spec/unit/node/attribute_spec.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 39e40a465f..c924ee2811 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -486,6 +486,34 @@ describe Chef::Node::Attribute do expect(hash.class).to eq(Hash) expect(hash["day"]).to eq("sunday") end + + it "should create a deep copy of the node attribute" do + @attributes.default['foo']['bar']['baz'] = 'fizz' + hash = @attributes['foo'].to_hash + expect(hash).to eql({"bar"=>{"baz"=>"fizz"}}) + hash['bar']['baz'] = 'buzz' + expect(hash).to eql({"bar"=>{"baz"=>"buzz"}}) + expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}}) + end + + it "should create a deep copy of arrays in the node attribute" do + @attributes.default['foo']['bar'] = ['fizz'] + hash = @attributes['foo'].to_hash + expect(hash).to eql({"bar"=>[ 'fizz' ]}) + hash['bar'].push('buzz') + expect(hash).to eql({"bar"=>[ 'fizz', 'buzz' ]}) + expect(@attributes.default['foo']).to eql({"bar"=>[ 'fizz' ]}) + end + + it "mutating strings should not mutate the attributes" do + pending "this is a bug that should be fixed" + @attributes.default['foo']['bar']['baz'] = 'fizz' + hash = @attributes['foo'].to_hash + expect(hash).to eql({"bar"=>{"baz"=>"fizz"}}) + hash['bar']['baz'] << 'buzz' + expect(hash).to eql({"bar"=>{"baz"=>"fizzbuzz"}}) + expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}}) + end end describe "dup" do -- cgit v1.2.1 From 097d5eb1bf4b3cbcc9bfc937c5e3441dee5c9f5c Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 11:48:54 -0800 Subject: add partial deep merge cache --- lib/chef/node.rb | 23 ++++++++-------- lib/chef/node/attribute.rb | 49 +++++++++++++++++++++++++++++++++- lib/chef/node/attribute_collections.rb | 5 ++++ 3 files changed, 65 insertions(+), 12 deletions(-) diff --git a/lib/chef/node.rb b/lib/chef/node.rb index dbb7852586..6055f0e1e9 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -127,6 +127,7 @@ class Chef # Set a normal attribute of this node, but auto-vivify any Mashes that # might be missing def normal + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.normal end @@ -136,14 +137,17 @@ class Chef # Set a normal attribute of this node, auto-vivifying any mashes that are # missing, but if the final value already exists, don't set it def normal_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.normal end + alias_method :set_unless, :normal_unless # Set a default of this node, but auto-vivify any Mashes that might # be missing def default + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.default end @@ -151,6 +155,7 @@ class Chef # Set a default attribute of this node, auto-vivifying any mashes that are # missing, but if the final value already exists, don't set it def default_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.default end @@ -158,6 +163,7 @@ class Chef # Set an override attribute of this node, but auto-vivify any Mashes that # might be missing def override + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = false attributes.override end @@ -165,35 +171,30 @@ class Chef # Set an override attribute of this node, auto-vivifying any mashes that # are missing, but if the final value already exists, don't set it def override_unless + attributes.top_level_breadcrumb = nil attributes.set_unless_value_present = true attributes.override end - def override_attrs - attributes.override - end + alias :override_attrs :override + alias :default_attrs :default + alias :normal_attrs :normal def override_attrs=(new_values) attributes.override = new_values end - def default_attrs - attributes.default - end - def default_attrs=(new_values) attributes.default = new_values end - def normal_attrs - attributes.normal - end - def normal_attrs=(new_values) attributes.normal = new_values end def automatic_attrs + attributes.top_level_breadcrumb = nil + attributes.set_unless_value_present = false attributes.automatic end diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 6130925aea..c780650aac 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -175,6 +175,13 @@ class Chef # return the automatic level attribute component attr_reader :automatic + # this is used to track the top level key as we descend through method chaining into + # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here) + attr_accessor :top_level_breadcrumb + + # cache of deep merged values by top-level key + attr_accessor :deep_merge_cache + def initialize(normal, default, override, automatic) @set_unless_present = false @@ -195,6 +202,8 @@ class Chef @merged_attributes = nil @combined_override = nil @combined_default = nil + @top_level_breadcrumb = nil + @deep_merge_cache = {} end # Debug what's going on with an attribute. +args+ is a path spec to the @@ -230,51 +239,71 @@ class Chef @set_unless_present = setting end + def reset_cache(path = nil) + if path.nil? + @deep_merge_cache = {} + else + deep_merge_cache.delete(path) + end + end + + alias :reset :reset_cache + # Set the cookbook level default attribute component to +new_data+. def default=(new_data) + reset @default = VividMash.new(self, new_data) end # Set the role level default attribute component to +new_data+ def role_default=(new_data) + reset @role_default = VividMash.new(self, new_data) end # Set the environment level default attribute component to +new_data+ def env_default=(new_data) + reset @env_default = VividMash.new(self, new_data) end # Set the force_default (+default!+) level attributes to +new_data+ def force_default=(new_data) + reset @force_default = VividMash.new(self, new_data) end # Set the normal level attribute component to +new_data+ def normal=(new_data) + reset @normal = VividMash.new(self, new_data) end # Set the cookbook level override attribute component to +new_data+ def override=(new_data) + reset @override = VividMash.new(self, new_data) end # Set the role level override attribute component to +new_data+ def role_override=(new_data) + reset @role_override = VividMash.new(self, new_data) end # Set the environment level override attribute component to +new_data+ def env_override=(new_data) + reset @env_override = VividMash.new(self, new_data) end def force_override=(new_data) + reset @force_override = VividMash.new(self, new_data) end def automatic=(new_data) + reset @automatic = VividMash.new(self, new_data) end @@ -284,6 +313,7 @@ class Chef # clears attributes from all precedence levels def rm(*args) + reset(args[0]) # just easier to compute our retval, rather than collect+merge sub-retvals ret = args.inject(merged_attributes) do |attr, arg| if attr.nil? || !attr.respond_to?(:[]) @@ -314,6 +344,7 @@ class Chef # # equivalent to: force_default!['foo']['bar'].delete('baz') def rm_default(*args) + reset(args[0]) remove_from_precedence_level(force_default!(autovivify: false), *args) end @@ -321,6 +352,7 @@ class Chef # # equivalent to: normal!['foo']['bar'].delete('baz') def rm_normal(*args) + reset(args[0]) remove_from_precedence_level(normal!(autovivify: false), *args) end @@ -328,6 +360,7 @@ class Chef # # equivalent to: force_override!['foo']['bar'].delete('baz') def rm_override(*args) + reset(args[0]) remove_from_precedence_level(force_override!(autovivify: false), *args) end @@ -337,26 +370,36 @@ class Chef # sets default attributes without merging def default!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @default, [], opts) end # sets normal attributes without merging def normal!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @normal, [], opts) end # sets override attributes without merging def override!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @override, [], opts) end # clears from all default precedence levels and then sets force_default def force_default!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @force_default, [@default, @env_default, @role_default], opts) end # clears from all override precedence levels and then sets force_override def force_override!(opts={}) + # FIXME: do not flush whole cache + reset MultiMash.new(self, @force_override, [@override, @env_override, @role_override], opts) end @@ -377,7 +420,11 @@ class Chef end def [](key) - merged_attributes(key) + if deep_merge_cache.has_key?(key) + deep_merge_cache[key] + else + deep_merge_cache[key] = merged_attributes(key) + end end def []=(key, value) diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb index 3b19a14d1c..333f4864c6 100644 --- a/lib/chef/node/attribute_collections.rb +++ b/lib/chef/node/attribute_collections.rb @@ -63,6 +63,7 @@ class Chef MUTATOR_METHODS.each do |mutator| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator}(*args, &block) + root.reset_cache(root.top_level_breadcrumb) super end METHOD_DEFN @@ -127,6 +128,7 @@ class Chef MUTATOR_METHODS.each do |mutator| class_eval(<<-METHOD_DEFN, __FILE__, __LINE__) def #{mutator}(*args, &block) + root.reset_cache(root.top_level_breadcrumb) super end METHOD_DEFN @@ -138,6 +140,7 @@ class Chef end def [](key) + root.top_level_breadcrumb ||= key value = super if !key?(key) value = self.class.new(root) @@ -148,9 +151,11 @@ class Chef end def []=(key, value) + root.top_level_breadcrumb ||= key if set_unless? && key?(key) self[key] else + root.reset_cache(root.top_level_breadcrumb) super end end -- cgit v1.2.1 From f7585fccb289549c0cc1b123030b994cd474b802 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 12:53:13 -0800 Subject: add more commentary --- lib/chef/node/attribute.rb | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index c780650aac..03e199781f 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -175,11 +175,17 @@ class Chef # return the automatic level attribute component attr_reader :automatic - # this is used to track the top level key as we descend through method chaining into - # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here) + # This is used to track the top level key as we descend through method chaining into + # a precedence level (e.g. node.default['foo']['bar']['baz']= results in 'foo' here). We + # need this so that when we hit the end of a method chain which results in a mutator method + # that we can invalidate the whole top-level deep merge cache for the top-level key. It is + # the responsibility of the accessor on the Chef::Node object to reset this to nil, and then + # the first VividMash#[] call can ||= and set this to the first key we encounter. attr_accessor :top_level_breadcrumb - # cache of deep merged values by top-level key + # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the + # top-level keys of the node object, and we save the computed deep-merge for that key here. There is + # no cache of subtrees. attr_accessor :deep_merge_cache def initialize(normal, default, override, automatic) @@ -239,6 +245,10 @@ class Chef @set_unless_present = setting end + # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate + # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']= + # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call + # must invalidate the entire cache and re-deep-merge the entire node object. def reset_cache(path = nil) if path.nil? @deep_merge_cache = {} @@ -404,7 +414,11 @@ class Chef end # - # Accessing merged attributes + # Accessing merged attributes. + # + # Note that merged_attributes('foo', 'bar', 'baz') can be called to compute only the + # deep merge of node['foo']['bar']['baz'], but in practice we currently always compute + # all of node['foo'] even if the user only requires node['foo']['bar']['baz']. # def merged_attributes(*path) @@ -421,8 +435,10 @@ class Chef def [](key) if deep_merge_cache.has_key?(key) + # return the cache of the deep merged values by top-level key deep_merge_cache[key] else + # save all the work of computing node[key] deep_merge_cache[key] = merged_attributes(key) end end -- cgit v1.2.1 From bd85e888c4c9b4d38b3a88f89b5995619e654ed0 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 17:07:05 -0800 Subject: remove old knockout merge exception chef 11 has raised an exception on this for nearly 2 years, we now simply no longer care and don't spend the cycles to check. --- lib/chef/mixin/deep_merge.rb | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index a8a4737758..58b6f18b07 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -29,15 +29,6 @@ class Chef class InvalidSubtractiveMerge < ArgumentError; end - - OLD_KNOCKOUT_PREFIX = "!merge:".freeze - - # Regex to match the "knockout prefix" that was used to indicate - # subtractive merging in Chef 10.x and previous. Subtractive merging is - # removed as of Chef 11, but we detect attempted use of it and raise an - # error (see: raise_if_knockout_used!) - OLD_KNOCKOUT_MATCH = %r[!merge].freeze - extend self def merge(first, second) @@ -78,8 +69,6 @@ class Chef dest = source; return dest end - raise_if_knockout_used!(source) - raise_if_knockout_used!(dest) case source when nil dest @@ -89,7 +78,6 @@ class Chef if dest[src_key] dest[src_key] = deep_merge!(src_value, dest[src_key]) else # dest[src_key] doesn't exist so we take whatever source has - raise_if_knockout_used!(src_value) dest[src_key] = src_value end end @@ -146,27 +134,6 @@ class Chef end end - # Checks for attempted use of subtractive merge, which was removed for - # Chef 11.0. If subtractive merge use is detected, will raise an - # InvalidSubtractiveMerge exception. - def raise_if_knockout_used!(obj) - if uses_knockout?(obj) - raise InvalidSubtractiveMerge, "subtractive merge with !merge is no longer supported" - end - end - - # Checks for attempted use of subtractive merge in +obj+. - def uses_knockout?(obj) - case obj - when String - obj =~ OLD_KNOCKOUT_MATCH - when Array - obj.any? {|element| element.respond_to?(:gsub) && element =~ OLD_KNOCKOUT_MATCH } - else - false - end - end - def deep_merge(source, dest) deep_merge!(safe_dup(source), safe_dup(dest)) end -- cgit v1.2.1 From eff333bfae96c3ce7de1e93b2199425778b3dced Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 17:16:07 -0800 Subject: provider resolver perf improvement move the sorting of the providers to after we make the first cut, still keeps deterministic ordering, but avoids sorting providers we are just going to throw away. --- lib/chef/provider_resolver.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chef/provider_resolver.rb b/lib/chef/provider_resolver.rb index 247102f191..d83a3e0468 100644 --- a/lib/chef/provider_resolver.rb +++ b/lib/chef/provider_resolver.rb @@ -34,7 +34,7 @@ class Chef # return a deterministically sorted list of Chef::Provider subclasses def providers - @providers ||= Chef::Provider.descendants.sort {|a,b| a.to_s <=> b.to_s } + @providers ||= Chef::Provider.descendants end def resolve @@ -48,7 +48,7 @@ class Chef @enabled_handlers ||= providers.select do |klass| klass.provides?(node, resource) - end + end.sort {|a,b| a.to_s <=> b.to_s } end # this cut looks at if the provider can handle the specific resource and action -- cgit v1.2.1 From 0507c08bc75bde24c3e4f32878a2d0ab6b2db591 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 20 Nov 2014 17:47:56 -0800 Subject: remove invalid invalidsubtractivemerge specs --- spec/unit/mixin/deep_merge_spec.rb | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/spec/unit/mixin/deep_merge_spec.rb b/spec/unit/mixin/deep_merge_spec.rb index 779445e04e..d107323f32 100644 --- a/spec/unit/mixin/deep_merge_spec.rb +++ b/spec/unit/mixin/deep_merge_spec.rb @@ -290,32 +290,6 @@ describe Chef::Mixin::DeepMerge do end - describe "role_merge" do - it "errors out if knockout merge use is detected in an array" do - hash_dst = {"property" => ["2","4"]} - hash_src = {"property" => ["1","!merge:4"]} - expect {@dm.role_merge(hash_dst, hash_src)}.to raise_error(Chef::Mixin::DeepMerge::InvalidSubtractiveMerge) - end - - it "errors out if knockout merge use is detected in an array (reversed merge order)" do - hash_dst = {"property" => ["1","!merge:4"]} - hash_src = {"property" => ["2","4"]} - expect {@dm.role_merge(hash_dst, hash_src)}.to raise_error(Chef::Mixin::DeepMerge::InvalidSubtractiveMerge) - end - - it "errors out if knockout merge use is detected in a string" do - hash_dst = {"property" => ["2","4"]} - hash_src = {"property" => "!merge"} - expect {@dm.role_merge(hash_dst, hash_src)}.to raise_error(Chef::Mixin::DeepMerge::InvalidSubtractiveMerge) - end - - it "errors out if knockout merge use is detected in a string (reversed merge order)" do - hash_dst = {"property" => "!merge"} - hash_src= {"property" => ["2","4"]} - expect {@dm.role_merge(hash_dst, hash_src)}.to raise_error(Chef::Mixin::DeepMerge::InvalidSubtractiveMerge) - end - end - describe "hash-only merging" do it "merges Hashes like normal deep merge" do merge_ee_hash = {"top_level_a" => {"1_deep_a" => "1-a-merge-ee", "1_deep_b" => "1-deep-b-merge-ee"}, "top_level_b" => "top-level-b-merge-ee"} -- cgit v1.2.1 From a2776adb489a952e728f08ed80cebf5be493c0bf Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 21 Nov 2014 15:07:30 -0800 Subject: remove InvalidSubtractiveMerge class --- lib/chef/mixin/deep_merge.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index 58b6f18b07..c19f2a1a7d 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -27,8 +27,6 @@ class Chef # http://trac.misuse.org/science/wiki/DeepMerge module DeepMerge - class InvalidSubtractiveMerge < ArgumentError; end - extend self def merge(first, second) -- cgit v1.2.1 From 3ac12a699f5d0eb92ef791f1dd2350d50ac0c009 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 21 Nov 2014 15:10:29 -0800 Subject: role_merge can be elmianted now --- lib/chef/mixin/deep_merge.rb | 9 --------- lib/chef/run_list/run_list_expansion.rb | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index c19f2a1a7d..3d4690bb57 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -36,15 +36,6 @@ class Chef DeepMerge.deep_merge(second, first) end - # Inherited roles use the knockout_prefix array subtraction functionality - # This is likely to go away in Chef >= 0.11 - def role_merge(first, second) - first = Mash.new(first) unless first.kind_of?(Mash) - second = Mash.new(second) unless second.kind_of?(Mash) - - DeepMerge.deep_merge(second, first) - end - class InvalidParameter < StandardError; end # Deep Merge core documentation. diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb index 73665f39e7..fed50ee232 100644 --- a/lib/chef/run_list/run_list_expansion.rb +++ b/lib/chef/run_list/run_list_expansion.rb @@ -96,8 +96,8 @@ class Chef end def apply_role_attributes(role) - @default_attrs = Chef::Mixin::DeepMerge.role_merge(@default_attrs, role.default_attributes) - @override_attrs = Chef::Mixin::DeepMerge.role_merge(@override_attrs, role.override_attributes) + @default_attrs = Chef::Mixin::DeepMerge.deep_merge(@default_attrs, role.default_attributes) + @override_attrs = Chef::Mixin::DeepMerge.deep_merge(@override_attrs, role.override_attributes) end def applied_role?(role_name) -- cgit v1.2.1 From 37ef51f8bfbb2c53ba1e7b3899112d0ba673635f Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 21 Nov 2014 15:13:28 -0800 Subject: #role_merge becomes #merge not #deep_merge --- lib/chef/run_list/run_list_expansion.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb index fed50ee232..eed3110afc 100644 --- a/lib/chef/run_list/run_list_expansion.rb +++ b/lib/chef/run_list/run_list_expansion.rb @@ -96,8 +96,8 @@ class Chef end def apply_role_attributes(role) - @default_attrs = Chef::Mixin::DeepMerge.deep_merge(@default_attrs, role.default_attributes) - @override_attrs = Chef::Mixin::DeepMerge.deep_merge(@override_attrs, role.override_attributes) + @default_attrs = Chef::Mixin::DeepMerge.merge(@default_attrs, role.default_attributes) + @override_attrs = Chef::Mixin::DeepMerge.merge(@override_attrs, role.override_attributes) end def applied_role?(role_name) @@ -188,4 +188,3 @@ class Chef end end -end -- cgit v1.2.1 From 3f4d86705c2b72da257fcbdc782c18c3b96b3205 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 21 Nov 2014 15:35:01 -0800 Subject: deleted the last end accidentally --- lib/chef/node/attribute.rb | 6 ++++-- lib/chef/run_list/run_list_expansion.rb | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 03e199781f..6c41e230ee 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -422,7 +422,9 @@ class Chef # def merged_attributes(*path) - immutablize(merge_all(path)) + # immutablize( + merge_all(path) + # ) end def combined_override(*path) @@ -543,7 +545,7 @@ class Chef safe_dup(component) end - components.inject(nil) do |merged, component| + components.inject(ImmutableMash.new) do |merged, component| Chef::Mixin::DeepMerge.hash_only_merge!(merged, component) end end diff --git a/lib/chef/run_list/run_list_expansion.rb b/lib/chef/run_list/run_list_expansion.rb index eed3110afc..46b45f1d9e 100644 --- a/lib/chef/run_list/run_list_expansion.rb +++ b/lib/chef/run_list/run_list_expansion.rb @@ -188,3 +188,4 @@ class Chef end end +end -- cgit v1.2.1 From 68dd5f42273f19bc5975c0dc8ed46ee592764eec Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Fri, 21 Nov 2014 18:03:32 -0800 Subject: WIP: immutabilizing deep merge --- lib/chef/mixin/deep_merge.rb | 18 +++++++++++++----- lib/chef/node/attribute.rb | 4 +++- lib/chef/node/immutable_collections.rb | 4 ++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index 3d4690bb57..825406a93e 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -105,11 +105,19 @@ class Chef # If there are two Hashes, recursively merge. if merge_onto.kind_of?(Hash) && merge_with.kind_of?(Hash) merge_with.each do |key, merge_with_value| - merge_onto[key] = if merge_onto.has_key?(key) - hash_only_merge(merge_onto[key], merge_with_value) - else - merge_with_value - end + value = + if merge_onto.has_key?(key) + hash_only_merge(merge_onto[key], merge_with_value) + else + merge_with_value + end + + if merge_onto.respond_to?(:public_method_that_only_deep_merge_should_use) + # we can't call ImmutableMash#[]= because its immutable, but we need to mutate it to build it in-place + merge_onto.public_method_that_only_deep_merge_should_use(key, value) + else + merge_onto[key] = value + end end merge_onto diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 6c41e230ee..3c48f653eb 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -545,7 +545,9 @@ class Chef safe_dup(component) end - components.inject(ImmutableMash.new) do |merged, component| + return nil if components.compact.empty? + + components.inject(ImmutableMash.new({})) do |merged, component| Chef::Mixin::DeepMerge.hash_only_merge!(merged, component) end end diff --git a/lib/chef/node/immutable_collections.rb b/lib/chef/node/immutable_collections.rb index af04ef26d4..56b8fed3b7 100644 --- a/lib/chef/node/immutable_collections.rb +++ b/lib/chef/node/immutable_collections.rb @@ -155,6 +155,10 @@ class Chef end end + def public_method_that_only_deep_merge_should_use(key, value) + internal_set(key, immutablize(value)) + end + alias :attribute? :has_key? # Redefine all of the methods that mutate a Hash to raise an error when called. -- cgit v1.2.1 From 659b4101d2ab1a227b5da34bd285a4c449e01eb7 Mon Sep 17 00:00:00 2001 From: Yulian Kuncheff Date: Mon, 17 Nov 2014 16:16:40 -0800 Subject: Fix installer_version_string to be an array on prerelease parameter. --- lib/chef/knife/core/bootstrap_context.rb | 2 +- spec/unit/knife/core/bootstrap_context_spec.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb index e681d7a49b..ce062bdd25 100644 --- a/lib/chef/knife/core/bootstrap_context.rb +++ b/lib/chef/knife/core/bootstrap_context.rb @@ -135,7 +135,7 @@ CONFIG def latest_current_chef_version_string installer_version_string = nil if @config[:prerelease] - installer_version_string = "-p" + installer_version_string = ["-p"] else chef_version_string = if knife_config[:bootstrap_version] knife_config[:bootstrap_version] diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb index 1291571358..af8fa3f698 100644 --- a/spec/unit/knife/core/bootstrap_context_spec.rb +++ b/spec/unit/knife/core/bootstrap_context_spec.rb @@ -205,4 +205,18 @@ EXPECTED end end + describe "prerelease" do + it "isn't set in the config_content by default" do + expect(bootstrap_context.config_content).not_to include("prerelease") + end + + describe "when configured via cli" do + let(:config) {{:prerelease => true}} + + it "uses CLI value" do + expect(bootstrap_context.latest_current_chef_version_string).to eq("-p") + end + end + end + end -- cgit v1.2.1 From 5380ecde5dcda0a3fed3d71d7a89ce58b2e9a552 Mon Sep 17 00:00:00 2001 From: Serdar Sutay Date: Tue, 25 Nov 2014 11:06:24 -0800 Subject: Contribution information for https://github.com/opscode/chef/pull/2452. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e85a727c37..85b520bbb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ removed securerandom patch * [**Scott Bonds**](https://github.com/bonds) add package support for OpenBSD +* [**Lucy Wyman**](https://github.com/lucywyman) + Added support for handling empty version strings to rubygems provider. ### Chef Contributions * Update Chef to use RSpec 3. -- cgit v1.2.1 From 0a9ec130b69bdb5a03687280758eedb46c1fa624 Mon Sep 17 00:00:00 2001 From: Serdar Sutay Date: Tue, 25 Nov 2014 11:08:31 -0800 Subject: Contribution information for https://github.com/opscode/chef/pull/2439. --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b520bbb6..25c7172a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ add package support for OpenBSD * [**Lucy Wyman**](https://github.com/lucywyman) Added support for handling empty version strings to rubygems provider. +* [**Yulian Kuncheff**](https://github.com/Daegalus) + Correctly set the pre-release identifier during knife bootstrap. ### Chef Contributions * Update Chef to use RSpec 3. -- cgit v1.2.1 From 868552dc9da2e122034ae7aa698dde5a9d9d5e0c Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Tue, 25 Nov 2014 11:16:40 -0800 Subject: Contribution information for https://github.com/opscode/chef/pull/2242 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e85a727c37..cfa313272f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ removed securerandom patch * [**Scott Bonds**](https://github.com/bonds) add package support for OpenBSD +* [**Anshul Sharma**](https://github.com/justanshulsharma) + `knife node run_list remove` now accepts run_list options in the same form as add ### Chef Contributions * Update Chef to use RSpec 3. -- cgit v1.2.1 From a870a4b3bf6619db3a4685766c263b9db89ff4e1 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Tue, 25 Nov 2014 11:25:51 -0800 Subject: Contribution information for https://github.com/opscode/chef/pull/2382 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a006f4cd55..5ed8d30981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ add package support for OpenBSD * [**Anshul Sharma**](https://github.com/justanshulsharma) `knife node run_list remove` now accepts run_list options in the same form as add +* [**Veres Lajos**](https://github.com/vlajos) + Typo fixes ### Chef Contributions * Update Chef to use RSpec 3. -- cgit v1.2.1 From da82c48f30106a241090653281b25ea3ae09e467 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Tue, 25 Nov 2014 11:48:54 -0800 Subject: Contribution information for https://github.com/opscode/chef/pull/2385 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed8d30981..1c1592d823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ `knife node run_list remove` now accepts run_list options in the same form as add * [**Veres Lajos**](https://github.com/vlajos) Typo fixes +* [**Tim Smith**](https://github.com/tas50) + Typo fixes ### Chef Contributions * Update Chef to use RSpec 3. -- cgit v1.2.1 From 6c6b591198df2dcd93f3c4fb5b77c7613ad9015c Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 25 Nov 2014 20:14:15 +0000 Subject: Add Steven Danna as a maintainer of Dev Tools I've fixed a number of chef-shell and knife related bugs, written a number of popular knife plugins that build on top of these systems, and understand the related code well. --- MAINTAINERS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 0f6b25aee0..3450a925c0 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -36,6 +36,8 @@ Chef Zero, Knife, Chef Apply and Chef Shell. ### Maintainers +[Steven Danna](https://github.com/stevendanna/) + ## Test Tools ChefSpec, Berkshelf (the chef bits), Test Kitchen (the Chef bits) @@ -85,4 +87,3 @@ The specific components of Chef related to a given platform - including (but not ### Lieutenant ### Maintainers - -- cgit v1.2.1 From 3558cccb16ff48be806c3af093462c95d4cc9b04 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Tue, 25 Nov 2014 13:34:01 -0800 Subject: suppress locale -a warnings on windows need the '!' to throw exceptions, or else the rescue clause is never run. --- lib/chef/config.rb | 2 +- spec/unit/config_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/chef/config.rb b/lib/chef/config.rb index 08ce1a8ff6..538271de0e 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -632,7 +632,7 @@ class Chef # # For example, on CentOS 6 with ENV['LANG'] = "en_US.UTF-8", # `locale -a`.split fails with ArgumentError invalid UTF-8 encoding. - locales = shell_out_with_systems_locale("locale -a").stdout.split + locales = shell_out_with_systems_locale!("locale -a").stdout.split case when locales.include?('C.UTF-8') 'C.UTF-8' diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb index 58fb229c96..ed2003e8bf 100644 --- a/spec/unit/config_spec.rb +++ b/spec/unit/config_spec.rb @@ -426,7 +426,7 @@ describe Chef::Config do let(:locales) { locale_array.join("\n") } before do - allow(Chef::Config).to receive(:shell_out_with_systems_locale).with("locale -a").and_return(shell_out) + allow(Chef::Config).to receive(:shell_out_with_systems_locale!).with("locale -a").and_return(shell_out) end shared_examples_for "a suitable locale" do @@ -493,7 +493,7 @@ describe Chef::Config do let(:locale_array) { [] } before do - allow(Chef::Config).to receive(:shell_out_with_systems_locale).and_raise("THIS IS AN ERROR") + allow(Chef::Config).to receive(:shell_out_with_systems_locale!).and_raise("THIS IS AN ERROR") end it "should default to 'en_US.UTF-8'" do -- cgit v1.2.1 From 2cabf9c5ba969ff89128d5334e36a76c766fce93 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Tue, 25 Nov 2014 14:42:58 -0800 Subject: Fixing failing tests on merge --- spec/unit/knife/node_run_list_remove_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/unit/knife/node_run_list_remove_spec.rb b/spec/unit/knife/node_run_list_remove_spec.rb index 2c3d29ae73..ceceef7178 100644 --- a/spec/unit/knife/node_run_list_remove_spec.rb +++ b/spec/unit/knife/node_run_list_remove_spec.rb @@ -72,8 +72,8 @@ describe Chef::Knife::NodeRunListRemove do @node.run_list << 'recipe[duck::type]' @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]' ] @knife.run - @node.run_list.should_not include('role[monkey]') - @node.run_list.should_not include('recipe[duck::type]') + expect(@node.run_list).not_to include('role[monkey]') + expect(@node.run_list).not_to include('recipe[duck::type]') end it "should remove the items from the run list when name args contains multiple run lists" do @@ -81,8 +81,8 @@ describe Chef::Knife::NodeRunListRemove do @node.run_list << 'recipe[duck::type]' @knife.name_args = [ 'adam', 'role[monkey], recipe[duck::type]', 'role[blah]' ] @knife.run - @node.run_list.should_not include('role[monkey]') - @node.run_list.should_not include('recipe[duck::type]') + expect(@node.run_list).not_to include('role[monkey]') + expect(@node.run_list).not_to include('recipe[duck::type]') end end end -- cgit v1.2.1 From 2108c74226d34b28d94bcb259ffe40583809deb3 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 23 Oct 2014 12:11:15 -0700 Subject: drop ruby 1.9.x support for Chef-12 Ruby 1.9.3 is in security-only maintenance phase which means that bugs for the core ruby interpreter will not be fixed and Chef cannot support ruby 1.9.x. Users should be using omnibus-chef packages which come with a built-in ruby 2.x or should upgrade their own installations to ruby 2.x (and accept that ongoing upgrade and support cost). Chef 11 will continue to be shipped on ruby 1.9.x until Chef 11 is EOL. --- chef.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chef.gemspec b/chef.gemspec index 8e906a0ef1..67cd29a930 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |s| s.email = "adam@getchef.com" s.homepage = "http://www.getchef.com" - s.required_ruby_version = ">= 1.9.3" + s.required_ruby_version = ">= 2.0.0" s.add_dependency "mixlib-config", "~> 2.0" s.add_dependency "mixlib-cli", "~> 1.4" -- cgit v1.2.1 From 6760a72d0c573665ed7f00cac1b27c8457416f10 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 23 Oct 2014 12:18:16 -0700 Subject: update docs for dropping support of 1.9.3 --- CHANGELOG.md | 2 ++ README.md | 2 +- RELEASE_NOTES.md | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35ad446cb7..06ad8087b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Typo fixes ### Chef Contributions +* ruby 1.9.3 support is dropped * Update Chef to use RSpec 3. ## 12.0.0 @@ -170,6 +171,7 @@ ### Chef Contributions +* ruby 1.9.3 support is dropped * Added RFC-023 Chef 12 Attribute Changes (https://github.com/opscode/chef-rfc/blob/master/rfc023-chef-12-attributes-changes.md) * Added os/platform_family options to provides syntax on the Chef::Resource DSL * Added provides methods to the Chef::Provider DSL diff --git a/README.md b/README.md index a0124fe1de..93665ee991 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ emerge, etc.): * git * C compiler, header files, etc. On Ubuntu/Debian, use the `build-essential` package. -* ruby 1.9.3 or later +* ruby 2.0.0 or later * rubygems * bundler diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7faf924134..630aa737df 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -241,9 +241,9 @@ manifest for the cookbook will be deleted from the cookbook file cache. In order to avoid re-downloading the file_cache for all the cookbooks and files that are skipped when an override run list is used, when an override run list is set the file cache is not cleaned at all. -## Dropped Support For Ruby 1.8.7/1.9.1/1.9.2 +## Dropped Support For Ruby 1.8 and 1.9 -Ruby 1.8.7, 1.9.1 and 1.9.2 are no longer supported. +Ruby 1.8.7, 1.9.1, 1.9.2 and 1.9.3 are no longer supported. ## Changed no_lazy_load config default to True -- cgit v1.2.1 From 6305d684d55cf26e7250a33953345416ee847710 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Tue, 25 Nov 2014 15:24:47 -0800 Subject: Remove 1.9 from travis, bump 2.1 to .5 patch release --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2ce7238619..37418ab621 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,14 +25,13 @@ env: matrix: include: - - rvm: 1.9.3 - rvm: 2.0.0 - - rvm: 2.1.1 - - rvm: 2.1.1 + - rvm: 2.1.5 + - rvm: 2.1.5 gemfile: pedant.gemfile script: bundle exec rake pedant ### START TEST KITCHEN ONLY ### - - rvm: 2.1.1 + - rvm: 2.1.5 gemfile: kitchen-tests/Gemfile before_install: - echo -n $DO_KEY_CHUNK_{0..30} >> ~/.ssh/id_aws.base64 -- cgit v1.2.1 From 45167319996c4fc7e65351a459ae2ee8a5960b31 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Tue, 25 Nov 2014 15:38:10 -0800 Subject: Force TK to install prerelease Chef pkg for now In the future (after Chef 12.0.0 is released) we should remove this. For now, we need to force TK to install a prerelease version of the Chef package, so it will include Ruby 2.1, and therefore not choke on our requirement for Ruby >= 2.0 --- kitchen-tests/.kitchen.travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kitchen-tests/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml index 66bbe23f64..15795e033a 100644 --- a/kitchen-tests/.kitchen.travis.yml +++ b/kitchen-tests/.kitchen.travis.yml @@ -9,7 +9,7 @@ provisioner: name: chef_zero github: <%= ENV['TRAVIS_REPO_SLUG'] %> branch: <%= ENV['TRAVIS_COMMIT'] %> - require_chef_omnibus: true + require_chef_omnibus: 12.0.0-rc.2 data_path: test/fixtures # disable file provider diffs so we don't overflow travis' line limit client_rb: -- cgit v1.2.1 From a0c294d8d1b6b0323d3c01265e824deb8a5d972d Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Wed, 26 Nov 2014 12:41:42 -0800 Subject: Remove 1.8 and 1.9 specific monkey patches --- lib/chef.rb | 7 ---- lib/chef/application/knife.rb | 1 - lib/chef/cookbook_version.rb | 1 - lib/chef/http.rb | 1 - lib/chef/monkey_patches/file.rb | 26 ------------ lib/chef/monkey_patches/fileutils.rb | 65 ------------------------------ lib/chef/monkey_patches/numeric.rb | 15 ------- lib/chef/monkey_patches/object.rb | 9 ----- lib/chef/monkey_patches/pathname.rb | 32 --------------- lib/chef/monkey_patches/regexp.rb | 34 ---------------- lib/chef/monkey_patches/string.rb | 49 ----------------------- lib/chef/monkey_patches/tempfile.rb | 64 ------------------------------ lib/chef/monkey_patches/uri.rb | 70 --------------------------------- lib/chef/provider/deploy.rb | 1 - spec/unit/monkey_patches/string_spec.rb | 37 ----------------- 15 files changed, 412 deletions(-) delete mode 100644 lib/chef/monkey_patches/file.rb delete mode 100644 lib/chef/monkey_patches/fileutils.rb delete mode 100644 lib/chef/monkey_patches/numeric.rb delete mode 100644 lib/chef/monkey_patches/object.rb delete mode 100644 lib/chef/monkey_patches/pathname.rb delete mode 100644 lib/chef/monkey_patches/regexp.rb delete mode 100644 lib/chef/monkey_patches/string.rb delete mode 100644 lib/chef/monkey_patches/tempfile.rb delete mode 100644 lib/chef/monkey_patches/uri.rb delete mode 100644 spec/unit/monkey_patches/string_spec.rb diff --git a/lib/chef.rb b/lib/chef.rb index 0d5fb3de2c..7f54b91f14 100644 --- a/lib/chef.rb +++ b/lib/chef.rb @@ -32,10 +32,3 @@ require 'chef/run_status' require 'chef/handler' require 'chef/handler/json_file' -require 'chef/monkey_patches/tempfile' -require 'chef/monkey_patches/string' -require 'chef/monkey_patches/numeric' -require 'chef/monkey_patches/object' -require 'chef/monkey_patches/file' -require 'chef/monkey_patches/uri' - diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index ca5a9c9900..1a19a45598 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -20,7 +20,6 @@ require 'chef/application' require 'mixlib/log' require 'ohai/config' require 'chef/monkey_patches/net_http.rb' -require 'chef/monkey_patches/uri.rb' class Chef::Application::Knife < Chef::Application diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb index 505b403e65..3bf19296c9 100644 --- a/lib/chef/cookbook_version.rb +++ b/lib/chef/cookbook_version.rb @@ -24,7 +24,6 @@ require 'chef/cookbook/file_vendor' require 'chef/cookbook/metadata' require 'chef/version_class' require 'pathname' -require 'chef/monkey_patches/pathname' require 'chef/digester' class Chef diff --git a/lib/chef/http.rb b/lib/chef/http.rb index ee951bd675..8d00a38dc1 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -25,7 +25,6 @@ require 'tempfile' require 'net/https' require 'uri' require 'chef/http/basic_client' -require 'chef/monkey_patches/string' require 'chef/monkey_patches/net_http' require 'chef/config' require 'chef/platform/query_helpers' diff --git a/lib/chef/monkey_patches/file.rb b/lib/chef/monkey_patches/file.rb deleted file mode 100644 index acc0ca73fe..0000000000 --- a/lib/chef/monkey_patches/file.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -# Author:: Daniel DeLeo () -# Copyright:: Copyright (c) 2013 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -if !File.respond_to?(:realpath) - require 'pathname' - class File - def self.realpath(path) - Pathname.new(path).realpath.to_s - end - end -end diff --git a/lib/chef/monkey_patches/fileutils.rb b/lib/chef/monkey_patches/fileutils.rb deleted file mode 100644 index f18bead144..0000000000 --- a/lib/chef/monkey_patches/fileutils.rb +++ /dev/null @@ -1,65 +0,0 @@ -# -# Author:: Stephen Delano () -# Copyright:: Copyright (c) 2012 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# == FileUtils::Entry_ (Patch) -# On Ruby 1.9.3 and earlier, FileUtils.cp_r(foo, bar, :preserve => true) fails -# when attempting to copy a directory containing symlinks. This has been -# patched in the trunk of Ruby, and this is a monkey patch of the offending -# code. - -unless RUBY_VERSION =~ /^2/ - require 'fileutils' - - class FileUtils::Entry_ - def copy_metadata(path) - st = lstat() - if !st.symlink? - File.utime st.atime, st.mtime, path - end - begin - if st.symlink? - begin - File.lchown st.uid, st.gid, path - rescue NotImplementedError - end - else - File.chown st.uid, st.gid, path - end - rescue Errno::EPERM - # clear setuid/setgid - if st.symlink? - begin - File.lchmod st.mode & 01777, path - rescue NotImplementedError - end - else - File.chmod st.mode & 01777, path - end - else - if st.symlink? - begin - File.lchmod st.mode, path - rescue NotImplementedError - end - else - File.chmod st.mode, path - end - end - end - end -end diff --git a/lib/chef/monkey_patches/numeric.rb b/lib/chef/monkey_patches/numeric.rb deleted file mode 100644 index f4612fdbf3..0000000000 --- a/lib/chef/monkey_patches/numeric.rb +++ /dev/null @@ -1,15 +0,0 @@ -unless 0.respond_to?(:fdiv) - class Numeric - def fdiv(other) - to_f / other - end - end -end - -# String elements referenced with [] <= 1.8.6 return a Fixnum. Cheat to allow -# for the simpler "test"[2].ord construct -class Numeric - def ord - return self - end -end diff --git a/lib/chef/monkey_patches/object.rb b/lib/chef/monkey_patches/object.rb deleted file mode 100644 index 017a4b7938..0000000000 --- a/lib/chef/monkey_patches/object.rb +++ /dev/null @@ -1,9 +0,0 @@ -class Object - unless new.respond_to?(:tap) - def tap - yield self - return self - end - end -end - diff --git a/lib/chef/monkey_patches/pathname.rb b/lib/chef/monkey_patches/pathname.rb deleted file mode 100644 index c0255ae7ea..0000000000 --- a/lib/chef/monkey_patches/pathname.rb +++ /dev/null @@ -1,32 +0,0 @@ -require 'pathname' - -if RUBY_VERSION.to_f < 1.9 - class Pathname - @@old_each_filename = instance_method(:each_filename) - - def each_filename(&block) - if block_given? - EachFilenameEnumerable.new(self).each(&block) - else - EachFilenameEnumerable.new(self) - end - end - - def old_each_filename(&block) - @@old_each_filename.bind(self).call(&block) - end - - class EachFilenameEnumerable - include Enumerable - attr_reader :pathname - - def initialize(pathname) - @pathname = pathname - end - - def each(&block) - @pathname.old_each_filename(&block) - end - end - end -end diff --git a/lib/chef/monkey_patches/regexp.rb b/lib/chef/monkey_patches/regexp.rb deleted file mode 100644 index 8a7ee77cb5..0000000000 --- a/lib/chef/monkey_patches/regexp.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2009 Marc-Andre Lafortune -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -class Regexp - # Standard in Ruby 1.8.7+. See official documentation[http://www.ruby-doc.org/core-1.8.7/classes/Regexp.html] - class << self - unless (union(%w(a b)) rescue false) - alias :union_without_array_argument :union - - def union(*arg) - return union_without_array_argument(*arg) unless arg.size == 1 - union_without_array_argument(*arg.first) - end - end - end -end diff --git a/lib/chef/monkey_patches/string.rb b/lib/chef/monkey_patches/string.rb deleted file mode 100644 index f91e27ddc5..0000000000 --- a/lib/chef/monkey_patches/string.rb +++ /dev/null @@ -1,49 +0,0 @@ -# -# Author:: Adam Jacob () -# Copyright:: Copyright (c) 2008 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# == String (Patch) -# On ruby 1.9, Strings are aware of multibyte characters, so +size+ and +length+ -# give the actual number of characters. In Chef::REST, we need the bytesize -# so we can correctly set the Content-Length headers, but ruby 1.8.6 and lower -# don't define String#bytesize. Monkey patching time! - -begin - require 'enumerator' -rescue LoadError -end - -class String - unless method_defined?(:bytesize) - alias :bytesize :size - end - - unless method_defined?(:lines) - def lines - enum_for(:each) - end - end -end - -# <= 1.8.6 needs some ord! -class String - unless method_defined?(:ord) - def ord - self.unpack('C').first - end - end -end diff --git a/lib/chef/monkey_patches/tempfile.rb b/lib/chef/monkey_patches/tempfile.rb deleted file mode 100644 index b9179f182b..0000000000 --- a/lib/chef/monkey_patches/tempfile.rb +++ /dev/null @@ -1,64 +0,0 @@ -# -# Author:: Adam Jacob () -# Copyright:: Copyright (c) 2008 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# == Tempfile (Patch) -# Tempfile has a horrible bug where it causes an IOError: closed stream in its -# finalizer, leading to intermittent application crashes with confusing stack -# traces. Here we monkey patch the fix into place. You can track the bug on -# ruby's redmine: http://redmine.ruby-lang.org/issues/show/3119 -# -# The patch is slightly different for Ruby 1.8 and Ruby 1.9, both patches are -# included here. -class Tempfile # :nodoc: - # Tempfile has changes between 1.8.x and 1.9.x - # so we monkey patch separately - if RUBY_VERSION =~ /^1\.8/ - def unlink - # keep this order for thread safeness - begin - File.unlink(@tmpname) if File.exist?(@tmpname) - @@cleanlist.delete(@tmpname) - @tmpname = nil - ObjectSpace.undefine_finalizer(self) - rescue Errno::EACCES - # may not be able to unlink on Windows; just ignore - end - end - alias delete unlink - - - # There is a patch for this, to be merged into 1.9 at some point. - # When that happens, we'll want to also check the RUBY_PATCHLEVEL - elsif RUBY_VERSION =~ /^1\.9/ - def unlink - # keep this order for thread safeness - return unless @tmpname - begin - if File.exist?(@tmpname) - File.unlink(@tmpname) - end - # remove tmpname from remover - @data[0] = @data[2] = nil - @tmpname = nil - rescue Errno::EACCES - # may not be able to unlink on Windows; just ignore - end - end - alias delete unlink - end -end diff --git a/lib/chef/monkey_patches/uri.rb b/lib/chef/monkey_patches/uri.rb deleted file mode 100644 index 158285e395..0000000000 --- a/lib/chef/monkey_patches/uri.rb +++ /dev/null @@ -1,70 +0,0 @@ -# Ruby is copyrighted free software by Yukihiro Matsumoto . -# You can redistribute it and/or modify it under either the terms of the -# 2-clause BSDL (see the file BSDL), or the conditions below: -# -# 1. You may make and give away verbatim copies of the source form of the -# software without restriction, provided that you duplicate all of the -# original copyright notices and associated disclaimers. -# -# 2. You may modify your copy of the software in any way, provided that -# you do at least ONE of the following: -# -# a) place your modifications in the Public Domain or otherwise -# make them Freely Available, such as by posting said -# modifications to Usenet or an equivalent medium, or by allowing -# the author to include your modifications in the software. -# -# b) use the modified software only within your corporation or -# organization. -# -# c) give non-standard binaries non-standard names, with -# instructions on where to get the original software distribution. -# -# d) make other distribution arrangements with the author. -# -# 3. You may distribute the software in object code or binary form, -# provided that you do at least ONE of the following: -# -# a) distribute the binaries and library files of the software, -# together with instructions (in the manual page or equivalent) -# on where to get the original distribution. -# -# b) accompany the distribution with the machine-readable source of -# the software. -# -# c) give non-standard binaries non-standard names, with -# instructions on where to get the original software distribution. -# -# d) make other distribution arrangements with the author. -# -# 4. You may modify and include the part of the software into any other -# software (possibly commercial). But some files in the distribution -# are not written by the author, so that they are not under these terms. -# -# For the list of those files and their copying conditions, see the -# file LEGAL. -# -# 5. The scripts and library files supplied as input to or produced as -# output from the software do not automatically fall under the -# copyright of the software, but belong to whomever generated them, -# and may be sold commercially, and may be aggregated with this -# software. -# -# 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - -require 'uri' - -unless URI::Generic.instance_methods.map {|m| m.to_s}.include?("hostname") - - class URI::Generic - # Copied from the MRI source for Ruby 1.9.3 - # File lib/uri/generic.rb, line 659 - def hostname - v = self.host - /\A\[(.*)\]\z/ =~ v ? $1 : v - end - end -end diff --git a/lib/chef/provider/deploy.rb b/lib/chef/provider/deploy.rb index 26c677643b..19e7c01ab1 100644 --- a/lib/chef/provider/deploy.rb +++ b/lib/chef/provider/deploy.rb @@ -18,7 +18,6 @@ require "chef/mixin/command" require "chef/mixin/from_file" -require "chef/monkey_patches/fileutils" require "chef/provider/git" require "chef/provider/subversion" require "chef/dsl/recipe" diff --git a/spec/unit/monkey_patches/string_spec.rb b/spec/unit/monkey_patches/string_spec.rb deleted file mode 100644 index 74e3753229..0000000000 --- a/spec/unit/monkey_patches/string_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Author:: Devin Ben-Hur -# Copyright:: Copyright (c) 2008, 2011 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'spec_helper' -require 'chef/monkey_patches/string' - -describe String do - - describe "#ord" do - it "converts each ASCII-8BIT character to corresponding positive Fixnum" do - (0..0xff).each do |num| - ch = num.chr - ch.force_encoding('ASCII-8BIT') if ch.respond_to? :force_encoding - - expect(ch.ord).to be_a_kind_of(Fixnum) - expect(ch.ord).to eq(num) - end - end - - end - -end -- cgit v1.2.1 From 3ad740754507629a73525ffdcc0b3eb06f177001 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Wed, 26 Nov 2014 13:27:18 -0800 Subject: Ensure 'uri' is required where it's used. URI previously was globally available because chef.rb loaded it via a monkey patch for the URI class. --- lib/chef/application.rb | 1 + lib/chef/application/windows_service.rb | 1 + lib/chef/cookbook_site_streaming_uploader.rb | 1 + lib/chef/provider/package/rubygems.rb | 1 + lib/chef/resource/remote_file.rb | 1 + 5 files changed, 5 insertions(+) diff --git a/lib/chef/application.rb b/lib/chef/application.rb index 7214afc5be..5a67fc9091 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -17,6 +17,7 @@ # limitations under the License. require 'pp' +require 'uri' require 'socket' require 'chef/config' require 'chef/config_fetcher' diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index bea5e9fcdc..ba7c6dab5a 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -26,6 +26,7 @@ require 'chef/log' require 'chef/rest' require 'mixlib/cli' require 'socket' +require 'uri' require 'win32/daemon' require 'chef/mixin/shell_out' diff --git a/lib/chef/cookbook_site_streaming_uploader.rb b/lib/chef/cookbook_site_streaming_uploader.rb index c444c8251b..879a578e15 100644 --- a/lib/chef/cookbook_site_streaming_uploader.rb +++ b/lib/chef/cookbook_site_streaming_uploader.rb @@ -18,6 +18,7 @@ # limitations under the License. # +require 'uri' require 'net/http' require 'mixlib/authentication/signedheaderauth' require 'openssl' diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 21689503f0..1f33cc5a9b 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -17,6 +17,7 @@ # limitations under the License. # +require 'uri' require 'chef/provider/package' require 'chef/mixin/command' require 'chef/resource/package' diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb index 46516fd3fb..7ba98b9d3b 100644 --- a/lib/chef/resource/remote_file.rb +++ b/lib/chef/resource/remote_file.rb @@ -17,6 +17,7 @@ # limitations under the License. # +require 'uri' require 'chef/resource/file' require 'chef/provider/remote_file' require 'chef/mixin/securable' -- cgit v1.2.1 From 6dba6d4c961e8dc0861dffc046aedeb52caa241d Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Wed, 26 Nov 2014 18:28:26 -0500 Subject: Remove all parts of 'shef' --- bin/shef | 35 ----------------------------------- chef.gemspec | 2 +- lib/chef/shef/ext.rb | 19 ------------------- 3 files changed, 1 insertion(+), 55 deletions(-) delete mode 100755 bin/shef delete mode 100644 lib/chef/shef/ext.rb diff --git a/bin/shef b/bin/shef deleted file mode 100755 index 0862198e53..0000000000 --- a/bin/shef +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env ruby -# -# ./chef-shell - Run the Chef REPL (Shell) -# -# Author:: Daniel DeLeo () -# Copyright:: Copyright (c) 2009 -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -begin - require "rubygems" -rescue LoadError -end - -require "irb" -require "irb/completion" -require 'irb/ext/save-history' - -$:.unshift(File.expand_path(File.join(File.dirname(__FILE__), "..", "lib"))) - -require "chef/shell" - -Chef::Log.warn("DEPRECATED: The 'shef' program is renamed to 'chef-shell'") -Shell.start diff --git a/chef.gemspec b/chef.gemspec index 67cd29a930..2390d88365 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -46,7 +46,7 @@ Gem::Specification.new do |s| %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_development_dependency gem, "~> 3.0" } s.bindir = "bin" - s.executables = %w( chef-client chef-solo knife chef-shell shef chef-apply ) + s.executables = %w( chef-client chef-solo knife chef-shell chef-apply ) s.require_path = 'lib' s.files = %w(Rakefile LICENSE README.md CONTRIBUTING.md) + Dir.glob("{distro,lib,tasks,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) } diff --git a/lib/chef/shef/ext.rb b/lib/chef/shef/ext.rb deleted file mode 100644 index 8f03de2d04..0000000000 --- a/lib/chef/shef/ext.rb +++ /dev/null @@ -1,19 +0,0 @@ -#-- -# Author:: Joshua Timberman () -# Copyright:: Copyright (c) 2012 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require 'chef/shell/ext' -- cgit v1.2.1 From a3569b2f4789abf5721d12db0e01d0b6b5bf0612 Mon Sep 17 00:00:00 2001 From: jtimberman Date: Tue, 25 Nov 2014 17:18:17 -0700 Subject: Adding myself to relevant component maintainer --- MAINTAINERS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 3450a925c0..0592ddc08f 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -37,6 +37,7 @@ Chef Zero, Knife, Chef Apply and Chef Shell. ### Maintainers [Steven Danna](https://github.com/stevendanna/) +[Joshua Timberman](https://github.com/jtimberman) ## Test Tools @@ -46,6 +47,8 @@ ChefSpec, Berkshelf (the chef bits), Test Kitchen (the Chef bits) ### Maintainers +[Joshua Timberman](https://github.com/jtimberman) + ## Platform Specific Components The specific components of Chef related to a given platform - including (but not limited to) resources, providers, and the core DSL. @@ -87,3 +90,5 @@ The specific components of Chef related to a given platform - including (but not ### Lieutenant ### Maintainers + +[Joshua Timberman](https://github.com/jtimberman) -- cgit v1.2.1 From 4496b129dd0c43ebcc8bceb9e9e37bd38edaaee7 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Mon, 1 Dec 2014 10:27:38 -0800 Subject: Adding myself as a maintainer --- MAINTAINERS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 0592ddc08f..918df3b8f0 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -25,8 +25,8 @@ another component. ### Maintainers [Jon Cowie](http://github.com/jonlives) - [Phil Dibowitz](https://github.com/jaymzh) +[Tyler Ball](https://github.com/tyler-ball) ## Dev Tools @@ -92,3 +92,4 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers [Joshua Timberman](https://github.com/jtimberman) +[Tyler Ball](https://github.com/tyler-ball) -- cgit v1.2.1 From c07413c1e9b2bf67c5f53b77fb07724b607a39e8 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Mon, 1 Dec 2014 10:29:03 -0800 Subject: Fixing formatting --- MAINTAINERS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 918df3b8f0..68635c2b27 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -25,7 +25,9 @@ another component. ### Maintainers [Jon Cowie](http://github.com/jonlives) + [Phil Dibowitz](https://github.com/jaymzh) + [Tyler Ball](https://github.com/tyler-ball) ## Dev Tools @@ -37,6 +39,7 @@ Chef Zero, Knife, Chef Apply and Chef Shell. ### Maintainers [Steven Danna](https://github.com/stevendanna/) + [Joshua Timberman](https://github.com/jtimberman) ## Test Tools @@ -92,4 +95,5 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers [Joshua Timberman](https://github.com/jtimberman) + [Tyler Ball](https://github.com/tyler-ball) -- cgit v1.2.1 From d73510eca8c43e6dd2d4ba4404b7d2f9f43fb603 Mon Sep 17 00:00:00 2001 From: Adam Jacob Date: Mon, 1 Dec 2014 14:36:45 -0800 Subject: Add Seth Vargo as LT for ChefSpec --- MAINTAINERS.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 68635c2b27..12f1920c8b 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -44,11 +44,13 @@ Chef Zero, Knife, Chef Apply and Chef Shell. ## Test Tools -ChefSpec, Berkshelf (the chef bits), Test Kitchen (the Chef bits) +### ChefSpec -### Lieutenant +#### Lieutenant -### Maintainers +[Seth Vargo](https://github.com/sethvargo) + +#### Maintainers [Joshua Timberman](https://github.com/jtimberman) -- cgit v1.2.1 From 38cc10bcb769230da69e75a1d6c9cea1be14d5e1 Mon Sep 17 00:00:00 2001 From: Adam Jacob Date: Mon, 1 Dec 2014 20:19:16 -0800 Subject: A memorial for Ezra Zygmuntowicz Adding the --ez switch to Chef Solo, to memorialize Ezra. He was the father of Chef Solo, and without his early advocacy and evangelism, there would be no Chef today. Rest in peace, Ez. --- lib/chef/application/solo.rb | 18 ++++++++++++++++++ lib/chef/config.rb | 1 + 2 files changed, 19 insertions(+) diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index c99170f437..6e568ddbb1 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -160,6 +160,11 @@ class Chef::Application::Solo < Chef::Application :description => 'Enable whyrun mode', :boolean => true + option :ez, + :long => '--ez', + :description => 'A memorial for Ezra Zygmuntowicz', + :boolean => true + option :environment, :short => '-E ENVIRONMENT', :long => '--environment ENVIRONMENT', @@ -213,6 +218,7 @@ class Chef::Application::Solo < Chef::Application end def run_application + for_ezra if Chef::Config[:ez] if !Chef::Config[:client_fork] || Chef::Config[:once] # Run immediately without interval sleep or splay begin @@ -227,7 +233,19 @@ class Chef::Application::Solo < Chef::Application end end + private + + def for_ezra + puts <<-EOH +For Ezra Zygmuntowicz: + The man who brought you Chef Solo + Early contributor to Chef + Kind hearted open source advocate + Rest in peace, Ezra. +EOH + end + def interval_run_chef_client if Chef::Config[:daemonize] Chef::Daemon.daemonize("chef-client") diff --git a/lib/chef/config.rb b/lib/chef/config.rb index c3fd939628..4b83a0eca3 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -317,6 +317,7 @@ class Chef default :why_run, false default :color, false default :client_fork, true + default :ez, false default :enable_reporting, true default :enable_reporting_url_fatals, false -- cgit v1.2.1 From c312f006a982bf9a6bb5d74c2fa163c89fafc801 Mon Sep 17 00:00:00 2001 From: danielsdeleo Date: Mon, 1 Dec 2014 11:07:49 -0800 Subject: Add myself to MAINTAINERS --- MAINTAINERS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 12f1920c8b..cb19072f73 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -30,6 +30,8 @@ another component. [Tyler Ball](https://github.com/tyler-ball) +[Daniel DeLeo](https://github.com/danielsdeleo) + ## Dev Tools Chef Zero, Knife, Chef Apply and Chef Shell. @@ -42,6 +44,8 @@ Chef Zero, Knife, Chef Apply and Chef Shell. [Joshua Timberman](https://github.com/jtimberman) +[Daniel DeLeo](https://github.com/danielsdeleo) + ## Test Tools ### ChefSpec -- cgit v1.2.1 From 95f528503231e7b22ae0bfd7c1086d8306246566 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 1 Dec 2014 10:58:43 -0800 Subject: adding myself to MAINTAINERS --- MAINTAINERS.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index cb19072f73..07622f903e 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -25,8 +25,8 @@ another component. ### Maintainers [Jon Cowie](http://github.com/jonlives) - [Phil Dibowitz](https://github.com/jaymzh) +[Lamont Granquist](http://github.com/lamont-granquist) [Tyler Ball](https://github.com/tyler-ball) @@ -43,6 +43,7 @@ Chef Zero, Knife, Chef Apply and Chef Shell. [Steven Danna](https://github.com/stevendanna/) [Joshua Timberman](https://github.com/jtimberman) +[Lamont Granquist](http://github.com/lamont-granquist) [Daniel DeLeo](https://github.com/danielsdeleo) @@ -57,6 +58,7 @@ Chef Zero, Knife, Chef Apply and Chef Shell. #### Maintainers [Joshua Timberman](https://github.com/jtimberman) +[Lamont Granquist](http://github.com/lamont-granquist) ## Platform Specific Components @@ -69,6 +71,7 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers [Jon Cowie](http://github.com/jonlives) +[Lamont Granquist](http://github.com/lamont-granquist) ## Ubuntu @@ -76,6 +79,8 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers +[Lamont Granquist](http://github.com/lamont-granquist) + ## Windows ### Lieutenant @@ -88,12 +93,16 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers +[Lamont Granquist](http://github.com/lamont-granquist) + ## AIX ### Lieutenant ### Maintainers +[Lamont Granquist](http://github.com/lamont-granquist) + ## Mac OS X ### Lieutenant -- cgit v1.2.1 From ccbe263d9f4ee9f5b727064301a6f86e8eb9dcd4 Mon Sep 17 00:00:00 2001 From: Claire McQuin Date: Tue, 2 Dec 2014 13:59:07 -0800 Subject: Use lists. --- MAINTAINERS.md | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 07622f903e..6c96317907 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -24,13 +24,11 @@ another component. ### Maintainers -[Jon Cowie](http://github.com/jonlives) -[Phil Dibowitz](https://github.com/jaymzh) -[Lamont Granquist](http://github.com/lamont-granquist) - -[Tyler Ball](https://github.com/tyler-ball) - -[Daniel DeLeo](https://github.com/danielsdeleo) +* [Jon Cowie](http://github.com/jonlives) +* [Phil Dibowitz](https://github.com/jaymzh) +* [Lamont Granquist](http://github.com/lamont-granquist) +* [Tyler Ball](https://github.com/tyler-ball) +* [Daniel DeLeo](https://github.com/danielsdeleo) ## Dev Tools @@ -40,12 +38,10 @@ Chef Zero, Knife, Chef Apply and Chef Shell. ### Maintainers -[Steven Danna](https://github.com/stevendanna/) - -[Joshua Timberman](https://github.com/jtimberman) -[Lamont Granquist](http://github.com/lamont-granquist) - -[Daniel DeLeo](https://github.com/danielsdeleo) +* [Steven Danna](https://github.com/stevendanna/) +* [Joshua Timberman](https://github.com/jtimberman) +* [Lamont Granquist](http://github.com/lamont-granquist) +* [Daniel DeLeo](https://github.com/danielsdeleo) ## Test Tools @@ -57,8 +53,8 @@ Chef Zero, Knife, Chef Apply and Chef Shell. #### Maintainers -[Joshua Timberman](https://github.com/jtimberman) -[Lamont Granquist](http://github.com/lamont-granquist) +* [Joshua Timberman](https://github.com/jtimberman) +* [Lamont Granquist](http://github.com/lamont-granquist) ## Platform Specific Components @@ -70,8 +66,8 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers -[Jon Cowie](http://github.com/jonlives) -[Lamont Granquist](http://github.com/lamont-granquist) +* [Jon Cowie](http://github.com/jonlives) +* [Lamont Granquist](http://github.com/lamont-granquist) ## Ubuntu @@ -79,7 +75,7 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers -[Lamont Granquist](http://github.com/lamont-granquist) +* [Lamont Granquist](http://github.com/lamont-granquist) ## Windows @@ -93,7 +89,7 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers -[Lamont Granquist](http://github.com/lamont-granquist) +* [Lamont Granquist](http://github.com/lamont-granquist) ## AIX @@ -101,7 +97,7 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers -[Lamont Granquist](http://github.com/lamont-granquist) +* [Lamont Granquist](http://github.com/lamont-granquist) ## Mac OS X @@ -109,6 +105,5 @@ The specific components of Chef related to a given platform - including (but not ### Maintainers -[Joshua Timberman](https://github.com/jtimberman) - -[Tyler Ball](https://github.com/tyler-ball) +* [Joshua Timberman](https://github.com/jtimberman) +* [Tyler Ball](https://github.com/tyler-ball) -- cgit v1.2.1 From f2b83552450fcfaf6f37021e8eb192218e4c9d70 Mon Sep 17 00:00:00 2001 From: Claire McQuin Date: Tue, 2 Dec 2014 13:59:22 -0800 Subject: Add myself as a core maintainer. --- MAINTAINERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 6c96317907..6f1b2e6f4f 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -29,6 +29,7 @@ another component. * [Lamont Granquist](http://github.com/lamont-granquist) * [Tyler Ball](https://github.com/tyler-ball) * [Daniel DeLeo](https://github.com/danielsdeleo) +* [Claire McQuin](https://github.com/mcquin) ## Dev Tools -- cgit v1.2.1 From b4b9095dc1652881a578c93116e6c1d4b58b8ffb Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Wed, 3 Dec 2014 14:33:39 -0500 Subject: Remove unused "agent". This was probably an aborted attempt to integrate this project into Chef: https://github.com/opscode/opscode-agent --- lib/chef/application/agent.rb | 18 ------------------ lib/chef/applications.rb | 1 - 2 files changed, 19 deletions(-) delete mode 100644 lib/chef/application/agent.rb diff --git a/lib/chef/application/agent.rb b/lib/chef/application/agent.rb deleted file mode 100644 index 66b0c25cbf..0000000000 --- a/lib/chef/application/agent.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Author:: AJ Christensen () -# Copyright:: Copyright (c) 2008 Opscode, Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -require 'chef/application' diff --git a/lib/chef/applications.rb b/lib/chef/applications.rb index 6160bb96cd..6a1a2e8a92 100644 --- a/lib/chef/applications.rb +++ b/lib/chef/applications.rb @@ -1,4 +1,3 @@ -require 'chef/application/agent' require 'chef/application/client' require 'chef/application/knife' require 'chef/application/solo' -- cgit v1.2.1 From 5002cbbee1135195d8dcb04f5509ab98cfb9169a Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 3 Dec 2014 11:29:38 -0800 Subject: Fix knife plugin path searching Unreleased Chef 12.0.0 bug caught in testing where only the searching upwards from PWD to find .chef in order to get the plugin path for knife was busted. The chef_config_dir was being used before load_config was being called, so it was nil, which broke finding knife plugins. This was fixed by adding some lazy initialization of the config_loader object itself and the chef_config_dir. The reset_config_loader! is added entirely to reset the global state for unit testing. This whole class is a bit horrible and needs to have all its global state removed from it, class methods removed, class ivars and the class-variable-in-a-class-method-for-inheritance-lolwut needs to be removed. Unfortunately, that requires some delicate surgery because Chef::Knife gets used as a public API, and is beyond the scope of gettting Chef 12 shipped. --- lib/chef/knife.rb | 14 +++++++++++--- lib/chef/workstation_config_loader.rb | 2 +- spec/unit/application/knife_spec.rb | 8 ++++++-- spec/unit/knife_spec.rb | 5 +++++ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index c000ca4d0a..3f234d7ce3 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -72,6 +72,11 @@ class Chef ui.msg(msg) end + def self.reset_config_loader! + @@chef_config_dir = nil + @config_loader = nil + end + def self.reset_subcommands! @@subcommands = {} @subcommands_by_category = nil @@ -162,12 +167,15 @@ class Chef # Shared with subclasses @@chef_config_dir = nil + def self.config_loader + @config_loader ||= WorkstationConfigLoader.new(nil, Chef::Log) + end + def self.load_config(explicit_config_file) - config_loader = WorkstationConfigLoader.new(explicit_config_file, Chef::Log) + config_loader.explicit_config_file = explicit_config_file config_loader.load ui.warn("No knife configuration file found") if config_loader.no_config_found? - @@chef_config_dir = config_loader.chef_config_dir config_loader rescue Exceptions::ConfigurationError => e @@ -176,7 +184,7 @@ class Chef end def self.chef_config_dir - @@chef_config_dir + @@chef_config_dir ||= config_loader.chef_config_dir end # Run knife for the given +args+ (ARGV), adding +options+ to the list of diff --git a/lib/chef/workstation_config_loader.rb b/lib/chef/workstation_config_loader.rb index 6715d4eec2..dd02ad9a66 100644 --- a/lib/chef/workstation_config_loader.rb +++ b/lib/chef/workstation_config_loader.rb @@ -25,7 +25,7 @@ class Chef class WorkstationConfigLoader # Path to a config file requested by user, (e.g., via command line option). Can be nil - attr_reader :explicit_config_file + attr_accessor :explicit_config_file # TODO: initialize this with a logger for Chef and Knife def initialize(explicit_config_file, logger=nil) diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb index 806a596a61..3c215eac7f 100644 --- a/spec/unit/application/knife_spec.rb +++ b/spec/unit/application/knife_spec.rb @@ -33,6 +33,11 @@ describe Chef::Application::Knife do end end + after(:each) do + # reset some really nasty global state + NoopKnifeCommand.reset_config_loader! + end + before(:each) do # Prevent code from getting loaded on every test invocation. allow(Chef::Knife).to receive(:load_commands) @@ -109,7 +114,6 @@ describe Chef::Application::Knife do end expect(Chef::Config[:client_key]).to eq(full_path) end - end describe "with environment configuration" do @@ -168,6 +172,6 @@ describe Chef::Application::Knife do @knife.run end end - end + end diff --git a/spec/unit/knife_spec.rb b/spec/unit/knife_spec.rb index 49fa4a85ca..8f652e58c7 100644 --- a/spec/unit/knife_spec.rb +++ b/spec/unit/knife_spec.rb @@ -44,6 +44,10 @@ describe Chef::Knife do @stderr = StringIO.new end + after(:each) do + Chef::Knife.reset_config_loader! + end + describe "after loading a subcommand" do before do Chef::Knife.reset_subcommands! @@ -268,6 +272,7 @@ describe Chef::Knife do @knife.config[:verbosity] = 1 @knife.config[:config_file] = fake_config config_loader = double("Chef::WorkstationConfigLoader", :load => true, :no_config_found? => false, :chef_config_dir => "/etc/chef", :config_location => fake_config) + allow(config_loader).to receive(:explicit_config_file=).with(fake_config).and_return(fake_config) allow(Chef::WorkstationConfigLoader).to receive(:new).and_return(config_loader) end -- cgit v1.2.1 From 1a909f7dd176f0b86885403730cfb2a3db42a712 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 3 Dec 2014 16:44:32 -0800 Subject: setting master to 12.1.0.dev.0 to drop ancient devodd policy --- lib/chef/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chef/version.rb b/lib/chef/version.rb index e0aa4c47c5..a8fc002399 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -17,7 +17,7 @@ class Chef CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__))) - VERSION = '12.2.0.dev.0' + VERSION = '12.1.0.dev.0' end # -- cgit v1.2.1 From a45716b67a2168c21b166e4aab38668e9b96d856 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Wed, 3 Dec 2014 16:45:32 -0800 Subject: pinning ohai to 8.x --- chef.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chef.gemspec b/chef.gemspec index 2390d88365..f623f8bb82 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.add_dependency "mixlib-log", "~> 1.3" s.add_dependency "mixlib-authentication", "~> 1.3" s.add_dependency "mixlib-shellout", ">= 2.0.0.rc.0", "< 3.0" - s.add_dependency "ohai", ">= 7.6.0.rc.0" + s.add_dependency "ohai", "~> 8.0" s.add_dependency "ffi-yajl", "~> 1.2" s.add_dependency "net-ssh", "~> 2.6" -- cgit v1.2.1