diff options
399 files changed, 1963 insertions, 1967 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4744593eeb..523fadc45f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ You can find the answers to additional frequently asked questions [on the wiki]( * Create an account on our [bug tracker](http://tickets.opscode.com) * Sign our contributor agreement (CLA) [ -online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L) +online](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L) (keep reading if you're contributing on behalf of your employer) * Create a ticket for your change on the [bug tracker](http://tickets.opscode.com) * Link to your patch as a rebased git branch or pull request from the ticket @@ -19,7 +19,7 @@ We regularly review contributions and will get back to you if we have any sugges ## The Apache License and the CLA/CCLA Licensing is very important to open source projects, it helps ensure the software continues to be available under the terms that the author desired. -Chef uses the Apache 2.0 license to strike a balance between open contribution and allowing you to use the software however you would like to. +Chef uses the Apache 2.0 license to strike a balance between open contribution and allowing you to use the software however you would like to. The license tells you what rights you have that are provided by the copyright holder. It is important that the contributor fully understands what rights they are licensing and agrees to them. Sometimes the copyright holder isn't the contributor, most often when the contributor is doing work for a company. @@ -43,26 +43,26 @@ such as: * Discussion regarding the design and merits of features * Error output to aid in finding similar bugs -Each ticket should aim to fix one bug or add one feature. +Each ticket should aim to fix one bug or add one feature. ## Using git -You can get a quick copy of the chef repository by running `git clone git://github.com/opscode/chef.git`. +You can get a quick copy of the chef repository by running `git clone git://github.com/opscode/chef.git`. -For collaboration purposes, it is best if you create a Github account and fork the repository to your own account. +For collaboration purposes, it is best if you create a Github account and fork the repository to your own account. Once you do this you will be able to push your changes to your Github repository for others to see and use. ### Branches and Commits You should submit your patch as a git branch named after the ticket, such as CHEF-1337. -This is called a _topic branch_ and allows users to associate a branch of code with the ticket. +This is called a _topic branch_ and allows users to associate a branch of code with the ticket. It is a best practice to have your commit message have a _summary line_ that includes the ticket number, followed by an empty line and then a brief description of the commit. This also helps other contributors understand the purpose of changes to the code. CHEF-3435: Create deploy dirs before calling scm_provider - + The SCM providers have an assertation that requires the deploy directory to exist. The deploy provider will create missing directories, we don't converge the actions before we call run_action against the SCM provider, so it is not @@ -76,7 +76,7 @@ helpful to be clear about your use case and change so they can understand it eve All of Opscode's open source projects are available on [Github](http://www.github.com/opscode). -We don't require you to use Github, and we will even take patch diffs attached to tickets on the tracker. +We don't require you to use Github, and we will even take patch diffs attached to tickets on the tracker. However Github has a lot of convenient features, such as being able to see a diff of changes between a pull request and the main repository quickly without downloading the branch. @@ -92,14 +92,14 @@ Additional help with git is available on the [Working with Git](http://wiki.opsc There are rspec unit tests in the 'spec' directory. If you don't have rspec already installed, you can use the 'bundler' gem to help you get the necessary prerequisites by running `sudo gem install bundler` and then `bundle install` from -the chef respository. You can run the chef client spec tests by running `rspec spec/*` or `rake spec` from the chef +the chef respository. You can run the chef client spec tests by running `rspec spec/*` or `rake spec` from the chef directory of the chef repository. -These tests should pass successfully on Ruby 1.8 and 1.9 on all of the platforms that Chef runs on. It is good to run the tests +These tests should pass successfully on Ruby 1.8 and 1.9 on all of the platforms that Chef runs on. It is good to run the tests once on your system before you get started to ensure they all pass so you have a valid baseline. After you write your patch, run the tests again to see if they all pass. -If any don't pass, investigate them before submitting your patch. +If any don't pass, investigate them before submitting your patch. These tests don't modify your system, and sometimes tests fail because a command that would be run has changed because of your patch. This should be a simple fix. Other times the failure can show you that an important feature no longer works because of @@ -136,7 +136,7 @@ The versioning for the Chef project is X.Y.Z. Major releases and have historically been once a year. Minor releases for Chef average every two months and patch releases come as needed. -There are usually beta releases and release candidates (RC) of major and minor releases announced on +There are usually beta releases and release candidates (RC) of major and minor releases announced on the [chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev). Once an RC is released, we wait at least three days to allow for testing for regressions before the final release. If a blocking regression is found then another RC is made containing the fix and the timer is reset. diff --git a/bin/chef-apply b/bin/chef-apply index 54ce230582..c617129aa3 100755 --- a/bin/chef-apply +++ b/bin/chef-apply @@ -9,9 +9,9 @@ # 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. diff --git a/bin/chef-client b/bin/chef-client index bfd5544319..5b2b058f91 100755 --- a/bin/chef-client +++ b/bin/chef-client @@ -9,9 +9,9 @@ # 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. diff --git a/bin/chef-service-manager b/bin/chef-service-manager index 781fd116de..3d48f203cb 100755 --- a/bin/chef-service-manager +++ b/bin/chef-service-manager @@ -9,9 +9,9 @@ # 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. diff --git a/bin/chef-solo b/bin/chef-solo index 69891acb73..958ab21a41 100755 --- a/bin/chef-solo +++ b/bin/chef-solo @@ -9,9 +9,9 @@ # 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. @@ -1,6 +1,6 @@ #!/usr/bin/env ruby # -# ./knife - Chef CLI interface +# ./knife - Chef CLI interface # # Author:: Adam Jacob (<adam@opscode.com>) # Copyright:: Copyright (c) 2009 Opscode, Inc. @@ -9,9 +9,9 @@ # 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. diff --git a/chef.gemspec b/chef.gemspec index da0e076fa1..c127637a17 100644 --- a/chef.gemspec +++ b/chef.gemspec @@ -29,9 +29,8 @@ Gem::Specification.new do |s| # CHEF-3027: The knife-cloud plugins require newer features from highline, core chef should not. s.add_dependency "highline", "~> 1.6", ">= 1.6.9" s.add_dependency "erubis", "~> 2.7" - s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4" - + %w(rdoc sdoc rake rack rspec_junit_formatter).each { |gem| s.add_development_dependency gem } %w(rspec-core rspec-expectations rspec-mocks).each { |gem| s.add_development_dependency gem, "~> 2.13.0" } s.add_development_dependency "chef-zero", "~> 1.4" diff --git a/distro/arch/etc/rc.d/chef-client b/distro/arch/etc/rc.d/chef-client index 36f00bad6a..6e2feb2e52 100644 --- a/distro/arch/etc/rc.d/chef-client +++ b/distro/arch/etc/rc.d/chef-client @@ -5,9 +5,9 @@ # 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. diff --git a/distro/arch/etc/rc.d/chef-server b/distro/arch/etc/rc.d/chef-server index 59f926c2c9..1ffbf8dce5 100644 --- a/distro/arch/etc/rc.d/chef-server +++ b/distro/arch/etc/rc.d/chef-server @@ -5,9 +5,9 @@ # 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. diff --git a/distro/arch/etc/rc.d/chef-server-webui b/distro/arch/etc/rc.d/chef-server-webui index 79a9b77c1c..bec185151f 100644 --- a/distro/arch/etc/rc.d/chef-server-webui +++ b/distro/arch/etc/rc.d/chef-server-webui @@ -5,9 +5,9 @@ # 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. diff --git a/distro/arch/etc/rc.d/chef-solr b/distro/arch/etc/rc.d/chef-solr index a3682a495a..10bd15ea08 100644 --- a/distro/arch/etc/rc.d/chef-solr +++ b/distro/arch/etc/rc.d/chef-solr @@ -5,9 +5,9 @@ # 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. diff --git a/distro/common/markdown/man1/knife-bootstrap.mkd b/distro/common/markdown/man1/knife-bootstrap.mkd index c466fc7f7f..5c5e456023 100644 --- a/distro/common/markdown/man1/knife-bootstrap.mkd +++ b/distro/common/markdown/man1/knife-bootstrap.mkd @@ -32,7 +32,7 @@ __knife__ __bootstrap__ _(options)_ * `--[no-]host-key-verify`: Enable host key verification, which is the default behavior. * `--hint HINT_NAME[=HINT_FILE]`: - Provide the name of a hint (with option JSON file) to set for use by + Provide the name of a hint (with option JSON file) to set for use by Ohai plugins. ## DESCRIPTION diff --git a/distro/common/markdown/man1/knife-configure.mkd b/distro/common/markdown/man1/knife-configure.mkd index cc7dd1d96e..507d30db4e 100644 --- a/distro/common/markdown/man1/knife-configure.mkd +++ b/distro/common/markdown/man1/knife-configure.mkd @@ -35,17 +35,17 @@ the specified _directory_. field blank to accept the default value. On most systems, the default values are acceptable. - user@host$ knife configure -i - Please enter the chef server URL: [http://localhost:4000] - Please enter a clientname for the new client: [username] - Please enter the existing admin clientname: [chef-webui] - Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] - Please enter the validation clientname: [chef-validator] - Please enter the location of the validation key: [/etc/chef/validation.pem] - Please enter the path to a chef repository (or leave blank): - Creating initial API user... - Created (or updated) client[username] - Configuration file written to /home/username/.chef/knife.rb + user@host$ knife configure -i + Please enter the chef server URL: [http://localhost:4000] + Please enter a clientname for the new client: [username] + Please enter the existing admin clientname: [chef-webui] + Please enter the location of the existing admin client's private key: [/etc/chef/webui.pem] + Please enter the validation clientname: [chef-validator] + Please enter the location of the validation key: [/etc/chef/validation.pem] + Please enter the path to a chef repository (or leave blank): + Creating initial API user... + Created (or updated) client[username] + Configuration file written to /home/username/.chef/knife.rb This creates a new administrator client named _username_, writes a configuration file to _/home/username/.chef/knife.rb_, and the diff --git a/distro/common/markdown/man8/chef-expander.mkd b/distro/common/markdown/man8/chef-expander.mkd index d72ee1df9f..9190a9aebb 100644 --- a/distro/common/markdown/man8/chef-expander.mkd +++ b/distro/common/markdown/man8/chef-expander.mkd @@ -79,4 +79,4 @@ granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License. On Debian systems, the complete text of the Apache 2.0 License can be -found in /usr/share/common-licenses/Apache-2.0.
\ No newline at end of file +found in /usr/share/common-licenses/Apache-2.0. diff --git a/distro/common/markdown/man8/chef-expanderctl.mkd b/distro/common/markdown/man8/chef-expanderctl.mkd index 00b34e7734..03ce6af8ac 100644 --- a/distro/common/markdown/man8/chef-expanderctl.mkd +++ b/distro/common/markdown/man8/chef-expanderctl.mkd @@ -55,4 +55,4 @@ granted to copy, distribute and / or modify this document under the terms of the Apache 2.0 License. On Debian systems, the complete text of the Apache 2.0 License can be -found in /usr/share/common-licenses/Apache-2.0.
\ No newline at end of file +found in /usr/share/common-licenses/Apache-2.0. diff --git a/distro/redhat/etc/init.d/chef-client b/distro/redhat/etc/init.d/chef-client index fbeaa395c0..b41150e7a1 100644 --- a/distro/redhat/etc/init.d/chef-client +++ b/distro/redhat/etc/init.d/chef-client @@ -61,7 +61,7 @@ reload() { killproc -p $pidfile chef-client -HUP retval=$? echo - return $retval + return $retval } run() { diff --git a/distro/redhat/etc/init.d/chef-server b/distro/redhat/etc/init.d/chef-server index 44247178b5..f956dd4e45 100644 --- a/distro/redhat/etc/init.d/chef-server +++ b/distro/redhat/etc/init.d/chef-server @@ -11,7 +11,7 @@ # Required-Stop: $local_fs $network $remote_fs chef-solr chef-expander # Should-Start: $named $time # Should-Stop: $named $time -# Short-Description: Startup script for chef-server +# Short-Description: Startup script for chef-server # Description: Server component of the Chef systems integration framework. ### END INIT INFO @@ -50,7 +50,7 @@ start() { stop() { echo -n $"Stopping $prog: " - killproc -p $pidfile $prog + killproc -p $pidfile $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile diff --git a/distro/redhat/etc/init.d/chef-server-webui b/distro/redhat/etc/init.d/chef-server-webui index f26f9c1f9a..65498bf723 100644 --- a/distro/redhat/etc/init.d/chef-server-webui +++ b/distro/redhat/etc/init.d/chef-server-webui @@ -11,7 +11,7 @@ # Required-Stop: $local_fs $network $remote_fs chef-server # Should-Start: $named $time # Should-Stop: $named $time -# Short-Description: Startup script for chef-server-webui +# Short-Description: Startup script for chef-server-webui # Description: Server WebUI component of the Chef systems integration framework. ### END INIT INFO @@ -50,7 +50,7 @@ start() { stop() { echo -n $"Stopping $prog: " - killproc -p $pidfile $prog + killproc -p $pidfile $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile diff --git a/distro/redhat/etc/init.d/chef-solr b/distro/redhat/etc/init.d/chef-solr index b75c40f53f..9223173276 100644 --- a/distro/redhat/etc/init.d/chef-solr +++ b/distro/redhat/etc/init.d/chef-solr @@ -1,5 +1,5 @@ #!/bin/bash -# +# # chef-solr Startup script for the SOLR search engine # # chkconfig: - 94 06 @@ -42,7 +42,7 @@ start() { stop() { echo -n $"Stopping $prog: " - killproc -p $pidfile $prog + killproc -p $pidfile $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile diff --git a/lib/chef/application.rb b/lib/chef/application.rb index 6522ba6e64..fd562d07ba 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -175,7 +175,7 @@ class Chef::Application # Initializes Chef::Client instance and runs it def run_chef_client @chef_client = Chef::Client.new( - @chef_client_json, + @chef_client_json, :override_runlist => config[:override_runlist] ) @chef_client_json = nil diff --git a/lib/chef/application/agent.rb b/lib/chef/application/agent.rb index 353d45252e..66b0c25cbf 100644 --- a/lib/chef/application/agent.rb +++ b/lib/chef/application/agent.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/checksum/storage.rb b/lib/chef/checksum/storage.rb index 90aef57081..4a1b3d38df 100644 --- a/lib/chef/checksum/storage.rb +++ b/lib/chef/checksum/storage.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/checksum/storage/filesystem.rb b/lib/chef/checksum/storage/filesystem.rb index 7500a5ad85..94257f518b 100644 --- a/lib/chef/checksum/storage/filesystem.rb +++ b/lib/chef/checksum/storage/filesystem.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/config.rb b/lib/chef/config.rb index ccf2d9a9aa..f8c284064e 100644 --- a/lib/chef/config.rb +++ b/lib/chef/config.rb @@ -153,7 +153,7 @@ class Chef if self.configuration[:chef_repo_path] derive_path_from_chef_repo_path('cookbooks') else - Array(derive_path_from_chef_repo_path('cookbooks')).flatten + + Array(derive_path_from_chef_repo_path('cookbooks')).flatten + Array(derive_path_from_chef_repo_path('site-cookbooks')).flatten end end diff --git a/lib/chef/cookbook/file_vendor.rb b/lib/chef/cookbook/file_vendor.rb index 38eab185ca..406f23ca25 100644 --- a/lib/chef/cookbook/file_vendor.rb +++ b/lib/chef/cookbook/file_vendor.rb @@ -7,9 +7,9 @@ # 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. @@ -27,14 +27,14 @@ class Chef def self.on_create(&block) @instance_creator = block end - + # Factory method that creates the appropriate kind of # Cookbook::FileVendor to serve the contents of the manifest def self.create_from_manifest(manifest) raise "Must call Chef::Cookbook::FileVendor.on_create before calling create_from_manifest factory" unless defined?(@instance_creator) @instance_creator.call(manifest) end - + # Gets the on-disk location for the given cookbook file. # # Subclasses are responsible for determining exactly how the @@ -42,7 +42,7 @@ class Chef def get_filename(filename) raise NotImplemented, "Subclasses must implement this method" end - + end end end diff --git a/lib/chef/cookbook/syntax_check.rb b/lib/chef/cookbook/syntax_check.rb index 7a59dec737..59888e2ba3 100644 --- a/lib/chef/cookbook/syntax_check.rb +++ b/lib/chef/cookbook/syntax_check.rb @@ -6,9 +6,9 @@ # 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. @@ -127,7 +127,7 @@ class Chef end def untested_template_files - template_files.reject do |file| + template_files.reject do |file| if validated?(file) Chef::Log.debug("Template #{file} is unchanged, skipping syntax check") true diff --git a/lib/chef/daemon.rb b/lib/chef/daemon.rb index 9a3d5a884a..e5479905af 100644 --- a/lib/chef/daemon.rb +++ b/lib/chef/daemon.rb @@ -6,9 +6,9 @@ # 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. @@ -54,7 +54,7 @@ class Chef Chef::Application.fatal!("Chef is already running pid #{pid}") end end - + # Check if Chef is running based on the pid_file # ==== Returns # Boolean:: @@ -73,11 +73,11 @@ class Chef rescue Errno::EACCES => e Chef::Application.fatal!("You don't have access to the PID file at #{pid_file}: #{e.message}") end - + # Check if this process if forked from a Chef daemon # ==== Returns # Boolean:: - # True if this process is forked + # True if this process is forked # False if this process is not forked # def forked? @@ -91,7 +91,7 @@ class Chef false end end - + # Gets the pid file for @name # ==== Returns # String:: @@ -99,7 +99,7 @@ class Chef def pid_file Chef::Config[:pid_file] or "/tmp/#{@name}.pid" end - + # Suck the pid out of pid_file # ==== Returns # Integer:: @@ -112,7 +112,7 @@ class Chef rescue Errno::ENOENT, Errno::EACCES nil end - + # Store the PID on the filesystem # This uses the Chef::Config[:pid_file] option, or "/tmp/name.pid" otherwise # @@ -123,20 +123,20 @@ class Chef rescue Errno::EACCES => e Chef::Application.fatal!("Failed store pid in #{File.dirname(file)}, permission denied: #{e.message}") end - + begin File.open(file, "w") { |f| f.write(Process.pid.to_s) } rescue Errno::EACCES => e Chef::Application.fatal!("Couldn't write to pidfile #{file}, permission denied: #{e.message}") end end - + # Delete the PID from the filesystem def remove_pid_file if not forked? then FileUtils.rm(pid_file) if File.exists?(pid_file) end - end + end # Change process user/group to those specified in Chef::Config # @@ -151,7 +151,7 @@ class Chef _change_privilege(Chef::Config[:user]) end end - + # Change privileges of the process to be the specified user and group # # ==== Parameters @@ -170,14 +170,14 @@ class Chef Chef::Application.fatal!("Failed to get UID for user #{user}, does it exist? #{e.message}") return false end - + begin target_gid = Etc.getgrnam(group).gid rescue ArgumentError => e Chef::Application.fatal!("Failed to get GID for group #{group}, does it exist? #{e.message}") return false end - + if (uid != target_uid) or (gid != target_gid) Process.initgroups(user, target_gid) Process::GID.change_privilege(target_gid) diff --git a/lib/chef/dsl/include_recipe.rb b/lib/chef/dsl/include_recipe.rb index b4d076da10..fc95e38c75 100644 --- a/lib/chef/dsl/include_recipe.rb +++ b/lib/chef/dsl/include_recipe.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/event_dispatch/base.rb b/lib/chef/event_dispatch/base.rb index 494d3cee79..82beefeec9 100644 --- a/lib/chef/event_dispatch/base.rb +++ b/lib/chef/event_dispatch/base.rb @@ -295,7 +295,7 @@ class Chef # Called when a provider makes an assumption after a failed assertion # in whyrun mode, in order to allow execution to continue - def whyrun_assumption(action, resource, message) + def whyrun_assumption(action, resource, message) end ## TODO: deprecation warning. this way we can queue them up and present diff --git a/lib/chef/event_dispatch/dispatcher.rb b/lib/chef/event_dispatch/dispatcher.rb index 82da69a60c..c172a406d8 100644 --- a/lib/chef/event_dispatch/dispatcher.rb +++ b/lib/chef/event_dispatch/dispatcher.rb @@ -23,7 +23,7 @@ class Chef # define the forwarding in one go: # - # Define a method that will be forwarded to all + # Define a method that will be forwarded to all def self.def_forwarding_method(method_name) class_eval(<<-END_OF_METHOD, __FILE__, __LINE__) def #{method_name}(*args) diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb index 300311819f..e403ed9f5b 100644 --- a/lib/chef/formatters/doc.rb +++ b/lib/chef/formatters/doc.rb @@ -188,13 +188,13 @@ class Chef def resource_update_applied(resource, action, update) prefix = Chef::Config[:why_run] ? "Would " : "" Array(update).each do |line| - next if line.nil? + next if line.nil? output_record line if line.kind_of? String @output.color "\n - #{prefix}#{line}", :green - elsif line.kind_of? Array - # Expanded output - delta - # @todo should we have a resource_update_delta callback? + elsif line.kind_of? Array + # Expanded output - delta + # @todo should we have a resource_update_delta callback? line.each do |detail| @output.color "\n #{detail}", :white end @@ -216,7 +216,7 @@ class Chef # Called when a provider makes an assumption after a failed assertion # in whyrun mode, in order to allow execution to continue - def whyrun_assumption(action, resource, message) + def whyrun_assumption(action, resource, message) return unless message [ message ].flatten.each do |line| @output.color("\n * #{line}", :yellow) diff --git a/lib/chef/formatters/error_inspectors/api_error_formatting.rb b/lib/chef/formatters/error_inspectors/api_error_formatting.rb index bb5379ed3f..cb64955961 100644 --- a/lib/chef/formatters/error_inspectors/api_error_formatting.rb +++ b/lib/chef/formatters/error_inspectors/api_error_formatting.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb index 1fa8a70b52..93328adbe3 100644 --- a/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/compile_error_inspector.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb index 054984a50e..56a55a296b 100644 --- a/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb index 7168ac0edb..e257ee30c0 100644 --- a/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb index 9ad56bb70b..6f1f71b8f9 100644 --- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb @@ -7,9 +7,9 @@ # 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. diff --git a/lib/chef/handler/json_file.rb b/lib/chef/handler/json_file.rb index 977c5a2c92..3473db1838 100644 --- a/lib/chef/handler/json_file.rb +++ b/lib/chef/handler/json_file.rb @@ -41,11 +41,11 @@ class Chef build_report_dir savetime = Time.now.strftime("%Y%m%d%H%M%S") File.open(File.join(config[:path], "chef-run-report-#{savetime}.json"), "w") do |file| - + #ensure start time and end time are output in the json properly in the event activesupport happens to be on the system run_data = data run_data[:start_time] = run_data[:start_time].to_s - run_data[:end_time] = run_data[:end_time].to_s + run_data[:end_time] = run_data[:end_time].to_s file.puts Chef::JSONCompat.to_json_pretty(run_data) end diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb index 5b5078b574..285254aef0 100644 --- a/lib/chef/knife/client_create.rb +++ b/lib/chef/knife/client_create.rb @@ -61,7 +61,7 @@ class Chef # We only get a private_key on client creation, not on client update. if client['private_key'] ui.info("Created #{output}") - + if config[:file] File.open(config[:file], "w") do |f| f.print(client['private_key']) diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb index 6132c9dca0..cb8eeb8edf 100644 --- a/lib/chef/knife/cookbook_download.rb +++ b/lib/chef/knife/cookbook_download.rb @@ -7,9 +7,9 @@ # 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. diff --git a/lib/chef/knife/cookbook_metadata_from_file.rb b/lib/chef/knife/cookbook_metadata_from_file.rb index eb1afa8b11..8e26251d6e 100644 --- a/lib/chef/knife/cookbook_metadata_from_file.rb +++ b/lib/chef/knife/cookbook_metadata_from_file.rb @@ -9,9 +9,9 @@ # 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. diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb index 3545d20817..7c9cbebdb1 100644 --- a/lib/chef/knife/cookbook_show.rb +++ b/lib/chef/knife/cookbook_show.rb @@ -6,9 +6,9 @@ # 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. @@ -50,7 +50,7 @@ class Chef :long => "--with-uri", :description => "Show corresponding URIs" - def run + def run case @name_args.length when 4 # We are showing a specific file node = Hash.new diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb index d7a3bfd62c..913d171b3c 100644 --- a/lib/chef/knife/cookbook_site_install.rb +++ b/lib/chef/knife/cookbook_site_install.rb @@ -151,11 +151,11 @@ class Chef ui.info("Removing pre-existing version.") FileUtils.rmtree(cookbook_path) if File.directory?(cookbook_path) end - + def convert_path(upstream_file) if ENV['MSYSTEM'] == 'MINGW32' return upstream_file.sub(/^([[:alpha:]]):/, '/\1') - else + else return Shellwords.escape upstream_file end end diff --git a/lib/chef/knife/cookbook_site_list.rb b/lib/chef/knife/cookbook_site_list.rb index 96c4ef0eed..fe83b71388 100644 --- a/lib/chef/knife/cookbook_site_list.rb +++ b/lib/chef/knife/cookbook_site_list.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/knife/cookbook_site_search.rb b/lib/chef/knife/cookbook_site_search.rb index 5df7d67327..b636276cba 100644 --- a/lib/chef/knife/cookbook_site_search.rb +++ b/lib/chef/knife/cookbook_site_search.rb @@ -5,9 +5,9 @@ # 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. @@ -36,7 +36,7 @@ class Chef end new_start = start + cr["items"].length if new_start < cr["total"] - search_cookbook(query, items, new_start, cookbook_collection) + search_cookbook(query, items, new_start, cookbook_collection) else cookbook_collection end diff --git a/lib/chef/knife/cookbook_site_show.rb b/lib/chef/knife/cookbook_site_show.rb index a02dd61fc8..d15098e915 100644 --- a/lib/chef/knife/cookbook_site_show.rb +++ b/lib/chef/knife/cookbook_site_show.rb @@ -5,9 +5,9 @@ # 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. @@ -27,10 +27,10 @@ class Chef def run output(format_for_display(get_cookbook_data)) end - + def get_cookbook_data case @name_args.length - when 1 + when 1 noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}") when 2 noauth_rest.get_rest("http://cookbooks.opscode.com/api/v1/cookbooks/#{@name_args[0]}/versions/#{name_args[1].gsub('.', '_')}") @@ -45,7 +45,7 @@ class Chef end new_start = start + cr["items"].length if new_start < cr["total"] - get_cookbook_list(items, new_start, cookbook_collection) + get_cookbook_list(items, new_start, cookbook_collection) else cookbook_collection end diff --git a/lib/chef/knife/core/subcommand_loader.rb b/lib/chef/knife/core/subcommand_loader.rb index 2475717441..91c0590121 100644 --- a/lib/chef/knife/core/subcommand_loader.rb +++ b/lib/chef/knife/core/subcommand_loader.rb @@ -6,9 +6,9 @@ # 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. @@ -112,7 +112,7 @@ class Chef check_spec_for_glob(spec, glob) end end.flatten - + files.concat gem_files files.uniq! if check_load_path @@ -133,9 +133,9 @@ class Chef else spec.require_paths.first end - + glob = File.join("#{spec.full_gem_path}/#{dirs}", glob) - + Dir[glob].map { |f| f.untaint } end end diff --git a/lib/chef/knife/data_bag_delete.rb b/lib/chef/knife/data_bag_delete.rb index f8e52018a6..575e9d604d 100644 --- a/lib/chef/knife/data_bag_delete.rb +++ b/lib/chef/knife/data_bag_delete.rb @@ -6,9 +6,9 @@ # 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. @@ -29,7 +29,7 @@ class Chef banner "knife data bag delete BAG [ITEM] (options)" category "data bag" - def run + def run if @name_args.length == 2 delete_object(Chef::DataBagItem, @name_args[1], "data_bag_item") do rest.delete_rest("data/#{@name_args[0]}/#{@name_args[1]}") diff --git a/lib/chef/knife/data_bag_edit.rb b/lib/chef/knife/data_bag_edit.rb index 234c77177d..fb4173b139 100644 --- a/lib/chef/knife/data_bag_edit.rb +++ b/lib/chef/knife/data_bag_edit.rb @@ -7,9 +7,9 @@ # 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. diff --git a/lib/chef/knife/data_bag_list.rb b/lib/chef/knife/data_bag_list.rb index 31dcf984f6..5e556b60bc 100644 --- a/lib/chef/knife/data_bag_list.rb +++ b/lib/chef/knife/data_bag_list.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/knife/data_bag_show.rb b/lib/chef/knife/data_bag_show.rb index 81b1425f78..435763b0b0 100644 --- a/lib/chef/knife/data_bag_show.rb +++ b/lib/chef/knife/data_bag_show.rb @@ -7,9 +7,9 @@ # 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. diff --git a/lib/chef/knife/environment_from_file.rb b/lib/chef/knife/environment_from_file.rb index af72f84622..3812024c9c 100644 --- a/lib/chef/knife/environment_from_file.rb +++ b/lib/chef/knife/environment_from_file.rb @@ -62,7 +62,7 @@ class Chef ui.info("Updated Environment #{updated.name}") end - + def run if config[:all] == true load_all_environments @@ -72,7 +72,7 @@ class Chef ui.fatal("You must specify a file to load") exit 1 end - + @name_args.each do |arg| load_environment(arg) end diff --git a/lib/chef/knife/index_rebuild.rb b/lib/chef/knife/index_rebuild.rb index 3e97c7751b..4b9fcdd159 100644 --- a/lib/chef/knife/index_rebuild.rb +++ b/lib/chef/knife/index_rebuild.rb @@ -40,7 +40,7 @@ class Chef nag output rest.post_rest("/search/reindex", {}) end - + end def grab_api_info @@ -55,7 +55,7 @@ class Chef r = exception.response parse_api_info(r) end - + # Only Chef 11+ servers will have version information in their # headers, and only those servers will lack an API endpoint for # index rebuilding. diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index ba6b9ae0e1..e1090fcca0 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -147,7 +147,7 @@ class Chef @action_nodes = q.search(:node, @name_args[0])[0] @action_nodes.each do |item| # we should skip the loop to next iteration if the item returned by the search is nil - next if item.nil? + next if item.nil? # if a command line attribute was not passed, and we have a cloud public_hostname, use that. # see #configure_attribute for the source of config[:attribute] and config[:override_attribute] if !config[:override_attribute] && item[:cloud] and item[:cloud][:public_hostname] @@ -397,7 +397,7 @@ class Chef # Thus we can differentiate between a config file value and a command line override at this point by checking config[:attribute] # We can tell here if fqdn was passed from the command line, rather than being the default, by checking config[:attribute] # However, after here, we cannot tell these things, so we must preserve config[:attribute] - config[:override_attribute] = config[:attribute] || Chef::Config[:knife][:ssh_attribute] + config[:override_attribute] = config[:attribute] || Chef::Config[:knife][:ssh_attribute] config[:attribute] = (Chef::Config[:knife][:ssh_attribute] || config[:attribute] || "fqdn").strip diff --git a/lib/chef/mixin/checksum.rb b/lib/chef/mixin/checksum.rb index 8217296915..1d9c99ec7e 100644 --- a/lib/chef/mixin/checksum.rb +++ b/lib/chef/mixin/checksum.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/mixin/command.rb b/lib/chef/mixin/command.rb index 719151a6b6..2cc25e149e 100644 --- a/lib/chef/mixin/command.rb +++ b/lib/chef/mixin/command.rb @@ -6,9 +6,9 @@ # 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. @@ -41,23 +41,23 @@ class Chef # === Parameters # args<Hash>: A number of required and optional arguments - # command<String>, <Array>: A complete command with options to execute or a command and options as an Array + # command<String>, <Array>: A complete command with options to execute or a command and options as an Array # creates<String>: The absolute path to a file that prevents the command from running if it exists # cwd<String>: Working directory to execute command in, defaults to Dir.tmpdir # timeout<String>: How many seconds to wait for the command to execute before timing out # returns<String>: The single exit value command is expected to return, otherwise causes an exception # ignore_failure<Boolean>: Whether to raise an exception on failure, or just return the status # output_on_failure<Boolean>: Return output in raised exception regardless of Log.level - # + # # user<String>: The UID or user name of the user to execute the command as # group<String>: The GID or group name of the group to execute the command as # environment<Hash>: Pairs of environment variable names and their values to set before execution # # === Returns # Returns the exit status of args[:command] - def run_command(args={}) + def run_command(args={}) status, stdout, stderr = run_command_and_return_stdout_stderr(args) - + status end @@ -77,7 +77,7 @@ class Chef return false end end - + status, stdout, stderr = output_of_command(args[:command], args) command_output << "STDOUT: #{stdout}" command_output << "STDERR: #{stderr}" @@ -89,16 +89,16 @@ class Chef def output_of_command(command, args) Chef::Log.debug("Executing #{command}") stderr_string, stdout_string, status = "", "", nil - + exec_processing_block = lambda do |pid, stdin, stdout, stderr| stdout_string, stderr_string = stdout.string.chomp, stderr.string.chomp end - + args[:cwd] ||= Dir.tmpdir unless ::File.directory?(args[:cwd]) raise Chef::Exceptions::Exec, "#{args[:cwd]} does not exist or is not a directory" end - + Dir.chdir(args[:cwd]) do if args[:timeout] begin @@ -112,17 +112,17 @@ class Chef else status = popen4(command, args, &exec_processing_block) end - + Chef::Log.debug("---- Begin output of #{command} ----") Chef::Log.debug("STDOUT: #{stdout_string}") Chef::Log.debug("STDERR: #{stderr_string}") Chef::Log.debug("---- End output of #{command} ----") Chef::Log.debug("Ran #{command} returned #{status.exitstatus}") end - + return status, stdout_string, stderr_string end - + def handle_command_failures(status, command_output, opts={}) unless opts[:ignore_failure] opts[:returns] ||= 0 @@ -138,7 +138,7 @@ class Chef end end end - + # Call #run_command but set LC_ALL to the system's current environment so it doesn't get changed to C. # # === Parameters diff --git a/lib/chef/mixin/convert_to_class_name.rb b/lib/chef/mixin/convert_to_class_name.rb index 7b4ec7ad3f..ece16990a1 100644 --- a/lib/chef/mixin/convert_to_class_name.rb +++ b/lib/chef/mixin/convert_to_class_name.rb @@ -7,9 +7,9 @@ # 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. @@ -27,20 +27,20 @@ class Chef str.gsub!(/[^A-Za-z0-9_]/,'_') rname = nil regexp = %r{^(.+?)(_(.+))?$} - + mn = str.match(regexp) if mn rname = mn[1].capitalize while mn && mn[3] - mn = mn[3].match(regexp) + mn = mn[3].match(regexp) rname << mn[1].capitalize if mn end end rname end - + def convert_to_snake_case(str, namespace=nil) str = str.dup str.sub!(/^#{namespace}(\:\:)?/, '') if namespace @@ -49,17 +49,17 @@ class Chef str.sub!(/^\_/, "") str end - + def snake_case_basename(str) with_namespace = convert_to_snake_case(str) with_namespace.split("::").last.sub(/^_/, '') end - + def filename_to_qualified_string(base, filename) file_base = File.basename(filename, ".rb") base.to_s + (file_base == 'default' ? '' : "_#{file_base}") end - + end end end diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb index 9b5dba14f2..9d1248e907 100644 --- a/lib/chef/mixin/create_path.rb +++ b/lib/chef/mixin/create_path.rb @@ -6,9 +6,9 @@ # 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. @@ -18,21 +18,21 @@ class Chef module Mixin module CreatePath - + # Creates a given path, including all directories that lead up to it. # Like mkdir_p, but without the leaking. # # === Parameters - # file_path<String, Array>:: A string that represents the path to create, + # file_path<String, Array>:: A string that represents the path to create, # or an Array with the path-parts. # # === Returns # The created file_path. def create_path(file_path) unless file_path.kind_of?(String) || file_path.kind_of?(Array) - raise ArgumentError, "file_path must be a string or an array!" + raise ArgumentError, "file_path must be a string or an array!" end - + if file_path.kind_of?(String) file_path = File.expand_path(file_path).split(File::SEPARATOR) file_path.shift if file_path[0] == '' @@ -41,17 +41,17 @@ class Chef file_path[0] = "#{File::SEPARATOR}#{file_path[0]}" end end - + file_path.each_index do |i| create_path = File.join(file_path[0, i + 1]) unless File.directory?(create_path) Chef::Log.debug("Creating directory #{create_path}") Dir.mkdir(create_path) - end + end end File.expand_path(File.join(file_path)) end - + end end end diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb index 1f2125be01..9fa86948b6 100644 --- a/lib/chef/mixin/deep_merge.rb +++ b/lib/chef/mixin/deep_merge.rb @@ -8,9 +8,9 @@ # 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. diff --git a/lib/chef/mixin/from_file.rb b/lib/chef/mixin/from_file.rb index 609fe1de55..0d1ddca4fa 100644 --- a/lib/chef/mixin/from_file.rb +++ b/lib/chef/mixin/from_file.rb @@ -7,9 +7,9 @@ # 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. @@ -20,9 +20,9 @@ class Chef module Mixin module FromFile - - # Loads a given ruby file, and runs instance_eval against it in the context of the current - # object. + + # Loads a given ruby file, and runs instance_eval against it in the context of the current + # object. # # Raises an IOError if the file cannot be found, or is not readable. def from_file(filename) @@ -33,7 +33,7 @@ class Chef end end - # Loads a given ruby file, and runs class_eval against it in the context of the current + # Loads a given ruby file, and runs class_eval against it in the context of the current # object. # # Raises an IOError if the file cannot be found, or is not readable. diff --git a/lib/chef/mixin/language_include_recipe.rb b/lib/chef/mixin/language_include_recipe.rb index b534b6628f..d85e5c682d 100644 --- a/lib/chef/mixin/language_include_recipe.rb +++ b/lib/chef/mixin/language_include_recipe.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/mixin/params_validate.rb b/lib/chef/mixin/params_validate.rb index a9822df134..a9799f749c 100644 --- a/lib/chef/mixin/params_validate.rb +++ b/lib/chef/mixin/params_validate.rb @@ -6,9 +6,9 @@ # 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. @@ -20,7 +20,7 @@ class Chef end module Mixin module ParamsValidate - + # Takes a hash of options, along with a map to validate them. Returns the original # options hash, plus any changes that might have been made (through things like setting # default values in the validation map) @@ -28,19 +28,19 @@ class Chef # For example: # # validate({ :one => "neat" }, { :one => { :kind_of => String }}) - # + # # Would raise an exception if the value of :one above is not a kind_of? string. Valid # map options are: # # :default:: Sets the default value for this parameter. - # :callbacks:: Takes a hash of Procs, which should return true if the argument is valid. + # :callbacks:: Takes a hash of Procs, which should return true if the argument is valid. # The key will be inserted into the error message if the Proc does not return true: # "Option #{key}'s value #{value} #{message}!" - # :kind_of:: Ensure that the value is a kind_of?(Whatever). If passed an array, it will ensure + # :kind_of:: Ensure that the value is a kind_of?(Whatever). If passed an array, it will ensure # that the value is one of those types. # :respond_to:: Ensure that the value has a given method. Takes one method name or an array of # method names. - # :required:: Raise an exception if this parameter is missing. Valid values are true or false, + # :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 @@ -48,12 +48,12 @@ class Chef def validate(opts, map) #-- # validate works by taking the keys in the validation map, assuming it's a hash, and - # looking for _pv_:symbol as methods. Assuming it find them, it calls the right - # one. + # looking for _pv_:symbol as methods. Assuming it find them, it calls the right + # one. #++ raise ArgumentError, "Options must be a hash" unless opts.kind_of?(Hash) - raise ArgumentError, "Validation Map must be a hash" unless map.kind_of?(Hash) - + raise ArgumentError, "Validation Map must be a hash" unless map.kind_of?(Hash) + map.each do |key, validation| unless key.kind_of?(Symbol) || key.kind_of?(String) raise ArgumentError, "Validation map keys must be symbols or strings!" @@ -76,7 +76,7 @@ class Chef end opts end - + def lazy(&block) DelayedEvaluator.new(&block) end @@ -99,9 +99,9 @@ class Chef self.instance_variable_set(iv_symbol, val) end end - + private - + # Return the value of a parameter, or nil if it doesn't exist. def _pv_opts_lookup(opts, key) if opts.has_key?(key.to_s) @@ -112,7 +112,7 @@ class Chef nil end end - + # Raise an exception if the parameter is not found. def _pv_required(opts, key, is_required=true) if is_required @@ -124,7 +124,7 @@ class Chef end end end - + def _pv_equal_to(opts, key, to_be) value = _pv_opts_lookup(opts, key) unless value.nil? @@ -137,7 +137,7 @@ class Chef end end end - + # Raise an exception if the parameter is not a kind_of?(to_be) def _pv_kind_of(opts, key, to_be) value = _pv_opts_lookup(opts, key) @@ -151,7 +151,7 @@ class Chef end end end - + # Raise an exception if the parameter does not respond to a given set of methods. def _pv_respond_to(opts, key, method_name_list) value = _pv_opts_lookup(opts, key) @@ -181,7 +181,7 @@ class Chef end end end - + # Assign a default value to a parameter. def _pv_default(opts, key, default_value) value = _pv_opts_lookup(opts, key) @@ -189,7 +189,7 @@ class Chef opts[key] = default_value end end - + # Check a parameter against a regular expression. def _pv_regex(opts, key, regex) value = _pv_opts_lookup(opts, key) @@ -207,7 +207,7 @@ class Chef end end end - + # Check a parameter against a hash of proc's. def _pv_callbacks(opts, key, callbacks) raise ArgumentError, "Callback list must be a hash!" unless callbacks.kind_of?(Hash) diff --git a/lib/chef/mixin/why_run.rb b/lib/chef/mixin/why_run.rb index 788e2fe2bc..2fefaad424 100644 --- a/lib/chef/mixin/why_run.rb +++ b/lib/chef/mixin/why_run.rb @@ -178,7 +178,7 @@ class Chef # when the requirement is not met and Chef is executing in why run # mode # - # If no failure_message is provided (above), then execution + # If no failure_message is provided (above), then execution # will be allowed to continue in both whyrun an dnon-whyrun # mode # @@ -196,16 +196,16 @@ class Chef @resource_modifier = resource_modifier end - # Prevents associated actions from being invoked in whyrun mode. - # This will also stop further processing of assertions for a given action. - # - # An example from the template provider: if the source template doesn't exist - # we can't parse it in the action_create block of template - something that we do - # even in whyrun mode. Because the soruce template may have been created in an earlier + # Prevents associated actions from being invoked in whyrun mode. + # This will also stop further processing of assertions for a given action. + # + # An example from the template provider: if the source template doesn't exist + # we can't parse it in the action_create block of template - something that we do + # even in whyrun mode. Because the soruce template may have been created in an earlier # step, we still want to keep going in whyrun mode. - # + # # assert(:create, :create_if_missing) do |a| - # a.assertion { File::exists?(@new_resource.source) } + # a.assertion { File::exists?(@new_resource.source) } # a.whyrun "Template source file does not exist, assuming it would have been created." # a.block_action! # end @@ -214,7 +214,7 @@ class Chef @block_action = true end - def block_action? + def block_action? @block_action end @@ -258,7 +258,7 @@ class Chef # Check to see if a given action is blocked by a failed assertion # # Takes the action name to be verified. - def action_blocked?(action) + def action_blocked?(action) @blocked_actions.include?(action) end @@ -296,9 +296,9 @@ class Chef # "You don't have sufficient privileges to delete #{@new_resource.path}") # end # - # A Template provider that will prevent action execution but continue the run in + # A Template provider that will prevent action execution but continue the run in # whyrun mode if the template source is not available. - # assert(:create, :create_if_missing) do |a| + # assert(:create, :create_if_missing) do |a| # a.assertion { File::exist?(@new_resource.source) } # a.failure_message Chef::Exceptions::TemplateError, "Template #{@new_resource.source} could not be found exist." # a.whyrun "Template source #{@new_resource.source} does not exist. Assuming it would have been created." @@ -318,9 +318,9 @@ class Chef # Run the assertion and assumption logic. def run(action) - @assertions[action.to_sym].each do |a| + @assertions[action.to_sym].each do |a| a.run(action, events, @resource) - if a.assertion_failed? and a.block_action? + if a.assertion_failed? and a.block_action? @blocked_actions << action return end diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb index 38c08e236d..c13278693f 100644 --- a/lib/chef/mixin/windows_architecture_helper.rb +++ b/lib/chef/mixin/windows_architecture_helper.rb @@ -6,9 +6,9 @@ # 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. @@ -17,7 +17,7 @@ # -require 'chef/exceptions' +require 'chef/exceptions' require 'win32/api' if Chef::Platform.windows? class Chef @@ -32,7 +32,7 @@ class Chef is_i386_windows_process? && node_windows_architecture(node) == :x86_64 && desired_architecture == :x86_64 - end + end def node_supports_windows_architecture?(node, desired_architecture) assert_valid_windows_architecture!(desired_architecture) @@ -85,7 +85,7 @@ class Chef end end end - + end end end diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb index dac2f0c6af..ceb45df3e6 100644 --- a/lib/chef/mixin/xml_escape.rb +++ b/lib/chef/mixin/xml_escape.rb @@ -7,9 +7,9 @@ # 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. @@ -18,26 +18,26 @@ #-- # Portions of this code are adapted from Sam Ruby's xchar.rb -# http://intertwingly.net/stories/2005/09/28/xchar.rb +# http://intertwingly.net/stories/2005/09/28/xchar.rb # # Such code appears here under Sam's original MIT license, while portions of # this file are covered by the above Apache License. For a completely MIT # licensed version, please see Sam's original. # # Thanks, Sam! -# -# Copyright (c) 2005, Sam Ruby -# +# +# Copyright (c) 2005, Sam Ruby +# # 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 @@ -99,7 +99,7 @@ class Chef } # http://www.w3.org/TR/REC-xml/#charsets - VALID = [[0x9, 0xA, 0xD], (0x20..0xD7FF), + VALID = [[0x9, 0xA, 0xD], (0x20..0xD7FF), (0xE000..0xFFFD), (0x10000..0x10FFFF)] def xml_escape(unescaped_str) @@ -118,7 +118,7 @@ class Chef char = PREDEFINED[char] || (char<128 ? char.chr : "&##{char};") end end - + module FastXS extend self diff --git a/lib/chef/monkey_patches/numeric.rb b/lib/chef/monkey_patches/numeric.rb index 1f5ff14209..f4612fdbf3 100644 --- a/lib/chef/monkey_patches/numeric.rb +++ b/lib/chef/monkey_patches/numeric.rb @@ -8,7 +8,7 @@ end # String elements referenced with [] <= 1.8.6 return a Fixnum. Cheat to allow # for the simpler "test"[2].ord construct -class Numeric +class Numeric def ord return self end diff --git a/lib/chef/monkey_patches/regexp.rb b/lib/chef/monkey_patches/regexp.rb index 9304209edf..8a7ee77cb5 100644 --- a/lib/chef/monkey_patches/regexp.rb +++ b/lib/chef/monkey_patches/regexp.rb @@ -1,5 +1,5 @@ # 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 @@ -7,10 +7,10 @@ # 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 @@ -31,4 +31,4 @@ class Regexp end end end -end
\ No newline at end of file +end diff --git a/lib/chef/monkey_patches/string.rb b/lib/chef/monkey_patches/string.rb index c77c5c8816..f91e27ddc5 100644 --- a/lib/chef/monkey_patches/string.rb +++ b/lib/chef/monkey_patches/string.rb @@ -6,9 +6,9 @@ # 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. @@ -39,7 +39,7 @@ class String end end -# <= 1.8.6 needs some ord! +# <= 1.8.6 needs some ord! class String unless method_defined?(:ord) def ord diff --git a/lib/chef/monkey_patches/tempfile.rb b/lib/chef/monkey_patches/tempfile.rb index 3135fb1a00..b9179f182b 100644 --- a/lib/chef/monkey_patches/tempfile.rb +++ b/lib/chef/monkey_patches/tempfile.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index a417406721..66569cf0e1 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -243,7 +243,7 @@ class Chef end # Clears merged_attributes, which will cause it to be recomputed on the - # next access. + # next access. def reset_cache @merged_attributes = nil @combined_default = nil diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index f32c5479b4..a252bdc100 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -345,7 +345,7 @@ class Chef :mount => Chef::Provider::Mount::Aix, :ifconfig => Chef::Provider::Ifconfig::Aix, :cron => Chef::Provider::Cron::Aix, - :package => Chef::Provider::Package::Aix + :package => Chef::Provider::Package::Aix } }, :default => { diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb index e4b35b64f3..354a640e59 100644 --- a/lib/chef/provider/batch.rb +++ b/lib/chef/provider/batch.rb @@ -6,9 +6,9 @@ # 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. @@ -29,7 +29,7 @@ class Chef def flags @new_resource.flags.nil? ? '/c' : new_resource.flags + ' /c' end - + end end end diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb index 4430e3e18f..f6f062a410 100644 --- a/lib/chef/provider/cron.rb +++ b/lib/chef/provider/cron.rb @@ -40,7 +40,7 @@ class Chef def whyrun_supported? true end - + def load_current_resource crontab_lines = [] @current_resource = Chef::Resource::Cron.new(@new_resource.name) @@ -82,7 +82,7 @@ class Chef @current_resource end - + def cron_different? CRON_ATTRIBUTES.any? do |cron_var| !@new_resource.send(cron_var).nil? && @new_resource.send(cron_var) != @current_resource.send(cron_var) @@ -165,7 +165,7 @@ class Chef end crontab << line end - description = cron_found ? "remove #{@new_resource.name} from crontab" : + description = cron_found ? "remove #{@new_resource.name} from crontab" : "save unmodified crontab" converge_by(description) do write_crontab crontab diff --git a/lib/chef/provider/cron/solaris.rb b/lib/chef/provider/cron/solaris.rb index 6861820676..20fa7abcce 100644 --- a/lib/chef/provider/cron/solaris.rb +++ b/lib/chef/provider/cron/solaris.rb @@ -19,4 +19,4 @@ require "chef/provider/cron/unix" # Just to create an alias so 'Chef::Provider::Cron::Solaris' is exposed and accessible to existing consumers of class. -Chef::Provider::Cron::Solaris = Chef::Provider::Cron::Unix
\ No newline at end of file +Chef::Provider::Cron::Solaris = Chef::Provider::Cron::Unix diff --git a/lib/chef/provider/cron/unix.rb b/lib/chef/provider/cron/unix.rb index 1149f43f76..5cb1bcda41 100644 --- a/lib/chef/provider/cron/unix.rb +++ b/lib/chef/provider/cron/unix.rb @@ -63,7 +63,7 @@ class Chef Chef::Log.debug(e.message) exit_status = 1 error_message = e.message - end + end tempcron.close! if exit_status > 0 raise Chef::Exceptions::Cron, "Error updating state of #{@new_resource.name}, exit: #{exit_status}, message: #{error_message}" diff --git a/lib/chef/provider/deploy/timestamped.rb b/lib/chef/provider/deploy/timestamped.rb index 9c2d55b490..ce921161e0 100644 --- a/lib/chef/provider/deploy/timestamped.rb +++ b/lib/chef/provider/deploy/timestamped.rb @@ -6,9 +6,9 @@ # 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. @@ -20,9 +20,9 @@ class Chef class Provider class Deploy class Timestamped < Chef::Provider::Deploy - + protected - + def release_slug Time.now.utc.strftime("%Y%m%d%H%M%S") end diff --git a/lib/chef/provider/erl_call.rb b/lib/chef/provider/erl_call.rb index 1ee1da500c..cdd494a243 100644 --- a/lib/chef/provider/erl_call.rb +++ b/lib/chef/provider/erl_call.rb @@ -32,7 +32,7 @@ class Chef def whyrun_supported? true end - + def load_current_resource true end diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 8d2a7d997d..2907688e88 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -29,7 +29,7 @@ class Chef def load_current_resource true end - + def whyrun_supported? true end @@ -56,7 +56,7 @@ class Chef if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? opts[:live_stream] = STDOUT end - converge_by("execute #{@new_resource.command}") do + converge_by("execute #{@new_resource.command}") do result = shell_out!(@new_resource.command, opts) Chef::Log.info("#{@new_resource} ran successfully") end diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb index c941ed72bd..eacb033492 100644 --- a/lib/chef/provider/group.rb +++ b/lib/chef/provider/group.rb @@ -6,9 +6,9 @@ # 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. @@ -35,11 +35,11 @@ class Chef super @group_exists = true end - + def load_current_resource @current_resource = Chef::Resource::Group.new(@new_resource.name) @current_resource.group_name(@new_resource.group_name) - + group_info = nil begin group_info = Etc.getgrnam(@new_resource.group_name) @@ -47,26 +47,26 @@ class Chef @group_exists = false Chef::Log.debug("#{@new_resource} group does not exist") end - + if group_info @new_resource.gid(group_info.gid) unless @new_resource.gid @current_resource.gid(group_info.gid) @current_resource.members(group_info.mem) end - + @current_resource end def define_resource_requirements - requirements.assert(:modify) do |a| - a.assertion { @group_exists } + requirements.assert(:modify) do |a| + a.assertion { @group_exists } a.failure_message(Chef::Exceptions::Group, "Cannot modify #{@new_resource} - group does not exist!") a.whyrun("Group #{@new_resource} does not exist. Unless it would have been created earlier in this run, this attempt to modify it would fail.") end end - - # Check to see if a group needs any changes. Populate - # @change_desc with a description of why a change must occur + + # Check to see if a group needs any changes. Populate + # @change_desc with a description of why a change must occur # # ==== Returns # <true>:: If a change is required @@ -77,7 +77,7 @@ class Chef @change_desc = "change gid #{@current_resource.gid} to #{@new_resource.gid}" return true end - + if(@new_resource.append) missing_members = [] @new_resource.members.each do |member| @@ -96,24 +96,24 @@ class Chef end return false end - + def action_create case @group_exists when false - converge_by("create #{@new_resource}") do + converge_by("create #{@new_resource}") do create_group Chef::Log.info("#{@new_resource} created") end - else + else if compare_group - converge_by(["alter group #{@new_resource}", @change_desc ]) do + converge_by(["alter group #{@new_resource}", @change_desc ]) do manage_group Chef::Log.info("#{@new_resource} altered") end end end end - + def action_remove if @group_exists converge_by("remove group #{@new_resource}") do @@ -122,16 +122,16 @@ class Chef end end end - + def action_manage if @group_exists && compare_group converge_by(["manage group #{@new_resource}", @change_desc]) do - manage_group + manage_group Chef::Log.info("#{@new_resource} managed") end end end - + def action_modify if compare_group converge_by(["modify group #{@new_resource}", @change_desc]) do @@ -140,7 +140,7 @@ class Chef end end end - + def create_group raise NotImplementedError, "subclasses of Chef::Provider::Group should define #create_group" end diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb index a8ba32641c..d0b2a4d499 100644 --- a/lib/chef/provider/group/dscl.rb +++ b/lib/chef/provider/group/dscl.rb @@ -6,9 +6,9 @@ # 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. @@ -38,7 +38,7 @@ class Chef raise(Chef::Exceptions::Group,"dscl error: #{result.inspect}") if result[2] =~ /No such key: / return result[2] end - + # This is handled in providers/group.rb by Etc.getgrnam() # def group_exists?(group) # groups = safe_dscl("list /Groups") @@ -86,8 +86,8 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/bin/dscl") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/bin/dscl") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/dscl for #{@new_resource.name}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end @@ -96,13 +96,13 @@ class Chef def load_current_resource super end - + def create_group dscl_create_group set_gid set_members end - + def manage_group if @new_resource.group_name && (@current_resource.group_name != @new_resource.group_name) dscl_create_group @@ -114,12 +114,12 @@ class Chef set_members end end - + def dscl_create_group safe_dscl("create /Groups/#{@new_resource.group_name}") safe_dscl("create /Groups/#{@new_resource.group_name} Password '*'") end - + def remove_group safe_dscl("delete /Groups/#{@new_resource.group_name}") end diff --git a/lib/chef/provider/group/gpasswd.rb b/lib/chef/provider/group/gpasswd.rb index 7fb27a7777..2638b82383 100644 --- a/lib/chef/provider/group/gpasswd.rb +++ b/lib/chef/provider/group/gpasswd.rb @@ -6,9 +6,9 @@ # 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. @@ -32,9 +32,9 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/bin/gpasswd") } - a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/gpasswd for #{@new_resource}" + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/bin/gpasswd") } + a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/gpasswd for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb index 544fee4304..abf5375f8b 100644 --- a/lib/chef/provider/group/groupadd.rb +++ b/lib/chef/provider/group/groupadd.rb @@ -6,9 +6,9 @@ # 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. @@ -20,7 +20,7 @@ class Chef class Provider class Group class Groupadd < Chef::Provider::Group - + def required_binaries [ "/usr/sbin/groupadd", "/usr/sbin/groupmod", @@ -34,9 +34,9 @@ class Chef def define_resource_requirements super required_binaries.each do |required_binary| - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?(required_binary) } - a.failure_message Chef::Exceptions::Group, "Could not find binary #{required_binary} for #{@new_resource}" + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?(required_binary) } + a.failure_message Chef::Exceptions::Group, "Could not find binary #{required_binary} for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end @@ -48,9 +48,9 @@ class Chef command << set_options command << groupadd_options run_command(:command => command) - modify_group_members + modify_group_members end - + # Manage the group when it already exists def manage_group command = "groupmod" @@ -58,12 +58,12 @@ class Chef run_command(:command => command) modify_group_members end - + # Remove the group def remove_group run_command(:command => "groupdel #{@new_resource.group_name}") end - + def modify_group_members raise Chef::Exceptions::Group, "you must override modify_group_members in #{self.to_s}" end diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb index 3bf67a515a..66da8281be 100644 --- a/lib/chef/provider/group/pw.rb +++ b/lib/chef/provider/group/pw.rb @@ -6,9 +6,9 @@ # 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. @@ -20,21 +20,21 @@ class Chef class Provider class Group class Pw < Chef::Provider::Group - + def load_current_resource super end - + def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/pw") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/pw") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/pw for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end - + # Create the group def create_group command = "pw groupadd" @@ -42,7 +42,7 @@ class Chef command << set_members_option run_command(:command => command) end - + # Manage the group when it already exists def manage_group command = "pw groupmod" @@ -50,12 +50,12 @@ class Chef command << set_members_option run_command(:command => command) end - + # Remove the group def remove_group run_command(:command => "pw groupdel #{@new_resource.group_name}") end - + # Little bit of magic as per Adam's useradd provider to pull and assign the command line flags # # ==== Returns @@ -86,7 +86,7 @@ class Chef end opt end - + end end end diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb index 0b66c1f912..4c343bddf9 100644 --- a/lib/chef/provider/group/suse.rb +++ b/lib/chef/provider/group/suse.rb @@ -6,9 +6,9 @@ # 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. @@ -32,8 +32,8 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/groupmod") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/groupmod") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/groupmod for #{@new_resource.name}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb index 8daf9c7fff..5788ac8fad 100644 --- a/lib/chef/provider/group/usermod.rb +++ b/lib/chef/provider/group/usermod.rb @@ -6,9 +6,9 @@ # 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. @@ -22,7 +22,7 @@ class Chef class Provider class Group class Usermod < Chef::Provider::Group::Groupadd - + def load_current_resource super end @@ -30,19 +30,19 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/usermod") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/usermod") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/usermod for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end requirements.assert(:modify, :create) do |a| - a.assertion { @new_resource.members.empty? || @new_resource.append } + a.assertion { @new_resource.members.empty? || @new_resource.append } a.failure_message Chef::Exceptions::Group, "setting group members directly is not supported by #{self.to_s}, must set append true in group" # No whyrun alternative - this action is simply not supported. end end - + def modify_group_members case node[:platform] when "openbsd", "netbsd", "aix", "solaris2", "smartos" diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb index 3a354bb5c6..31f88e5406 100644 --- a/lib/chef/provider/ifconfig.rb +++ b/lib/chef/provider/ifconfig.rb @@ -26,11 +26,11 @@ require 'erb' # # int = {Hash with your network settings...} # -# ifconfig int['ip'] do -# ignore_failure true -# device int['dev'] -# mask int['mask'] -# gateway int['gateway'] +# ifconfig int['ip'] do +# ignore_failure true +# device int['dev'] +# mask int['mask'] +# gateway int['gateway'] # mtu int['mtu'] # end @@ -89,12 +89,12 @@ class Chef @current_resource end - def define_resource_requirements - requirements.assert(:all_actions) do |a| + def define_resource_requirements + requirements.assert(:all_actions) do |a| a.assertion { @status.exitstatus == 0 } a.failure_message Chef::Exceptions::Ifconfig, "ifconfig failed - #{@status.inspect}!" # no whyrun - if the base ifconfig used in load_current_resource fails - # there's no reasonable action that could have been taken in the course of + # there's no reasonable action that could have been taken in the course of # a chef run to fix it. end end @@ -215,7 +215,7 @@ class Chef def delete_command "ifconfig #{@new_resource.device} down" end - + def loopback_device 'lo' end diff --git a/lib/chef/provider/log.rb b/lib/chef/provider/log.rb index 927ee72fcc..1c970cc888 100644 --- a/lib/chef/provider/log.rb +++ b/lib/chef/provider/log.rb @@ -6,9 +6,9 @@ # 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. @@ -32,7 +32,7 @@ class Chef def load_current_resource true end - + # Write the log to Chef's log # # === Return diff --git a/lib/chef/provider/mdadm.rb b/lib/chef/provider/mdadm.rb index d93ff69c13..c1a7dab2c4 100644 --- a/lib/chef/provider/mdadm.rb +++ b/lib/chef/provider/mdadm.rb @@ -47,7 +47,7 @@ class Chef def action_create unless @current_resource.exists - converge_by("create RAID device #{new_resource.raid_device}") do + converge_by("create RAID device #{new_resource.raid_device}") do command = "yes | mdadm --create #{@new_resource.raid_device} --chunk=#{@new_resource.chunk} --level #{@new_resource.level}" command << " --metadata=#{@new_resource.metadata}" command << " --bitmap=#{@new_resource.bitmap}" if @new_resource.bitmap @@ -63,7 +63,7 @@ class Chef def action_assemble unless @current_resource.exists - converge_by("assemble RAID device #{new_resource.raid_device}") do + converge_by("assemble RAID device #{new_resource.raid_device}") do command = "yes | mdadm --assemble #{@new_resource.raid_device} #{@new_resource.devices.join(" ")}" Chef::Log.debug("#{@new_resource} mdadm command: #{command}") shell_out!(command) @@ -76,7 +76,7 @@ class Chef def action_stop if @current_resource.exists - converge_by("stop RAID device #{new_resource.raid_device}") do + converge_by("stop RAID device #{new_resource.raid_device}") do command = "yes | mdadm --stop #{@new_resource.raid_device}" Chef::Log.debug("#{@new_resource} mdadm command: #{command}") shell_out!(command) diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index 6b9dd91ac8..5f58baa396 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -6,9 +6,9 @@ # 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. @@ -37,7 +37,7 @@ class Chef def action_mount unless @current_resource.mounted - converge_by("mount #{@current_resource.device} to #{@current_resource.mount_point}") do + converge_by("mount #{@current_resource.device} to #{@current_resource.mount_point}") do status = mount_fs() if status Chef::Log.info("#{@new_resource} mounted") @@ -50,7 +50,7 @@ class Chef def action_umount if @current_resource.mounted - converge_by("unmount #{@current_resource.device}") do + converge_by("unmount #{@current_resource.device}") do status = umount_fs() if status Chef::Log.info("#{@new_resource} unmounted") @@ -66,7 +66,7 @@ class Chef raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount" else if @current_resource.mounted - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = remount_fs() if status Chef::Log.info("#{@new_resource} remounted") @@ -80,7 +80,7 @@ class Chef def action_enable unless @current_resource.enabled && mount_options_unchanged? - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = enable_fs if status Chef::Log.info("#{@new_resource} enabled") @@ -93,7 +93,7 @@ class Chef def action_disable if @current_resource.enabled - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = disable_fs if status Chef::Log.info("#{@new_resource} disabled") @@ -115,14 +115,14 @@ class Chef def remount_fs raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount" end - + def enable_fs - raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :enable" + raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :enable" end - + def disable_fs - raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable" - end + raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable" + end end end end diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 128bb4c6c3..0d7e11a1b8 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -1,5 +1,5 @@ # -# Author:: +# Author:: # Copyright:: Copyright (c) 2009 Opscode, Inc # License:: Apache License, Version 2.0 # @@ -38,7 +38,7 @@ class Chef def enabled? # Check to see if there is an entry in /etc/filesystems. Last entry for a volume wins. Using command "lsfs" to fetch entries. enabled = false - + # lsfs o/p = #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct # search only for current mount point shell_out("lsfs -c #{@new_resource.mount_point}").stdout.each_line do | line | @@ -74,8 +74,8 @@ class Chef device_details = device_fstab.split(":") search_device = device_details[1] else - search_device = device_fstab_regex - end + search_device = device_fstab_regex + end case line when /#{search_device}\s+#{Regexp.escape(@new_resource.mount_point)}/ mounted = true @@ -140,7 +140,7 @@ class Chef fstab.puts("\tnodename\t\t= #{device_details[0]}") else fstab.puts("\tdev\t\t= #{device_fstab}") - end + end fstab.puts("\tvfs\t\t= #{@new_resource.fstype}") fstab.puts("\tmount\t\t= false") fstab.puts "\toptions\t\t= #{@new_resource.options.join(',')}" unless @new_resource.options.nil? || @new_resource.options.empty? @@ -164,7 +164,7 @@ class Chef if !found_device contents << line end - end + end ::File.open("/etc/filesystems", "w") do |fstab| contents.each { |line| fstab.puts line} end diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index f7118d6c3c..7a8c87c718 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -39,7 +39,7 @@ class Chef mounted? enabled? end - + def mountable? # only check for existence of non-remote devices if (device_should_exist? && !::File.exists?(device_real) ) @@ -49,7 +49,7 @@ class Chef end return true end - + def enabled? # Check to see if there is a entry in /etc/fstab. Last entry for a volume wins. enabled = false @@ -72,7 +72,7 @@ class Chef end @current_resource.enabled(enabled) end - + def mounted? mounted = false shell_out!("mount").stdout.each_line do |line| @@ -141,7 +141,7 @@ class Chef Chef::Log.debug("#{@new_resource} is already enabled - nothing to do") return nil end - + if @current_resource.enabled # The current options don't match what we have, so # disable, then enable. @@ -156,7 +156,7 @@ class Chef def disable_fs if @current_resource.enabled contents = [] - + found = false ::File.readlines("/etc/fstab").reverse_each do |line| if !found && line =~ /^#{device_fstab_regex}\s+#{Regexp.escape(@new_resource.mount_point)}/ @@ -167,7 +167,7 @@ class Chef contents << line end end - + ::File.open("/etc/fstab", "w") do |fstab| contents.reverse_each { |line| fstab.puts line} end @@ -181,7 +181,7 @@ class Chef end def device_should_exist? - ( @new_resource.device != "none" ) && + ( @new_resource.device != "none" ) && ( not network_device? ) && ( not %w[ tmpfs fuse ].include? @new_resource.fstype ) end @@ -200,7 +200,7 @@ class Chef end def device_real - if @real_device == nil + if @real_device == nil if @new_resource.device_type == :device @real_device = @new_resource.device else @@ -247,14 +247,14 @@ class Chef device_fstab end end - + def mount_options_unchanged? @current_resource.fstype == @new_resource.fstype and @current_resource.options == @new_resource.options and @current_resource.dump == @new_resource.dump and @current_resource.pass == @new_resource.pass end - + end end end diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 572cc84877..c7692a9746 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -50,7 +50,7 @@ class Chef requirements.assert(:upgrade) do |a| # Can't upgrade what we don't have - a.assertion { !(@current_resource.version.nil? && candidate_version.nil?) } + a.assertion { !(@current_resource.version.nil? && candidate_version.nil?) } a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{@new_resource.package_name}") a.whyrun("Assuming a repository that offers #{@new_resource.package_name} would have been configured") end @@ -71,9 +71,9 @@ class Chef # We need to make sure we handle the preseed file if @new_resource.response_file if preseed_file = get_preseed_file(@new_resource.package_name, install_version) - converge_by("preseed package #{@new_resource.package_name}") do + converge_by("preseed package #{@new_resource.package_name}") do preseed_package(preseed_file) - end + end end end description = install_version ? "version #{install_version} of" : "" diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb index b25e314569..4df0ea7a33 100644 --- a/lib/chef/provider/package/aix.rb +++ b/lib/chef/provider/package/aix.rb @@ -143,4 +143,4 @@ class Chef end end end -end
\ No newline at end of file +end diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb index 795a7b308b..8ec1ad5878 100644 --- a/lib/chef/provider/package/dpkg.rb +++ b/lib/chef/provider/package/dpkg.rb @@ -6,9 +6,9 @@ # 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. @@ -32,14 +32,14 @@ class Chef include Chef::Mixin::GetSourceFromPackage def define_resource_requirements super - requirements.assert(:install) do |a| + requirements.assert(:install) do |a| a.assertion{ not @new_resource.source.nil? } a.failure_message Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install" end # TODO this was originally written for any action in which .source is provided # but would it make more sense to only look at source if the action is :install? - requirements.assert(:all_actions) do |a| + requirements.assert(:all_actions) do |a| a.assertion { @source_exists } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "Assuming it would have been previously downloaded." @@ -53,7 +53,7 @@ class Chef @new_resource.version(nil) if @new_resource.source - @source_exists = ::File.exists?(@new_resource.source) + @source_exists = ::File.exists?(@new_resource.source) if @source_exists # Get information from the package if supplied Chef::Log.debug("#{@new_resource} checking dpkg status") @@ -71,7 +71,7 @@ class Chef end end - + # Check to see if it is installed package_installed = nil Chef::Log.debug("#{@new_resource} checking install state") @@ -92,10 +92,10 @@ class Chef unless status.exitstatus == 0 || status.exitstatus == 1 raise Chef::Exceptions::Package, "dpkg failed - #{status.inspect}!" end - + @current_resource end - + def install_package(name, version) run_command_with_systems_locale( :command => "dpkg -i#{expand_options(@new_resource.options)} #{@new_resource.source}", @@ -113,7 +113,7 @@ class Chef } ) end - + def purge_package(name, version) run_command_with_systems_locale( :command => "dpkg -P#{expand_options(@new_resource.options)} #{@new_resource.package_name}", diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb index 5beb46a20a..2c6d98d81a 100644 --- a/lib/chef/provider/package/ips.rb +++ b/lib/chef/provider/package/ips.rb @@ -33,12 +33,12 @@ class Chef def define_resource_requirements super - + requirements.assert(:all_actions) do |a| a.assertion { ! @candidate_version.nil? } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.package_name} not found" a.whyrun "Assuming package #{@new_resource.package_name} would have been made available." - end + end end def load_current_resource @@ -52,7 +52,7 @@ class Chef Chef::Log.debug("Checking package status for #{package}") installed = false depends = false - + shell_out!("pkg info -r #{package}").stdout.each_line do |line| case line when /^\s+State: Installed/ diff --git a/lib/chef/provider/package/macports.rb b/lib/chef/provider/package/macports.rb index fd33788944..6ef303ee4f 100644 --- a/lib/chef/provider/package/macports.rb +++ b/lib/chef/provider/package/macports.rb @@ -44,7 +44,7 @@ class Chef def install_package(name, version) unless @current_resource.version == version command = "port#{expand_options(@new_resource.options)} install #{name}" - command << " @#{version}" if version and !version.empty? + command << " @#{version}" if version and !version.empty? run_command_with_systems_locale( :command => command ) diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb index f81486ae84..2e8bb7850b 100644 --- a/lib/chef/provider/package/pacman.rb +++ b/lib/chef/provider/package/pacman.rb @@ -6,9 +6,9 @@ # 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. @@ -24,7 +24,7 @@ class Chef class Provider class Package class Pacman < Chef::Provider::Package - + def load_current_resource @current_resource = Chef::Resource::Package.new(@new_resource.name) @current_resource.package_name(@new_resource.package_name) @@ -84,27 +84,27 @@ class Chef @candidate_version end - + def install_package(name, version) run_command_with_systems_locale( :command => "pacman --sync --noconfirm --noprogressbar#{expand_options(@new_resource.options)} #{name}" ) end - + def upgrade_package(name, version) install_package(name, version) end - + def remove_package(name, version) run_command_with_systems_locale( :command => "pacman --remove --noconfirm --noprogressbar#{expand_options(@new_resource.options)} #{name}" ) end - + def purge_package(name, version) remove_package(name, version) end - + end end end diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index 033ce8efb9..616a78a2f5 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -6,9 +6,9 @@ # 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. @@ -30,18 +30,18 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| + requirements.assert(:all_actions) do |a| a.assertion { @package_source_exists } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "Assuming package #{@new_resource.name} would have been made available." end - requirements.assert(:all_actions) do |a| - a.assertion { !@rpm_status.nil? && (@rpm_status.exitstatus == 0 || @rpm_status.exitstatus == 1) } + requirements.assert(:all_actions) do |a| + a.assertion { !@rpm_status.nil? && (@rpm_status.exitstatus == 0 || @rpm_status.exitstatus == 1) } a.failure_message Chef::Exceptions::Package, "Unable to determine current version due to RPM failure. Detail: #{@rpm_status.inspect}" a.whyrun "Assuming current version would have been determined for package#{@new_resource.name}." end end - + def load_current_resource @package_source_provided = true @package_source_exists = true @@ -49,13 +49,13 @@ class Chef @current_resource = Chef::Resource::Package.new(@new_resource.name) @current_resource.package_name(@new_resource.package_name) @new_resource.version(nil) - + if @new_resource.source unless ::File.exists?(@new_resource.source) @package_source_exists = false return end - + Chef::Log.debug("#{@new_resource} checking rpm status") status = popen4("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}") do |pid, stdin, stdout, stderr| stdout.each do |line| @@ -72,7 +72,7 @@ class Chef return end end - + Chef::Log.debug("#{@new_resource} checking install state") @rpm_status = popen4("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@current_resource.package_name}") do |pid, stdin, stdout, stderr| stdout.each do |line| @@ -83,11 +83,11 @@ class Chef end end end - - + + @current_resource end - + def install_package(name, version) unless @current_resource.version run_command_with_systems_locale( @@ -99,9 +99,9 @@ class Chef ) end end - + alias_method :upgrade_package, :install_package - + def remove_package(name, version) if version run_command_with_systems_locale( diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 28d332420b..b423c199a0 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -72,7 +72,7 @@ class Chef raise NotImplementedError end - ## + ## # A rubygems specification object containing the list of gemspecs for all # available gems in the gem installation. # Implemented by subclasses diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb index a099337a7b..28d56ddc2c 100644 --- a/lib/chef/provider/package/smartos.rb +++ b/lib/chef/provider/package/smartos.rb @@ -84,7 +84,7 @@ class Chef end def remove_package(name, version) - Chef::Log.debug("#{@new_resource} removing package #{name} version #{version}") + Chef::Log.debug("#{@new_resource} removing package #{name} version #{version}") package = "#{name}" out = shell_out!("/opt/local/bin/pkgin -y remove #{package}", :env => nil) end diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb index f502a0dc96..7b3d4196bc 100644 --- a/lib/chef/provider/package/solaris.rb +++ b/lib/chef/provider/package/solaris.rb @@ -33,12 +33,12 @@ class Chef # end def define_resource_requirements super - requirements.assert(:install) do |a| + requirements.assert(:install) do |a| a.assertion { @new_resource.source } a.failure_message Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install" end - requirements.assert(:all_actions) do |a| - a.assertion { !@new_resource.source || @package_source_found } + requirements.assert(:all_actions) do |a| + a.assertion { !@new_resource.source || @package_source_found } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "would assume #{@new_resource.source} would be have previously been made available" end @@ -51,7 +51,7 @@ class Chef if @new_resource.source @package_source_found = ::File.exists?(@new_resource.source) - if @package_source_found + if @package_source_found Chef::Log.debug("#{@new_resource} checking pkg status") status = popen4("pkginfo -l -d #{@new_resource.source} #{@new_resource.package_name}") do |pid, stdin, stdout, stderr| stdout.each do |line| diff --git a/lib/chef/provider/package/yum-dump.py b/lib/chef/provider/package/yum-dump.py index 407eb8f408..a8f3995e8c 100644 --- a/lib/chef/provider/package/yum-dump.py +++ b/lib/chef/provider/package/yum-dump.py @@ -6,9 +6,9 @@ # 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. @@ -249,8 +249,8 @@ def yum_dump(options): # Preserve order of enable/disable repo args like yum does def gather_repo_opts(option, opt, value, parser): - if getattr(parser.values, option.dest, None) is None: - setattr(parser.values, option.dest, []) + if getattr(parser.values, option.dest, None) is None: + setattr(parser.values, option.dest, []) getattr(parser.values, option.dest).append((opt, value.split(','))) def main(): diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 233e949e12..f56d3140b6 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -667,7 +667,7 @@ class Chef @allow_multi_install = [] - @extra_repo_control = nil + @extra_repo_control = nil # these are for subsequent runs if we are on an interval Chef::Client.when_run_starts do @@ -1046,7 +1046,7 @@ class Chef end # At this point package_name could be: - # + # # 1) a package name, eg: "foo" # 2) a package name.arch, eg: "foo.i386" # 3) or a dependency, eg: "foo >= 1.1" @@ -1154,7 +1154,7 @@ class Chef # Hacky - better overall solution? Custom compare in Package provider? def action_upgrade # Could be uninstalled or have no candidate - if @current_resource.version.nil? || candidate_version.nil? + if @current_resource.version.nil? || candidate_version.nil? super # Ensure the candidate is newer elsif RPMVersion.parse(candidate_version) > RPMVersion.parse(@current_resource.version) diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 700eb88c11..c459cdf678 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -6,9 +6,9 @@ # 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. @@ -23,7 +23,7 @@ class Chef class PowershellScript < Chef::Provider::WindowsScript protected - + EXIT_STATUS_NORMALIZATION_SCRIPT = "\nif ($? -eq $true) {exit 0} elseif ( $LASTEXITCODE -ne 0) {exit $LASTEXITCODE} else { exit 1 }" EXIT_STATUS_RESET_SCRIPT = "$LASTEXITCODE=0\n" @@ -41,12 +41,12 @@ class Chef end public - + def initialize (new_resource, run_context) super(new_resource, run_context, '.ps1') NormalizeScriptExitStatus(new_resource.code) end - + def flags default_flags = [ "-NoLogo", @@ -60,8 +60,8 @@ class Chef # file created by the base class that contains the script # code -- otherwise, powershell.exe does not propagate the # error status of a failed Windows process that ran at the - # end of the script, it gets changed to '1'. - "-File" + # end of the script, it gets changed to '1'. + "-File" ] interpreter_flags = default_flags.join(' ') diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index 6ffd83f438..9b65d87895 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -68,7 +68,7 @@ class Chef raise e end end - + tempfile end diff --git a/lib/chef/provider/resource_update.rb b/lib/chef/provider/resource_update.rb index e2c6bffca4..54f25738ed 100644 --- a/lib/chef/provider/resource_update.rb +++ b/lib/chef/provider/resource_update.rb @@ -4,27 +4,27 @@ class Chef # { # "run_id" : "1000", - # "resource" : { + # "resource" : { # "type" : "file", - # "name" : "/etc/passwd", + # "name" : "/etc/passwd", # "start_time" : "2012-01-09T08:15:30-05:00", # "end_time" : "2012-01-09T08:15:30-05:00", # "status" : "modified", - # "initial_state" : "exists", - # "final_state" : "modified", - # "before" : { - # "group" : "root", + # "initial_state" : "exists", + # "final_state" : "modified", + # "before" : { + # "group" : "root", # "owner" : "root", # "checksum" : "xyz" # }, - # "after" : { - # "group" : "root", + # "after" : { + # "group" : "root", # "owner" : "root", # "checksum" : "abc" # }, # "delta" : "escaped delta goes here" # }, - # "event_data" : "" + # "event_data" : "" # } class ResourceUpdate diff --git a/lib/chef/provider/ruby_block.rb b/lib/chef/provider/ruby_block.rb index 16908b0eff..b0d94a3f8d 100644 --- a/lib/chef/provider/ruby_block.rb +++ b/lib/chef/provider/ruby_block.rb @@ -7,9 +7,9 @@ # 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. @@ -29,7 +29,7 @@ class Chef end def action_run - converge_by("execute the ruby block #{@new_resource.name}") do + converge_by("execute the ruby block #{@new_resource.name}") do @new_resource.block.call Chef::Log.info("#{@new_resource} called") end diff --git a/lib/chef/provider/script.rb b/lib/chef/provider/script.rb index 1b459f36cf..4aacf4f524 100644 --- a/lib/chef/provider/script.rb +++ b/lib/chef/provider/script.rb @@ -27,7 +27,7 @@ class Chef super @code = @new_resource.code end - + def action_run script_file.puts(@code) script_file.close diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index 8d76927676..968f9bff9c 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -35,7 +35,7 @@ class Chef end def load_new_resource_state - # If the user didn't specify a change in enabled state, + # If the user didn't specify a change in enabled state, # it will be the same as the old resource if ( @new_resource.enabled.nil? ) @new_resource.enabled(@current_resource.enabled) @@ -54,7 +54,7 @@ class Chef a.failure_message Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :reload" # if a service is not declared to support reload, that won't # typically change during the course of a run - so no whyrun - # alternative here. + # alternative here. end end diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index e2a0f60d91..f52099921f 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -41,17 +41,17 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| update_rcd = "/usr/sbin/update-rc.d" - a.assertion { ::File.exists? update_rcd } + a.assertion { ::File.exists? update_rcd } a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!" # no whyrun recovery - this is a base system component of debian - # distros and must be present - end + # distros and must be present + end requirements.assert(:all_actions) do |a| - a.assertion { @priority_success } + a.assertion { @priority_success } a.failure_message Chef::Exceptions::Service, "/usr/sbin/update-rc.d -n -f #{@current_resource.service_name} failed - #{@rcd_status.inspect}" - # This can happen if the service is not yet installed,so we'll fake it. - a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", + # This can happen if the service is not yet installed,so we'll fake it. + a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", "Assigning temporary priorities to continue.", "If this service is not properly installed prior to this point, this will fail."] do temp_priorities = {"6"=>[:stop, "20"], @@ -74,7 +74,7 @@ class Chef [stdout, stderr].each do |iop| iop.each_line do |line| if UPDATE_RC_D_PRIORITIES =~ line - # priority[runlevel] = [ S|K, priority ] + # priority[runlevel] = [ S|K, priority ] # S = Start, K = Kill # debian runlevels: 0 Halt, 1 Singleuser, 2 Multiuser, 3-5 == 2, 6 Reboot priority[$1] = [($2 == "S" ? :start : :stop), $3] @@ -110,7 +110,7 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d #{@new_resource.service_name} defaults #{@new_resource.priority} #{100 - @new_resource.priority}") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own start priorities set_priority() else # No priority, go with update-rc.d defaults @@ -126,10 +126,10 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop #{100 - @new_resource.priority} 2 3 4 5 .") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own stop priorities set_priority() - else + else # no priority, using '100 - 20 (update-rc.d default)' to stop in reverse order of start run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop 80 2 3 4 5 .") diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb index b875838ec2..cb0f6b0fc4 100644 --- a/lib/chef/provider/service/freebsd.rb +++ b/lib/chef/provider/service/freebsd.rb @@ -38,13 +38,13 @@ class Chef elsif ::File.exists?("/usr/local/etc/rc.d/#{current_resource.service_name}") @init_command = "/usr/local/etc/rc.d/#{current_resource.service_name}" else - @rcd_script_found = false + @rcd_script_found = false return end Chef::Log.debug("#{@current_resource} found at #{@init_command}") determine_current_status! # Default to disabled if the service doesn't currently exist - # at all + # at all var_name = service_enable_variable_name if ::File.exists?("/etc/rc.conf") && var_name read_rc_conf.each do |line| @@ -70,19 +70,19 @@ class Chef def define_resource_requirements shared_resource_requirements requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found } + a.assertion { @rcd_script_found } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the rc.d script" end - requirements.assert(:all_actions) do |a| - a.assertion { @enabled_state_found } - # for consistentcy with original behavior, this will not fail in non-whyrun mode; + requirements.assert(:all_actions) do |a| + a.assertion { @enabled_state_found } + # for consistentcy with original behavior, this will not fail in non-whyrun mode; # rather it will silently set enabled state=>false - a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." + a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." end requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found && service_enable_variable_name != nil } + a.assertion { @rcd_script_found && service_enable_variable_name != nil } a.failure_message Chef::Exceptions::Service, "Could not find the service name in #{@init_command} and rcvar" # No recovery in whyrun mode - the init file is present but not correct. end @@ -133,7 +133,7 @@ class Chef # corresponding to this service # For example: to enable the service mysql-server with the init command /usr/local/etc/rc.d/mysql-server, you need # to set mysql_enable="YES" in /etc/rc.conf$ - if @rcd_script_found + if @rcd_script_found ::File.open(@init_command) do |rcscript| rcscript.each_line do |line| if line =~ /^name="?(\w+)"?/ diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb index 45b5a21f9b..ba4edc5807 100644 --- a/lib/chef/provider/service/gentoo.rb +++ b/lib/chef/provider/service/gentoo.rb @@ -44,7 +44,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/sbin/rc-update") } + a.assertion { ::File.exists?("/sbin/rc-update") } a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist" # no whyrun recovery -t his is a core component whose presence is # unlikely to be affected by what we do in the course of a chef run @@ -52,15 +52,15 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init requirements.assert(:all_actions) do |a| a.assertion { @found_script } - # No failure, just informational output from whyrun + # No failure, just informational output from whyrun a.whyrun "Could not find service #{@new_resource.service_name} under any runlevel" end end - + def enable_service() run_command(:command => "/sbin/rc-update add #{@new_resource.service_name} default") end - + def disable_service() run_command(:command => "/sbin/rc-update del #{@new_resource.service_name} default") end diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb index 09f47e866f..63ba8fa6ab 100644 --- a/lib/chef/provider/service/init.rb +++ b/lib/chef/provider/service/init.rb @@ -47,7 +47,7 @@ class Chef end end end - + def start_service if @new_resource.start_command super diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb index 32152376ee..cb9c28e17e 100644 --- a/lib/chef/provider/service/insserv.rb +++ b/lib/chef/provider/service/insserv.rb @@ -32,9 +32,9 @@ class Chef if Dir.glob("/etc/rc**/S*#{@current_resource.service_name}").empty? @current_resource.enabled false else - @current_resource.enabled true + @current_resource.enabled true end - + @current_resource end diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb index 69a17bb4fb..ee2719d75a 100644 --- a/lib/chef/provider/service/invokercd.rb +++ b/lib/chef/provider/service/invokercd.rb @@ -24,7 +24,7 @@ class Chef class Provider class Service class Invokercd < Chef::Provider::Service::Init - + def initialize(new_resource, run_context) super @init_command = "/usr/sbin/invoke-rc.d #{@new_resource.service_name}" diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index 629e4ee0c3..06be9f3207 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -48,7 +48,7 @@ class Chef requirements.assert(:start, :enable, :reload, :restart) do |a| a.assertion { !@service_missing } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the init.d script!" - a.whyrun "Assuming service would be disabled. The init script is not presently installed." + a.whyrun "Assuming service would be disabled. The init script is not presently installed." end end @@ -59,7 +59,7 @@ class Chef chkconfig = shell_out!("/sbin/chkconfig --list #{@current_resource.service_name}", :returns => [0,1]) @current_resource.enabled(!!(chkconfig.stdout =~ CHKCONFIG_ON)) @service_missing = !!(chkconfig.stderr =~ CHKCONFIG_MISSING) - end + end @current_resource end diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb index bcb85230d0..288b5f5456 100644 --- a/lib/chef/provider/service/simple.rb +++ b/lib/chef/provider/service/simple.rb @@ -45,8 +45,8 @@ class Chef def shared_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { @status_load_success } + requirements.assert(:all_actions) do |a| + a.assertion { @status_load_success } a.whyrun ["Service status not available. Assuming a prior action would have installed the service.", "Assuming status of not running."] end end @@ -74,12 +74,12 @@ class Chef end requirements.assert(:all_actions) do |a| - a.assertion { @new_resource.status_command or @new_resource.supports[:status] or - (!ps_cmd.nil? and !ps_cmd.empty?) } + a.assertion { @new_resource.status_command or @new_resource.supports[:status] or + (!ps_cmd.nil? and !ps_cmd.empty?) } a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this node's 'command.ps' attribute" end - requirements.assert(:all_actions) do |a| - a.assertion { !@ps_command_failed } + requirements.assert(:all_actions) do |a| + a.assertion { !@ps_command_failed } a.failure_message Chef::Exceptions::Service, "Command #{ps_cmd} failed to execute, cannot determine service current status" end end diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb index 33a29da109..4bdb6fbfd1 100644 --- a/lib/chef/provider/service/solaris.rb +++ b/lib/chef/provider/service/solaris.rb @@ -31,7 +31,7 @@ class Chef @init_command = "/usr/sbin/svcadm" @status_command = "/bin/svcs -l" end - + def load_current_resource @current_resource = Chef::Resource::Service.new(@new_resource.name) diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 59b4fe1564..89077c5feb 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -50,7 +50,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def define_resource_requirements shared_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { @status_check_success } + a.assertion { @status_check_success } # We won't stop in any case, but in whyrun warn and tell what we're doing. a.whyrun ["Failed to determine status of #{@new_resource}, using command #{@new_resource.status_command}.", "Assuming service would have been installed and is disabled"] @@ -99,11 +99,11 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def enable_service run_command_with_systems_locale(:command => "/bin/systemctl enable #{@new_resource.service_name}") - end + end def disable_service run_command_with_systems_locale(:command => "/bin/systemctl disable #{@new_resource.service_name}") - end + end def is_active? run_command_with_systems_locale({:command => "/bin/systemctl is-active #{@new_resource.service_name}", :ignore_failure => true}) == 0 diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 763a2aa92b..9ec0f54b43 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -26,7 +26,7 @@ class Chef class Service class Upstart < Chef::Provider::Service::Simple UPSTART_STATE_FORMAT = /\w+ \(?(\w+)\)?[\/ ](\w+)/ - + # Upstart does more than start or stop a service, creating multiple 'states' [1] that a service can be in. # 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 @@ -40,17 +40,17 @@ class Chef # TODO: re-evaluate if this is needed after integrating cookbook fix raise ArgumentError, "run_context cannot be nil" unless run_context super - + run_context.node - + @job = @new_resource.service_name - + if @new_resource.parameters @new_resource.parameters.each do |key, value| @job << " #{key}=#{value}" end end - + platform, version = Chef::Platform.find_platform_and_version(run_context.node) if platform == "ubuntu" && (8.04..9.04).include?(version.to_f) @upstart_job_dir = "/etc/event.d" @@ -60,8 +60,8 @@ class Chef @upstart_conf_suffix = ".conf" end - @command_success = true # new_resource.status_command= false, means upstart used - @config_file_found = true + @command_success = true # new_resource.status_command= false, means upstart used + @config_file_found = true @upstart_command_success = true end @@ -70,18 +70,18 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| if !@command_success - whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : + whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : "Could not determine upstart state for service" end a.assertion { @command_success } - # no failure here, just document the assumptions made. - a.whyrun "#{whyrun_msg} Assuming service installed and not running." + # no failure here, just document the assumptions made. + a.whyrun "#{whyrun_msg} Assuming service installed and not running." end - requirements.assert(:all_actions) do |a| - a.assertion { @config_file_found } - # no failure here, just document the assumptions made. - a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." + requirements.assert(:all_actions) do |a| + a.assertion { @config_file_found } + # no failure here, just document the assumptions made. + a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." end end diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb index 3b0c202b10..6ceb3e592a 100644 --- a/lib/chef/provider/subversion.rb +++ b/lib/chef/provider/subversion.rb @@ -17,7 +17,7 @@ # -#TODO subversion and git should both extend from a base SCM provider. +#TODO subversion and git should both extend from a base SCM provider. require 'chef/log' require 'chef/provider' @@ -52,7 +52,7 @@ class Chef # for why run, print a message explaining the potential error. parent_directory = ::File.dirname(@new_resource.destination) a.assertion { ::File.directory?(parent_directory) } - a.failure_message(Chef::Exceptions::MissingParentDirectory, + a.failure_message(Chef::Exceptions::MissingParentDirectory, "Cannot clone #{@new_resource} to #{@new_resource.destination}, the enclosing directory #{parent_directory} does not exist") a.whyrun("Directory #{parent_directory} does not exist, assuming it would have been created") end @@ -91,13 +91,13 @@ class Chef converge_by("sync #{@new_resource.destination} from #{@new_resource.repository}") do run_command(run_options(:command => sync_command)) Chef::Log.info "#{@new_resource} updated to revision: #{revision_int}" - end + end end else action_checkout end end - + def sync_command c = scm :update, @new_resource.svn_arguments, verbose, authentication, "-r#{revision_int}", @new_resource.destination Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to revision #{@new_resource.revision}" @@ -198,7 +198,7 @@ class Chef def scm(*args) ['svn', *args].compact.join(" ") end - + def target_dir_non_existent_or_empty? !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..'] diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb index 851d8110fb..738f7660f8 100644 --- a/lib/chef/provider/user.rb +++ b/lib/chef/provider/user.rb @@ -6,9 +6,9 @@ # 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. @@ -87,14 +87,14 @@ class Chef def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { @group_name_resolved } + a.assertion { @group_name_resolved } a.failure_message Chef::Exceptions::User, "Couldn't lookup integer GID for group name #{@new_resource.gid}" a.whyrun "group name #{@new_resource.gid} does not exist. This will cause group assignment to fail. Assuming this group will have been created previously." end requirements.assert(:all_actions) do |a| - a.assertion { @shadow_lib_ok } + a.assertion { @shadow_lib_ok } a.failure_message Chef::Exceptions::MissingLibrary, "You must have ruby-shadow installed for password support!" - a.whyrun "ruby-shadow is not installed. Attempts to set user password will cause failure. Assuming that this gem will have been previously installed." + + a.whyrun "ruby-shadow is not installed. Attempts to set user password will cause failure. Assuming that this gem will have been previously installed." + "Note that user update converge may report false-positive on the basis of mismatched password. " end requirements.assert(:modify, :lock, :unlock) do |a| diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 94e8420c43..b01931609e 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -6,9 +6,9 @@ # 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. @@ -25,10 +25,10 @@ class Chef class User class Dscl < Chef::Provider::User include Chef::Mixin::ShellOut - + NFS_HOME_DIRECTORY = %r{^NFSHomeDirectory: (.*)$} AUTHENTICATION_AUTHORITY = %r{^AuthenticationAuthority: (.*)$} - + def dscl(*args) shell_out("dscl . -#{args.join(' ')}") end @@ -80,7 +80,7 @@ class Chef return safe_dscl("delete /Users/#{@new_resource.username} NFSHomeDirectory") if (@new_resource.home.nil? || @new_resource.home.empty?) if @new_resource.supports[:manage_home] validate_home_dir_specification! - + if (@current_resource.home == @new_resource.home) && !new_home_exists? ditto_home elsif !current_home_exists? && !new_home_exists? @@ -105,7 +105,7 @@ class Chef end def shadow_hash_set? - user_data = safe_dscl("read /Users/#{@new_resource.username}") + user_data = safe_dscl("read /Users/#{@new_resource.username}") if user_data =~ /AuthenticationAuthority: / && user_data =~ /ShadowHash/ true else @@ -116,7 +116,7 @@ class Chef def modify_password if @new_resource.password shadow_hash = nil - + Chef::Log.debug("#{new_resource} updating password") if osx_shadow_hash?(@new_resource.password) shadow_hash = @new_resource.password.upcase @@ -134,11 +134,11 @@ class Chef shadow_hash = String.new("00000000"*155) shadow_hash[168] = salted_sha1 end - + ::File.open("/var/db/shadow/hash/#{guid}",'w',0600) do |output| output.puts shadow_hash end - + unless shadow_hash_set? safe_dscl("append /Users/#{@new_resource.username} AuthenticationAuthority ';ShadowHash;'") end @@ -159,7 +159,7 @@ class Chef dscl_set_shell modify_password end - + def manage_user dscl_create_user if diverged?(:username) dscl_create_comment if diverged?(:comment) @@ -169,15 +169,15 @@ class Chef dscl_set_shell if diverged?(:shell) modify_password if diverged?(:password) end - + def dscl_create_user - safe_dscl("create /Users/#{@new_resource.username}") + safe_dscl("create /Users/#{@new_resource.username}") end - + def dscl_create_comment safe_dscl("create /Users/#{@new_resource.username} RealName '#{@new_resource.comment}'") end - + def dscl_set_gid unless @new_resource.gid && @new_resource.gid.to_s.match(/^\d+$/) begin @@ -189,7 +189,7 @@ class Chef end safe_dscl("create /Users/#{@new_resource.username} PrimaryGroupID '#{@new_resource.gid}'") end - + def dscl_set_shell if @new_resource.password || ::File.exists?("#{@new_resource.shell}") safe_dscl("create /Users/#{@new_resource.username} UserShell '#{@new_resource.shell}'") @@ -197,10 +197,10 @@ class Chef safe_dscl("create /Users/#{@new_resource.username} UserShell '/usr/bin/false'") end end - + def remove_user if @new_resource.supports[:manage_home] - user_info = safe_dscl("read /Users/#{@new_resource.username}") + user_info = safe_dscl("read /Users/#{@new_resource.username}") if nfs_home_match = user_info.match(NFS_HOME_DIRECTORY) #nfs_home = safe_dscl("read /Users/#{@new_resource.username} NFSHomeDirectory") #nfs_home.gsub!(/NFSHomeDirectory: /,"").gsub!(/\n$/,"") @@ -228,7 +228,7 @@ class Chef false end end - + def check_lock return @locked = locked? end @@ -236,27 +236,27 @@ class Chef def lock_user safe_dscl("append /Users/#{@new_resource.username} AuthenticationAuthority ';DisabledUser;'") end - + def unlock_user auth_info = safe_dscl("read /Users/#{@new_resource.username} AuthenticationAuthority") auth_string = auth_info.gsub(/AuthenticationAuthority: /,"").gsub(/;DisabledUser;/,"").strip#.gsub!(/[; ]*$/,"") safe_dscl("create /Users/#{@new_resource.username} AuthenticationAuthority '#{auth_string}'") end - + def validate_home_dir_specification! unless @new_resource.home =~ /^\// - raise(Chef::Exceptions::InvalidHomeDirectory,"invalid path spec for User: '#{@new_resource.username}', home directory: '#{@new_resource.home}'") + raise(Chef::Exceptions::InvalidHomeDirectory,"invalid path spec for User: '#{@new_resource.username}', home directory: '#{@new_resource.home}'") end end - + def current_home_exists? ::File.exist?("#{@current_resource.home}") end - + def new_home_exists? - ::File.exist?("#{@new_resource.home}") + ::File.exist?("#{@new_resource.home}") end - + def ditto_home skel = "/System/Library/User Template/English.lproj" raise(Chef::Exceptions::User,"can't find skel at: #{skel}") unless ::File.exists?(skel) @@ -266,7 +266,7 @@ class Chef def move_home Chef::Log.debug("#{@new_resource} moving #{self} home from #{@current_resource.home} to #{@new_resource.home}") - + src = @current_resource.home FileUtils.mkdir_p(@new_resource.home) files = ::Dir.glob("#{src}/*", ::File::FNM_DOTMATCH) - ["#{src}/.","#{src}/.."] @@ -274,11 +274,11 @@ class Chef ::FileUtils.rmdir(src) ::FileUtils.chown_R(@new_resource.username,@new_resource.gid.to_s,@new_resource.home) end - + def diverged?(parameter) parameter_updated?(parameter) && (not @new_resource.send(parameter).nil?) end - + def parameter_updated?(parameter) not (@new_resource.send(parameter) == @current_resource.send(parameter)) end diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb index 4f6393da89..9f7a169892 100644 --- a/lib/chef/provider/user/pw.rb +++ b/lib/chef/provider/user/pw.rb @@ -6,9 +6,9 @@ # 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. @@ -34,20 +34,20 @@ class Chef run_command(:command => command) modify_password end - + def manage_user command = "pw usermod" command << set_options run_command(:command => command) modify_password end - + def remove_user command = "pw userdel #{@new_resource.username}" command << " -r" if @new_resource.supports[:manage_home] run_command(:command => command) end - + def check_lock case @current_resource.password when /^\*LOCKED\*/ @@ -57,18 +57,18 @@ class Chef end @locked end - + def lock_user run_command(:command => "pw lock #{@new_resource.username}") end - + def unlock_user run_command(:command => "pw unlock #{@new_resource.username}") end - + def set_options opts = " #{@new_resource.username}" - + field_list = { 'comment' => "-c", 'home' => "-d", @@ -91,7 +91,7 @@ class Chef end opts end - + def modify_password if @current_resource.password != @new_resource.password Chef::Log.debug("#{new_resource} updating password") @@ -99,7 +99,7 @@ class Chef status = popen4(command, :waitlast => true) do |pid, stdin, stdout, stderr| stdin.puts "#{@new_resource.password}" end - + unless status.exitstatus == 0 raise Chef::Exceptions::User, "pw failed - #{status.inspect}!" end diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb index 6bbb2a088c..350f3ff4c0 100644 --- a/lib/chef/provider/user/windows.rb +++ b/lib/chef/provider/user/windows.rb @@ -6,9 +6,9 @@ # 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. @@ -71,23 +71,23 @@ class Chef def create_user @net_user.add(set_options) end - + def manage_user @net_user.update(set_options) end - + def remove_user @net_user.delete end - + def check_lock @net_user.check_enabled end - + def lock_user @net_user.disable_account end - + def unlock_user @net_user.enable_account end diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb index 398e1aee6e..08a2ea74df 100644 --- a/lib/chef/provider/windows_script.rb +++ b/lib/chef/provider/windows_script.rb @@ -6,9 +6,9 @@ # 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. @@ -24,7 +24,7 @@ class Chef class WindowsScript < Chef::Provider::Script protected - + include Chef::Mixin::WindowsArchitectureHelper def initialize( new_resource, run_context, script_extension='') @@ -43,14 +43,14 @@ class Chef end public - + def action_run wow64_redirection_state = nil if @is_wow64 wow64_redirection_state = disable_wow64_file_redirection(@run_context.node) end - + begin super rescue @@ -61,11 +61,11 @@ class Chef end end end - + def script_file base_script_name = "chef-script" temp_file_arguments = [ base_script_name, @script_extension ] - + @script_file ||= Tempfile.open(temp_file_arguments) end end diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb index 524abbb370..050cf838ae 100644 --- a/lib/chef/resource/apt_package.rb +++ b/lib/chef/resource/apt_package.rb @@ -6,9 +6,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/provider/package/apt' class Chef class Resource class AptPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :apt_package diff --git a/lib/chef/resource/bash.rb b/lib/chef/resource/bash.rb index 374bca9e11..c56de5fe20 100644 --- a/lib/chef/resource/bash.rb +++ b/lib/chef/resource/bash.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'chef/resource/script' class Chef class Resource class Bash < Chef::Resource::Script - + def initialize(name, run_context=nil) super @resource_name = :bash diff --git a/lib/chef/resource/batch.rb b/lib/chef/resource/batch.rb index 705260bbce..576e6b4c6b 100644 --- a/lib/chef/resource/batch.rb +++ b/lib/chef/resource/batch.rb @@ -6,9 +6,9 @@ # 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. @@ -21,11 +21,11 @@ require 'chef/resource/windows_script' class Chef class Resource class Batch < Chef::Resource::WindowsScript - + def initialize(name, run_context=nil) super(name, run_context, :batch, "cmd.exe") end - + end end end diff --git a/lib/chef/resource/bff_package.rb b/lib/chef/resource/bff_package.rb index f65aae8449..2d78483e4b 100644 --- a/lib/chef/resource/bff_package.rb +++ b/lib/chef/resource/bff_package.rb @@ -6,9 +6,9 @@ # 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. @@ -22,13 +22,13 @@ require 'chef/provider/package/aix' class Chef class Resource class BffPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :bff_package @provider = Chef::Provider::Package::Aix end - + end end end diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb index 34aeae6b47..83c397bd5b 100644 --- a/lib/chef/resource/breakpoint.rb +++ b/lib/chef/resource/breakpoint.rb @@ -6,9 +6,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class Breakpoint < Chef::Resource - + def initialize(action="break", *args) @name = caller.first super(@name, *args) diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb index 5f858cec81..dfbb91f80c 100644 --- a/lib/chef/resource/cron.rb +++ b/lib/chef/resource/cron.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class Cron < Chef::Resource - + identity_attr :command state_attrs :minute, :hour, :day, :month, :weekday, :user @@ -186,9 +186,9 @@ class Chef :kind_of => Hash ) end - + private - + # On Ruby 1.8, Kernel#Integer will happily do this for you. On 1.9, no. def integerize(integerish) Integer(integerish) diff --git a/lib/chef/resource/csh.rb b/lib/chef/resource/csh.rb index 6e871e8605..95aa8afd7a 100644 --- a/lib/chef/resource/csh.rb +++ b/lib/chef/resource/csh.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'chef/resource/script' class Chef class Resource class Csh < Chef::Resource::Script - + def initialize(name, run_context=nil) super @resource_name = :csh diff --git a/lib/chef/resource/deploy.rb b/lib/chef/resource/deploy.rb index 60bfbbc81c..76478ed07c 100644 --- a/lib/chef/resource/deploy.rb +++ b/lib/chef/resource/deploy.rb @@ -50,9 +50,9 @@ class Chef # release directory. Callback files can contain chef code (resources, etc.) # class Deploy < Chef::Resource - + provider_base Chef::Provider::Deploy - + identity_attr :repository state_attrs :deploy_to, :revision @@ -389,7 +389,7 @@ class Chef arg ||= block set_or_return(:after_restart, arg, :kind_of => [Proc, String]) end - + def additional_remotes(arg=nil) set_or_return( :additional_remotes, diff --git a/lib/chef/resource/deploy_revision.rb b/lib/chef/resource/deploy_revision.rb index 55a3e38130..ceac26e91a 100644 --- a/lib/chef/resource/deploy_revision.rb +++ b/lib/chef/resource/deploy_revision.rb @@ -6,9 +6,9 @@ # 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. @@ -18,9 +18,9 @@ class Chef class Resource - + # Convenience class for using the deploy resource with the revision - # deployment strategy (provider) + # deployment strategy (provider) class DeployRevision < Chef::Resource::Deploy def initialize(*args, &block) super @@ -28,13 +28,13 @@ class Chef @provider = Chef::Provider::Deploy::Revision end end - + class DeployBranch < Chef::Resource::DeployRevision def initialize(*args, &block) super @resource_name = :deploy_branch end end - + end end diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb index a5d5ea7366..423c0bbe27 100644 --- a/lib/chef/resource/directory.rb +++ b/lib/chef/resource/directory.rb @@ -25,11 +25,11 @@ require 'chef/mixin/securable' class Chef class Resource class Directory < Chef::Resource - + identity_attr :path state_attrs :group, :mode, :owner - + include Chef::Mixin::Securable provides :directory, :on_platforms => :all diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb index 02886e8649..2fb5b5c249 100644 --- a/lib/chef/resource/dpkg_package.rb +++ b/lib/chef/resource/dpkg_package.rb @@ -6,9 +6,9 @@ # 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. @@ -22,13 +22,13 @@ require 'chef/provider/package/dpkg' class Chef class Resource class DpkgPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :dpkg_package @provider = Chef::Provider::Package::Dpkg end - + end end end diff --git a/lib/chef/resource/easy_install_package.rb b/lib/chef/resource/easy_install_package.rb index 10e80bdd3b..f25e1ac22f 100644 --- a/lib/chef/resource/easy_install_package.rb +++ b/lib/chef/resource/easy_install_package.rb @@ -21,7 +21,7 @@ require 'chef/resource/package' class Chef class Resource class EasyInstallPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :easy_install_package diff --git a/lib/chef/resource/erl_call.rb b/lib/chef/resource/erl_call.rb index e0e38926bb..959856af66 100644 --- a/lib/chef/resource/erl_call.rb +++ b/lib/chef/resource/erl_call.rb @@ -24,7 +24,7 @@ class Chef class ErlCall < Chef::Resource # erl_call : http://erlang.org/doc/man/erl_call.html - + identity_attr :code def initialize(name, run_context=nil) diff --git a/lib/chef/resource/freebsd_package.rb b/lib/chef/resource/freebsd_package.rb index 9a9a84900e..94286eae18 100644 --- a/lib/chef/resource/freebsd_package.rb +++ b/lib/chef/resource/freebsd_package.rb @@ -6,9 +6,9 @@ # 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. @@ -22,13 +22,13 @@ require 'chef/provider/package/freebsd' class Chef class Resource class FreebsdPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :freebsd_package @provider = Chef::Provider::Package::Freebsd end - + end end end diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index 76f3a779ae..fd09ecb052 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -7,9 +7,9 @@ # 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. @@ -20,7 +20,7 @@ class Chef class Resource class Group < Chef::Resource - + identity_attr :group_name state_attrs :members @@ -35,7 +35,7 @@ class Chef @append = false @allowed_actions.push(:create, :remove, :modify, :manage) end - + def group_name(arg=nil) set_or_return( :group_name, @@ -43,7 +43,7 @@ class Chef :kind_of => [ String ] ) end - + def gid(arg=nil) set_or_return( :gid, @@ -62,7 +62,7 @@ class Chef end alias_method :users, :members - + def append(arg=nil) set_or_return( :append, diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index fc64121f4e..47f6286fb4 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class HttpRequest < Chef::Resource - + identity_attr :url def initialize(name, run_context=nil) @@ -34,7 +34,7 @@ class Chef @headers = {} @allowed_actions.push(:get, :put, :post, :delete, :head, :options) end - + def url(args=nil) set_or_return( :url, @@ -42,7 +42,7 @@ class Chef :kind_of => String ) end - + def message(args=nil, &block) args = block if block_given? set_or_return( @@ -59,7 +59,7 @@ class Chef :kind_of => Hash ) end - + end end end diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index daa8a572a0..c289ddadbe 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class Ifconfig < Chef::Resource - + identity_attr :device state_attrs :inet_addr, :mask @@ -39,7 +39,7 @@ class Chef @bcast = nil @mtu = nil @metric = nil - @device = nil + @device = nil @onboot = nil @network = nil @bootproto = nil diff --git a/lib/chef/resource/ips_package.rb b/lib/chef/resource/ips_package.rb index f82e0877df..88c6e9a538 100644 --- a/lib/chef/resource/ips_package.rb +++ b/lib/chef/resource/ips_package.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb index 30a5bb93c6..f62ffaf176 100644 --- a/lib/chef/resource/log.rb +++ b/lib/chef/resource/log.rb @@ -7,9 +7,9 @@ # 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. @@ -19,7 +19,7 @@ class Chef class Resource class Log < Chef::Resource - + identity_attr :message # Sends a string from a recipe to a log provider @@ -27,16 +27,16 @@ class Chef # log "some string to log" do # level :info # (default) also supports :warn, :debug, and :error # end - # + # # === Example - # log "your string to log" + # log "your string to log" # - # or + # or # # log "a debug string" { level :debug } # - - # Initialize log resource with a name as the string to log + + # Initialize log resource with a name as the string to log # # === Parameters # name<String>:: Message to log @@ -57,7 +57,7 @@ class Chef :kind_of => String ) end - + # <Symbol> Log level, one of :debug, :info, :warn, :error or :fatal def level(arg=nil) set_or_return( @@ -66,9 +66,9 @@ class Chef :equal_to => [ :debug, :info, :warn, :error, :fatal ] ) end - + end - end + end end diff --git a/lib/chef/resource/macports_package.rb b/lib/chef/resource/macports_package.rb index 911d3c19cb..c9434c9e69 100644 --- a/lib/chef/resource/macports_package.rb +++ b/lib/chef/resource/macports_package.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index ad68391fe4..49984630c0 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class Mount < Chef::Resource - + identity_attr :device state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain @@ -46,7 +46,7 @@ class Chef @password = nil @domain = nil end - + def mount_point(arg=nil) set_or_return( :mount_point, @@ -54,7 +54,7 @@ class Chef :kind_of => [ String ] ) end - + def device(arg=nil) set_or_return( :device, @@ -62,7 +62,7 @@ class Chef :kind_of => [ String ] ) end - + def device_type(arg=nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg set_or_return( @@ -79,7 +79,7 @@ class Chef :kind_of => [ String ] ) end - + def options(arg=nil) if arg.is_a?(String) converted_arg = arg.gsub(/,/, ' ').split(/ /) @@ -92,7 +92,7 @@ class Chef :kind_of => [ Array ] ) end - + def dump(arg=nil) set_or_return( :dump, @@ -100,7 +100,7 @@ class Chef :kind_of => [ Integer, FalseClass ] ) end - + def pass(arg=nil) set_or_return( :pass, @@ -108,7 +108,7 @@ class Chef :kind_of => [ Integer, FalseClass ] ) end - + def mounted(arg=nil) set_or_return( :mounted, @@ -124,7 +124,7 @@ class Chef :kind_of => [ TrueClass, FalseClass ] ) end - + def supports(args={}) if args.is_a? Array args.each { |arg| @supports[arg] = true } @@ -163,4 +163,3 @@ class Chef end end - diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb index 48e55e9f01..b567db40f9 100644 --- a/lib/chef/resource/ohai.rb +++ b/lib/chef/resource/ohai.rb @@ -7,9 +7,9 @@ # 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. @@ -20,7 +20,7 @@ class Chef class Resource class Ohai < Chef::Resource - + identity_attr :name state_attrs :plugin diff --git a/lib/chef/resource/pacman_package.rb b/lib/chef/resource/pacman_package.rb index d66c93be66..2894e415ac 100644 --- a/lib/chef/resource/pacman_package.rb +++ b/lib/chef/resource/pacman_package.rb @@ -6,9 +6,9 @@ # 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. @@ -21,13 +21,13 @@ require 'chef/resource/package' class Chef class Resource class PacmanPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :pacman_package @provider = Chef::Provider::Package::Pacman end - + end end end diff --git a/lib/chef/resource/perl.rb b/lib/chef/resource/perl.rb index d3cf696cbb..546f639e1f 100644 --- a/lib/chef/resource/perl.rb +++ b/lib/chef/resource/perl.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'chef/resource/script' class Chef class Resource class Perl < Chef::Resource::Script - + def initialize(name, run_context=nil) super @resource_name = :perl diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb index fc72381482..42c03560b6 100644 --- a/lib/chef/resource/portage_package.rb +++ b/lib/chef/resource/portage_package.rb @@ -6,9 +6,9 @@ # 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. @@ -21,13 +21,13 @@ require 'chef/resource/package' class Chef class Resource class PortagePackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :portage_package @provider = Chef::Provider::Package::Portage end - + end end end diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb index e257eb2fb1..cbd81b1259 100644 --- a/lib/chef/resource/powershell_script.rb +++ b/lib/chef/resource/powershell_script.rb @@ -6,9 +6,9 @@ # 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. @@ -25,7 +25,7 @@ class Chef def initialize(name, run_context=nil) super(name, run_context, :powershell_script, "powershell.exe") end - + end end end diff --git a/lib/chef/resource/python.rb b/lib/chef/resource/python.rb index 85a5348d27..f340afdb39 100644 --- a/lib/chef/resource/python.rb +++ b/lib/chef/resource/python.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'chef/resource/script' class Chef class Resource class Python < Chef::Resource::Script - + def initialize(name, run_context=nil) super @resource_name = :python diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index c8680697af..942905d138 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -7,9 +7,9 @@ # 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. @@ -26,7 +26,7 @@ class Chef identity_attr :target state_attrs :netmask, :gateway - + def initialize(name, run_context=nil) super @resource_name = :route @@ -36,7 +36,7 @@ class Chef @netmask = nil @gateway = nil @metric = nil - @device = nil + @device = nil @route_type = :host @networking = nil @networking_ipv6 = nil diff --git a/lib/chef/resource/rpm_package.rb b/lib/chef/resource/rpm_package.rb index 7ab1202ef2..200a9633ce 100644 --- a/lib/chef/resource/rpm_package.rb +++ b/lib/chef/resource/rpm_package.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/resource/ruby.rb b/lib/chef/resource/ruby.rb index 7617839bab..605d27b00d 100644 --- a/lib/chef/resource/ruby.rb +++ b/lib/chef/resource/ruby.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'chef/resource/script' class Chef class Resource class Ruby < Chef::Resource::Script - + def initialize(name, run_context=nil) super @resource_name = :ruby diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb index 296345bde3..d9b8954a90 100644 --- a/lib/chef/resource/ruby_block.rb +++ b/lib/chef/resource/ruby_block.rb @@ -7,9 +7,9 @@ # 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. @@ -20,7 +20,7 @@ class Chef class Resource class RubyBlock < Chef::Resource - + identity_attr :block_name def initialize(name, run_context=nil) diff --git a/lib/chef/resource/scm.rb b/lib/chef/resource/scm.rb index 7542ad9952..d9a372900e 100644 --- a/lib/chef/resource/scm.rb +++ b/lib/chef/resource/scm.rb @@ -23,8 +23,8 @@ class Chef class Resource class Scm < Chef::Resource - identity_attr :destination - + identity_attr :destination + state_attrs :revision def initialize(name, run_context=nil) diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index 6a7c8e0d5e..8cc9c6f0c5 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource/execute' class Chef class Resource class Script < Chef::Resource::Execute - + identity_attr :command def initialize(name, run_context=nil) @@ -33,7 +33,7 @@ class Chef @interpreter = nil @flags = nil end - + def code(arg=nil) set_or_return( :code, @@ -41,7 +41,7 @@ class Chef :kind_of => [ String ] ) end - + def interpreter(arg=nil) set_or_return( :interpreter, diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index ea43baa414..befa4be1c9 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'chef/resource' class Chef class Resource class Service < Chef::Resource - + identity_attr :service_name state_attrs :enabled, :running @@ -47,7 +47,7 @@ class Chef @supports = { :restart => false, :reload => false, :status => false } @allowed_actions.push(:enable, :disable, :start, :stop, :restart, :reload) end - + def service_name(arg=nil) set_or_return( :service_name, @@ -55,7 +55,7 @@ class Chef :kind_of => [ String ] ) end - + # regex for match against ps -ef when !supports[:has_status] && status == nil def pattern(arg=nil) set_or_return( diff --git a/lib/chef/resource/smartos_package.rb b/lib/chef/resource/smartos_package.rb index 315481bd93..a011b32d5b 100644 --- a/lib/chef/resource/smartos_package.rb +++ b/lib/chef/resource/smartos_package.rb @@ -6,9 +6,9 @@ # 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. @@ -22,13 +22,13 @@ require 'chef/provider/package/smartos' class Chef class Resource class SmartOSPackage < Chef::Resource::Package - + def initialize(name, run_context=nil) super @resource_name = :smartos_package @provider = Chef::Provider::Package::SmartOS end - + end end end diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb index e3226d8b3b..04fec9b1d8 100644 --- a/lib/chef/resource/subversion.rb +++ b/lib/chef/resource/subversion.rb @@ -7,9 +7,9 @@ # 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. @@ -31,7 +31,7 @@ class Chef @provider = Chef::Provider::Subversion allowed_actions << :force_export end - + end end end diff --git a/lib/chef/resource/timestamped_deploy.rb b/lib/chef/resource/timestamped_deploy.rb index d89274bb44..4032ae9854 100644 --- a/lib/chef/resource/timestamped_deploy.rb +++ b/lib/chef/resource/timestamped_deploy.rb @@ -6,9 +6,9 @@ # 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. @@ -18,9 +18,9 @@ class Chef class Resource - + # Convenience class for using the deploy resource with the timestamped - # deployment strategy (provider) + # deployment strategy (provider) class TimestampedDeploy < Chef::Resource::Deploy def initialize(*args, &block) super(*args, &block) diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb index 4d8c4ac11b..357d6d12ea 100644 --- a/lib/chef/resource/user.rb +++ b/lib/chef/resource/user.rb @@ -6,9 +6,9 @@ # 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. @@ -25,7 +25,7 @@ class Chef identity_attr :username state_attrs :uid, :gid, :home - + def initialize(name, run_context=nil) super @resource_name = :user @@ -40,13 +40,13 @@ class Chef @manage_home = false @non_unique = false @action = :create - @supports = { + @supports = { :manage_home => false, :non_unique => false } @allowed_actions.push(:create, :remove, :modify, :manage, :lock, :unlock) end - + def username(arg=nil) set_or_return( :username, @@ -54,7 +54,7 @@ class Chef :kind_of => [ String ] ) end - + def comment(arg=nil) set_or_return( :comment, @@ -62,7 +62,7 @@ class Chef :kind_of => [ String ] ) end - + def uid(arg=nil) set_or_return( :uid, @@ -70,7 +70,7 @@ class Chef :kind_of => [ String, Integer ] ) end - + def gid(arg=nil) set_or_return( :gid, @@ -78,9 +78,9 @@ class Chef :kind_of => [ String, Integer ] ) end - + alias_method :group, :gid - + def home(arg=nil) set_or_return( :home, @@ -88,7 +88,7 @@ class Chef :kind_of => [ String ] ) end - + def shell(arg=nil) set_or_return( :shell, @@ -96,7 +96,7 @@ class Chef :kind_of => [ String ] ) end - + def password(arg=nil) set_or_return( :password, @@ -128,7 +128,7 @@ class Chef :kind_of => [ TrueClass, FalseClass ] ) end - + end end end diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb index 5f2311a5bb..2b563f5bec 100644 --- a/lib/chef/resource/windows_script.rb +++ b/lib/chef/resource/windows_script.rb @@ -6,9 +6,9 @@ # 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. @@ -27,14 +27,14 @@ class Chef def initialize(name, run_context, resource_name, interpreter_command) super(name, run_context) - @interpreter = interpreter_command + @interpreter = interpreter_command @resource_name = resource_name end include Chef::Mixin::WindowsArchitectureHelper public - + def architecture(arg=nil) assert_architecture_compatible!(arg) if ! arg.nil? result = set_or_return( @@ -43,7 +43,7 @@ class Chef :kind_of => Symbol ) end - + protected def assert_architecture_compatible!(desired_architecture) @@ -56,7 +56,7 @@ class Chef def node run_context && run_context.node end - + end end end diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb index bcb1f65667..dff70bcf62 100644 --- a/lib/chef/resource/yum_package.rb +++ b/lib/chef/resource/yum_package.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index 7460a185b4..a528a18aed 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -183,7 +183,7 @@ class Chef "The string `#{query_object}' is not valid for resource collection lookup. Correct syntax is `resource_type[resource_name]'" else raise Chef::Exceptions::InvalidResourceSpecification, - "The object `#{query_object.inspect}' is not valid for resource collection lookup. " + + "The object `#{query_object.inspect}' is not valid for resource collection lookup. " + "Use a String like `resource_type[resource_name]' or a Chef::Resource object" end end diff --git a/lib/chef/resource_collection/stepable_iterator.rb b/lib/chef/resource_collection/stepable_iterator.rb index ec1e244758..4d5fc1f497 100644 --- a/lib/chef/resource_collection/stepable_iterator.rb +++ b/lib/chef/resource_collection/stepable_iterator.rb @@ -5,9 +5,9 @@ # 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. @@ -18,94 +18,94 @@ class Chef class ResourceCollection class StepableIterator - + def self.for_collection(new_collection) instance = new(new_collection) instance end - + attr_accessor :collection attr_reader :position - + def initialize(collection=[]) @position = 0 @paused = false @collection = collection end - + def size collection.size end - + def each(&block) reset_iteration(block) @iterator_type = :element iterate end - + def each_index(&block) reset_iteration(block) @iterator_type = :index iterate end - + def each_with_index(&block) reset_iteration(block) @iterator_type = :element_with_index iterate end - + def paused? @paused end - + def pause @paused = true end - + def resume @paused = false iterate end - + def rewind @position = 0 end - + def skip_back(skips=1) @position -= skips end - + def skip_forward(skips=1) @position += skips end - + def step return nil if @position == size call_iterator_block @position += 1 end - + def iterate_on(iteration_type, &block) @iterator_type = iteration_type @iterator_block = block end - + private - + def reset_iteration(iterator_block) @iterator_block = iterator_block @position = 0 @paused = false end - + def iterate while @position < size && !paused? step end collection end - + def call_iterator_block case @iterator_type when :element @@ -118,7 +118,7 @@ class Chef raise "42error: someone forgot to set @iterator_type, wtf?" end end - + end end end diff --git a/lib/chef/resource_definition.rb b/lib/chef/resource_definition.rb index a0160c5885..278114e209 100644 --- a/lib/chef/resource_definition.rb +++ b/lib/chef/resource_definition.rb @@ -6,9 +6,9 @@ # 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. @@ -21,19 +21,19 @@ require 'chef/mixin/params_validate' class Chef class ResourceDefinition - + include Chef::Mixin::FromFile include Chef::Mixin::ParamsValidate - + attr_accessor :name, :params, :recipe, :node - + def initialize(node=nil) @name = nil @params = Hash.new @recipe = nil @node = node end - + def define(resource_name, prototype_params=nil, &block) unless resource_name.kind_of?(Symbol) raise ArgumentError, "You must use a symbol when defining a new resource!" @@ -52,14 +52,14 @@ class Chef end true 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 # it gets. def method_missing(symbol, *args) @params[symbol] = args.length == 1 ? args[0] : args end - + def to_s "#{name.to_s}" end diff --git a/lib/chef/resource_definition_list.rb b/lib/chef/resource_definition_list.rb index b958624208..55014090d4 100644 --- a/lib/chef/resource_definition_list.rb +++ b/lib/chef/resource_definition_list.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb index 6c74412839..df3425cf00 100644 --- a/lib/chef/rest.rb +++ b/lib/chef/rest.rb @@ -160,7 +160,7 @@ class Chef json_body.force_encoding(Encoding::BINARY) if json_body.respond_to?(:force_encoding) raw_http_request(method, url, headers, json_body) end - + # Runs an HTTP request to a JSON API with raw body. File Download not supported. def raw_http_request(method, url, headers, body) headers = build_headers(method, url, headers, body) diff --git a/lib/chef/run_context/cookbook_compiler.rb b/lib/chef/run_context/cookbook_compiler.rb index d1b93f6652..0a05061152 100644 --- a/lib/chef/run_context/cookbook_compiler.rb +++ b/lib/chef/run_context/cookbook_compiler.rb @@ -6,9 +6,9 @@ # 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. @@ -259,7 +259,7 @@ class Chef cookbook_collection[cookbook].segment_filenames(segment).sort end - # Yields the name, as a symbol, of each cookbook depended on by + # Yields the name, as a symbol, of each cookbook depended on by # +cookbook_name+ in lexical sort order. def each_cookbook_dep(cookbook_name, &block) cookbook = cookbook_collection[cookbook_name] diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb index cf147e778d..2f4d9375eb 100644 --- a/lib/chef/shell/shell_session.rb +++ b/lib/chef/shell/shell_session.rb @@ -173,7 +173,7 @@ module Shell cl = Chef::CookbookLoader.new(Chef::Config[:cookbook_path]) cl.load_cookbooks cookbook_collection = Chef::CookbookCollection.new(cl) - @run_context = Chef::RunContext.new(node, cookbook_collection, @events) + @run_context = Chef::RunContext.new(node, cookbook_collection, @events) @run_context.load(Chef::RunList::RunListExpansionFromDisk.new("_default", [])) @run_status.run_context = run_context end diff --git a/lib/chef/streaming_cookbook_uploader.rb b/lib/chef/streaming_cookbook_uploader.rb index df90e0003d..38a3914b45 100644 --- a/lib/chef/streaming_cookbook_uploader.rb +++ b/lib/chef/streaming_cookbook_uploader.rb @@ -15,22 +15,22 @@ class Chef class StreamingCookbookUploader DefaultHeaders = { 'accept' => 'application/json', 'x-chef-version' => ::Chef::VERSION } - + class << self def post(to_url, user_id, secret_key_filename, params = {}, headers = {}) make_request(:post, to_url, user_id, secret_key_filename, params, headers) end - + def put(to_url, user_id, secret_key_filename, params = {}, headers = {}) make_request(:put, to_url, user_id, secret_key_filename, params, headers) end - + def make_request(http_verb, to_url, user_id, secret_key_filename, params = {}, headers = {}) boundary = '----RubyMultipartClient' + rand(1000000).to_s + 'ZZZZZ' parts = [] content_file = nil - + timestamp = Time.now.utc.iso8601 secret_key = OpenSSL::PKey::RSA.new(File.read(secret_key_filename)) @@ -53,31 +53,31 @@ class Chef end parts << StringPart.new("--" + boundary + "--\r\n") end - + body_stream = MultipartStream.new(parts) - + timestamp = Time.now.utc.iso8601 - + url = URI.parse(to_url) - + Chef::Log.logger.debug("Signing: method: #{http_verb}, path: #{url.path}, file: #{content_file}, User-id: #{user_id}, Timestamp: #{timestamp}") - + # We use the body for signing the request if the file parameter - # wasn't a valid file or wasn't included. Extract the body (with + # wasn't a valid file or wasn't included. Extract the body (with # multi-part delimiters intact) to sign the request. # TODO: tim: 2009-12-28: It'd be nice to remove this special case, and # always hash the entire request body. In the file case it would just be # expanded multipart text - the entire body of the POST. content_body = parts.inject("") { |result,part| result + part.read(0, part.size) } content_file.rewind if content_file # we consumed the file for the above operation, so rewind it. - + signing_options = { :http_method=>http_verb, :path=>url.path, :user_id=>user_id, :timestamp=>timestamp} (content_file && signing_options[:file] = content_file) || (signing_options[:body] = (content_body || "")) - + headers.merge!(Mixlib::Authentication::SignedHeaderAuth.signing_object(signing_options).sign(secret_key)) content_file.rewind if content_file @@ -90,11 +90,11 @@ class Chef Net::HTTP::Put.new(url.path, headers) when :post Net::HTTP::Post.new(url.path, headers) - end + end req.content_length = body_stream.size req.content_type = 'multipart/form-data; boundary=' + boundary unless parts.empty? req.body_stream = body_stream - + http = Net::HTTP.new(url.host, url.port) if url.scheme == "https" http.use_ssl = true @@ -107,30 +107,30 @@ class Chef # TODO: stop the following madness! class << res alias :to_s :body - + # BUGBUG this makes the response compatible with what respsonse_steps expects to test headers (response.headers[] -> response[]) def headers self end - + def status code.to_i end end res end - + end class StreamPart def initialize(stream, size) @stream, @size = stream, size end - + def size @size end - + # read the specified amount from the stream def read(offset, how_much) @stream.read(how_much) @@ -141,7 +141,7 @@ class Chef def initialize(str) @str = str end - + def size @str.length end @@ -158,26 +158,26 @@ class Chef @part_no = 0 @part_offset = 0 end - + def size @parts.inject(0) {|size, part| size + part.size} end - + def read(how_much) return nil if @part_no >= @parts.size how_much_current_part = @parts[@part_no].size - @part_offset - + how_much_current_part = if how_much_current_part > how_much how_much else how_much_current_part end - + how_much_next_part = how_much - how_much_current_part current_part = @parts[@part_no].read(@part_offset, how_much_current_part) - + # recurse into the next part if the current one was not large enough if how_much_next_part > 0 @part_no += 1 @@ -194,7 +194,7 @@ class Chef end end end - + end diff --git a/lib/chef/tasks/chef_repo.rake b/lib/chef/tasks/chef_repo.rake index 6f839a486f..62fef3434a 100644 --- a/lib/chef/tasks/chef_repo.rake +++ b/lib/chef/tasks/chef_repo.rake @@ -6,9 +6,9 @@ # 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. @@ -51,7 +51,7 @@ task :update do pull = true if line =~ /\[remote "origin"\]/ end if pull - sh %{git pull} + sh %{git pull} else puts "* Skipping git pull, no origin specified" end @@ -86,14 +86,14 @@ end def create_cookbook(dir) raise "Must provide a COOKBOOK=" unless ENV["COOKBOOK"] puts "** Creating cookbook #{ENV["COOKBOOK"]}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "attributes")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "recipes")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "definitions")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "libraries")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "resources")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "providers")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "files", "default")}" - sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "templates", "default")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "attributes")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "recipes")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "definitions")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "libraries")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "resources")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "providers")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "files", "default")}" + sh "mkdir -p #{File.join(dir, ENV["COOKBOOK"], "templates", "default")}" unless File.exists?(File.join(dir, ENV["COOKBOOK"], "recipes", "default.rb")) open(File.join(dir, ENV["COOKBOOK"], "recipes", "default.rb"), "w") do |file| file.puts <<-EOH @@ -110,9 +110,9 @@ EOH # 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. @@ -156,7 +156,7 @@ end def create_metadata(dir) raise "Must provide a COOKBOOK=" unless ENV["COOKBOOK"] puts "** Creating metadata for cookbook: #{ENV["COOKBOOK"]}" - + case NEW_COOKBOOK_LICENSE when :apachev2 license = "Apache 2.0" @@ -288,7 +288,7 @@ namespace :databag do end end else - puts "ERROR: Could not find any databags, skipping it" + puts "ERROR: Could not find any databags, skipping it" end end @@ -327,7 +327,7 @@ EOH end else puts "ERROR: Could not find your databag (#{databag}), skipping it" - end + end end end diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb index 44d167f776..41b1f8b076 100644 --- a/lib/chef/util/diff.rb +++ b/lib/chef/util/diff.rb @@ -104,7 +104,7 @@ class Chef begin Chef::Log.debug("running: diff -u #{old_file} #{new_file}") diff_str = udiff(old_file, new_file) - + rescue Exception => e # Should *not* receive this, but in some circumstances it seems that # an exception can be thrown even using shell_out instead of shell_out! @@ -149,7 +149,7 @@ class Chef return diff_str if old_data.empty? && new_data.empty? return "No differences encountered\n" if diff_data.empty? - + # write diff header (standard unified format) ft = File.stat(old_file).mtime.localtime.strftime('%Y-%m-%d %H:%M:%S.%N %z') diff_str << "--- #{old_file}\t#{ft}\n" @@ -172,7 +172,7 @@ class Chef end diff_str << old_hunk.diff(:unified) << "\n" return diff_str - end + end def encode_diff_for_json(diff_str) if Object.const_defined? :Encoding diff --git a/lib/chef/util/windows.rb b/lib/chef/util/windows.rb index cba2c2a1b7..777fe4adbb 100644 --- a/lib/chef/util/windows.rb +++ b/lib/chef/util/windows.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/util/windows/net_group.rb b/lib/chef/util/windows/net_group.rb index 9da0dc6557..817e47efa8 100644 --- a/lib/chef/util/windows/net_group.rb +++ b/lib/chef/util/windows/net_group.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/util/windows/net_use.rb b/lib/chef/util/windows/net_use.rb index 1979e095bd..37efc02fcc 100644 --- a/lib/chef/util/windows/net_use.rb +++ b/lib/chef/util/windows/net_use.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index eb68f6cebc..5cca348c8e 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -6,9 +6,9 @@ # 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. @@ -198,7 +198,7 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows def enable_account user_modify do |user| user[:flags] &= ~UF_ACCOUNTDISABLE - #This does not set the password to nil. It (for some reason) means to ignore updating the field. + #This does not set the password to nil. It (for some reason) means to ignore updating the field. #See similar behavior for the logon_hours field documented at #http://msdn.microsoft.com/en-us/library/windows/desktop/aa371338%28v=vs.85%29.aspx user[:password] = nil diff --git a/lib/chef/util/windows/volume.rb b/lib/chef/util/windows/volume.rb index dff082e929..08c3a53793 100644 --- a/lib/chef/util/windows/volume.rb +++ b/lib/chef/util/windows/volume.rb @@ -6,9 +6,9 @@ # 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. @@ -35,7 +35,7 @@ class Chef::Util::Windows::Volume < Chef::Util::Windows name += "\\" unless name =~ /\\$/ #trailing slash required @name = name end - + def device buffer = 0.chr * 256 if GetVolumeNameForVolumeMountPoint(@name, buffer, buffer.size) diff --git a/lib/chef/version.rb b/lib/chef/version.rb index c46f6c1fa3..259c267035 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -6,9 +6,9 @@ # 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. diff --git a/lib/chef/win32/handle.rb b/lib/chef/win32/handle.rb index 3e92703db9..21a8fdf339 100644 --- a/lib/chef/win32/handle.rb +++ b/lib/chef/win32/handle.rb @@ -29,7 +29,7 @@ class Chef # See http://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx # The handle value returned by the GetCurrentProcess function is the pseudo handle (HANDLE)-1 (which is 0xFFFFFFFF) CURRENT_PROCESS_HANDLE = 4294967295 - + def initialize(handle) @handle = handle ObjectSpace.define_finalizer(self, Handle.close_handle_finalizer(handle)) diff --git a/lib/chef/win32/security/ace.rb b/lib/chef/win32/security/ace.rb index efd44b1c85..3aeae35532 100644 --- a/lib/chef/win32/security/ace.rb +++ b/lib/chef/win32/security/ace.rb @@ -122,4 +122,4 @@ class Chef end end end -end
\ No newline at end of file +end diff --git a/lib/chef/win32/security/sid.rb b/lib/chef/win32/security/sid.rb index 7ca21eee79..e1b20224bb 100644 --- a/lib/chef/win32/security/sid.rb +++ b/lib/chef/win32/security/sid.rb @@ -196,4 +196,4 @@ class Chef end end end -end
\ No newline at end of file +end diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb index c8c923a6f2..bea5115f35 100644 --- a/lib/chef/win32/version.rb +++ b/lib/chef/win32/version.rb @@ -30,13 +30,13 @@ class Chef # http://msdn.microsoft.com/en-us/library/ms724358(v=vs.85).aspx private - + def self.get_system_metrics(n_index) Win32API.new('user32', 'GetSystemMetrics', 'I', 'I').call(n_index) end public - + WIN_VERSIONS = { "Windows 8" => {:major => 6, :minor => 2, :callable => lambda{ @product_type == VER_NT_WORKSTATION }}, "Windows Server 2012" => {:major => 6, :minor => 2, :callable => lambda{ @product_type != VER_NT_WORKSTATION }}, @@ -68,7 +68,7 @@ class Chef # The get_product_info API is not supported on Win2k3, # use an alternative to identify datacenter skus @sku = get_datacenter_product_info_windows_server_2003(ver_info) - end + end end marketing_names = Array.new diff --git a/spec/data/apt/chef-integration-test-1.0/debian/rules b/spec/data/apt/chef-integration-test-1.0/debian/rules index b760bee7f4..955dd78b6a 100755 --- a/spec/data/apt/chef-integration-test-1.0/debian/rules +++ b/spec/data/apt/chef-integration-test-1.0/debian/rules @@ -10,4 +10,4 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ diff --git a/spec/data/apt/chef-integration-test-1.1/debian/rules b/spec/data/apt/chef-integration-test-1.1/debian/rules index b760bee7f4..955dd78b6a 100755 --- a/spec/data/apt/chef-integration-test-1.1/debian/rules +++ b/spec/data/apt/chef-integration-test-1.1/debian/rules @@ -10,4 +10,4 @@ #export DH_VERBOSE=1 %: - dh $@ + dh $@ diff --git a/spec/data/apt/chef-integration-test_1.0-1_amd64.changes b/spec/data/apt/chef-integration-test_1.0-1_amd64.changes index 4746b834e5..350cc7485c 100644 --- a/spec/data/apt/chef-integration-test_1.0-1_amd64.changes +++ b/spec/data/apt/chef-integration-test_1.0-1_amd64.changes @@ -8,15 +8,15 @@ Distribution: unstable Urgency: low Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> Changed-By: Joshua Timberman <joshua@opscode.com> -Description: +Description: chef-integration-test - Chef integration tests for APT in Cucumber -Changes: +Changes: chef-integration-test (1.0-1) unstable; urgency=low . * Initial release (Closes: #CHEF-1718) -Checksums-Sha1: +Checksums-Sha1: b44685ff59626bc94c67e60665f06c4643fe9767 1680 chef-integration-test_1.0-1_amd64.deb -Checksums-Sha256: +Checksums-Sha256: da176f4405fa21fd7207d4785680c6996d395a1ca132f2d5565a61c5479b1116 1680 chef-integration-test_1.0-1_amd64.deb -Files: +Files: 713722480408ecc8e7220aea52bdd76e 1680 ruby extra chef-integration-test_1.0-1_amd64.deb diff --git a/spec/data/apt/chef-integration-test_1.1-1_amd64.changes b/spec/data/apt/chef-integration-test_1.1-1_amd64.changes index f014de813b..70246eff4e 100644 --- a/spec/data/apt/chef-integration-test_1.1-1_amd64.changes +++ b/spec/data/apt/chef-integration-test_1.1-1_amd64.changes @@ -8,15 +8,15 @@ Distribution: unstable Urgency: low Maintainer: Joshua Timberman <Joshua Timberman <joshua@opscode.com>> Changed-By: Joshua Timberman <joshua@opscode.com> -Description: +Description: chef-integration-test - Chef integration tests for APT in Cucumber -Changes: +Changes: chef-integration-test (1.1-1) unstable; urgency=low . * New upstream release (1.1) -Checksums-Sha1: +Checksums-Sha1: 43c5653a9a5b9419849173a4ec3a9855cf0327a3 1722 chef-integration-test_1.1-1_amd64.deb -Checksums-Sha256: +Checksums-Sha256: 84e2f087f7e11d1b73743007ecfc6b8b34e03f6917c0993b35c0758ee59702c1 1722 chef-integration-test_1.1-1_amd64.deb -Files: +Files: 4b05bace483dbca54efc21f97ee47e1d 1722 ruby extra chef-integration-test_1.1-1_amd64.deb diff --git a/spec/data/bad-config.rb b/spec/data/bad-config.rb index 5477a69366..0ae6cb8b6f 100644 --- a/spec/data/bad-config.rb +++ b/spec/data/bad-config.rb @@ -1 +1 @@ -monkey_soup("tastes nice")
\ No newline at end of file +monkey_soup("tastes nice") diff --git a/spec/data/big_json.json b/spec/data/big_json.json index 96c2818894..e795cfc36a 100644 --- a/spec/data/big_json.json +++ b/spec/data/big_json.json @@ -1,2 +1,2 @@ {"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":"test" -}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
\ No newline at end of file +}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} diff --git a/spec/data/bootstrap/test.erb b/spec/data/bootstrap/test.erb index 7cdc7dfdd0..e0ba0d630f 100644 --- a/spec/data/bootstrap/test.erb +++ b/spec/data/bootstrap/test.erb @@ -1 +1 @@ -<%= first_boot.to_json %>
\ No newline at end of file +<%= first_boot.to_json %> diff --git a/spec/data/cb_version_cookbooks/tatft/README.rdoc b/spec/data/cb_version_cookbooks/tatft/README.rdoc index 460d96b40d..103517ba62 100644 --- a/spec/data/cb_version_cookbooks/tatft/README.rdoc +++ b/spec/data/cb_version_cookbooks/tatft/README.rdoc @@ -1,3 +1,3 @@ = THIS RECIPE * is for testing CookbookLoader/CookbookVersion -* has at least one of every kind of file that cookbooks can have
\ No newline at end of file +* has at least one of every kind of file that cookbooks can have diff --git a/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb b/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb index 3912b37365..8b9f134364 100644 --- a/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb +++ b/spec/data/cb_version_cookbooks/tatft/definitions/runit_service.rb @@ -1 +1 @@ -# IRL the runit_service is a definition to set up runit services
\ No newline at end of file +# IRL the runit_service is a definition to set up runit services diff --git a/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz b/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz index 3e7496601e..ba7be4266c 100644 --- a/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz +++ b/spec/data/cb_version_cookbooks/tatft/files/default/giant_blob.tgz @@ -1 +1 @@ -# not really a giant blob #
\ No newline at end of file +# not really a giant blob # diff --git a/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb b/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb index fea05ba67b..490c0ee0a0 100644 --- a/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb +++ b/spec/data/cb_version_cookbooks/tatft/libraries/ownage.rb @@ -1 +1 @@ -# 0wnage
\ No newline at end of file +# 0wnage diff --git a/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb b/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb index 977ad19192..2aa056f7d8 100644 --- a/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb +++ b/spec/data/cb_version_cookbooks/tatft/providers/lwp.rb @@ -1 +1 @@ -# a LWP
\ No newline at end of file +# a LWP diff --git a/spec/data/cb_version_cookbooks/tatft/recipes/default.rb b/spec/data/cb_version_cookbooks/tatft/recipes/default.rb index 48eacf848b..3db8a65e45 100644 --- a/spec/data/cb_version_cookbooks/tatft/recipes/default.rb +++ b/spec/data/cb_version_cookbooks/tatft/recipes/default.rb @@ -1 +1 @@ -# the default recipe
\ No newline at end of file +# the default recipe diff --git a/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb b/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb index 987114f4ca..cda9440331 100644 --- a/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb +++ b/spec/data/cb_version_cookbooks/tatft/resources/lwr.rb @@ -1 +1 @@ -# a LWR #
\ No newline at end of file +# a LWR # diff --git a/spec/data/checksum/random.txt b/spec/data/checksum/random.txt index 9570fff833..45f087a281 100644 --- a/spec/data/checksum/random.txt +++ b/spec/data/checksum/random.txt @@ -1 +1 @@ -e4010abcac515ef3b78e92ee1f848a0d3bc3a526fcb826e7b4d39a6d516aa0487085c9b1be35e8d909617b250dca36dd4a55f01b7cdd310826bfd748cb27e0e43dd52b22968383c8086b06ee2d16e13574f98c058ce2bc3475b92ecf9c16e504022d60b132643986a8e7908d067526e20b4bafe1eb75349f27a4d3de02b077e76a2f59b73c14413f11e7208ae0bf6a408d51a97d490530e23476960ab8780ad86349947d82f1c9e57c85f86d71f80a6709b58be5f993a6a6df80c5a0857627d4a01e71484f6a6e983985089c00fe538e947230813c3a3e19baf6dae6db7082d07392a239ec1be385646356db3e3d76571488a6c72f0b96997f6191beea9846fc99f82a828f05af95cfc234cf681002f830915b1f3d35b2178b54a861c05d2694c5f6cfeb613a4a3670d849180461cdedf2c3cbb022608d8b19c86179d2d6da6b9acefccfc34b59663ef1282fec262bef79b2fbdd9b6669c90d6817b3762164dc309616469b33b83b1ded3420ae9177bc8f456d83939ff3c91b0a3683f3157401ceadf679c9f876da2aa413e081ee4c41d4b04f49e0c254d0082fd9bf2cb8eb8b966285be2cdcaab0ab70ea970737244b6683283598c30bdc206a05df72048b342eb40c2cd750c815d5fa944167b103ec40d60a99c49941a9e76d874149524f35ca294d081cf221757df77e027640556d983978be6b4b51aff26cd74a2f300d71
\ No newline at end of file +e4010abcac515ef3b78e92ee1f848a0d3bc3a526fcb826e7b4d39a6d516aa0487085c9b1be35e8d909617b250dca36dd4a55f01b7cdd310826bfd748cb27e0e43dd52b22968383c8086b06ee2d16e13574f98c058ce2bc3475b92ecf9c16e504022d60b132643986a8e7908d067526e20b4bafe1eb75349f27a4d3de02b077e76a2f59b73c14413f11e7208ae0bf6a408d51a97d490530e23476960ab8780ad86349947d82f1c9e57c85f86d71f80a6709b58be5f993a6a6df80c5a0857627d4a01e71484f6a6e983985089c00fe538e947230813c3a3e19baf6dae6db7082d07392a239ec1be385646356db3e3d76571488a6c72f0b96997f6191beea9846fc99f82a828f05af95cfc234cf681002f830915b1f3d35b2178b54a861c05d2694c5f6cfeb613a4a3670d849180461cdedf2c3cbb022608d8b19c86179d2d6da6b9acefccfc34b59663ef1282fec262bef79b2fbdd9b6669c90d6817b3762164dc309616469b33b83b1ded3420ae9177bc8f456d83939ff3c91b0a3683f3157401ceadf679c9f876da2aa413e081ee4c41d4b04f49e0c254d0082fd9bf2cb8eb8b966285be2cdcaab0ab70ea970737244b6683283598c30bdc206a05df72048b342eb40c2cd750c815d5fa944167b103ec40d60a99c49941a9e76d874149524f35ca294d081cf221757df77e027640556d983978be6b4b51aff26cd74a2f300d71 diff --git a/spec/data/config.rb b/spec/data/config.rb index 0b3340ce57..6beae90467 100644 --- a/spec/data/config.rb +++ b/spec/data/config.rb @@ -1,6 +1,6 @@ # # Sample Chef Config File -# +# cookbook_path "/etc/chef/cookbook", "/etc/chef/site-cookbook" diff --git a/spec/data/cookbooks/apache2/recipes/default.rb b/spec/data/cookbooks/apache2/recipes/default.rb index c2fa53be32..2d5457807e 100644 --- a/spec/data/cookbooks/apache2/recipes/default.rb +++ b/spec/data/cookbooks/apache2/recipes/default.rb @@ -1,3 +1,3 @@ # # Nothing ot see here -#
\ No newline at end of file +# diff --git a/spec/data/cookbooks/borken/recipes/default.rb b/spec/data/cookbooks/borken/recipes/default.rb index caf40b3974..8063e32a95 100644 --- a/spec/data/cookbooks/borken/recipes/default.rb +++ b/spec/data/cookbooks/borken/recipes/default.rb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===))))))
\ No newline at end of file +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) diff --git a/spec/data/cookbooks/borken/templates/default/borken.erb b/spec/data/cookbooks/borken/templates/default/borken.erb index cbb32c1cd7..35321266ba 100644 --- a/spec/data/cookbooks/borken/templates/default/borken.erb +++ b/spec/data/cookbooks/borken/templates/default/borken.erb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -<%= (*&)(*^^^^*******++_+_--- }}}}]]]end)%>
\ No newline at end of file +<%= (*&)(*^^^^*******++_+_--- }}}}]]]end)%> diff --git a/spec/data/cookbooks/ignorken/recipes/default.rb b/spec/data/cookbooks/ignorken/recipes/default.rb index 0f3b3a5d8d..921f80018a 100644 --- a/spec/data/cookbooks/ignorken/recipes/default.rb +++ b/spec/data/cookbooks/ignorken/recipes/default.rb @@ -1 +1 @@ -# This is fine!
\ No newline at end of file +# This is fine! diff --git a/spec/data/cookbooks/ignorken/recipes/ignoreme.rb b/spec/data/cookbooks/ignorken/recipes/ignoreme.rb index caf40b3974..8063e32a95 100644 --- a/spec/data/cookbooks/ignorken/recipes/ignoreme.rb +++ b/spec/data/cookbooks/ignorken/recipes/ignoreme.rb @@ -1,2 +1,2 @@ a cat walked on the keyboard one day... -(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===))))))
\ No newline at end of file +(*&(*&(*&(*&(*^%$%^%#^^&(*)(*{}}}}}}}}+++++===)))))) diff --git a/spec/data/cookbooks/java/files/default/java.response b/spec/data/cookbooks/java/files/default/java.response index eb4aa3c124..ca275ecf76 100644 --- a/spec/data/cookbooks/java/files/default/java.response +++ b/spec/data/cookbooks/java/files/default/java.response @@ -1,2 +1,2 @@ # Hi, I'm pretending to be the preseed file for installing the Sun JDK on debian -# or Ubuntu
\ No newline at end of file +# or Ubuntu diff --git a/spec/data/cookbooks/openldap/attributes/default.rb b/spec/data/cookbooks/openldap/attributes/default.rb index d0756f17e3..0cc8c6a55f 100644 --- a/spec/data/cookbooks/openldap/attributes/default.rb +++ b/spec/data/cookbooks/openldap/attributes/default.rb @@ -12,5 +12,5 @@ else default[:ldap_server] = "ops1prod" default[:ldap_basedn] = "dc=hjksolutions,dc=com" - default[:ldap_replication_password] = "forsure" + default[:ldap_replication_password] = "forsure" end diff --git a/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa b/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa index 20a3ea410a..ed61f6b9c4 100644 --- a/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa +++ b/spec/data/cookbooks/openldap/files/default/.ssh/id_rsa @@ -1 +1 @@ -FAKE KEY
\ No newline at end of file +FAKE KEY diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt index 7632730912..8a90b78aac 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remote_dir_file1.txt
\ No newline at end of file +# relpath: remotedir/remote_dir_file1.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt index fab0433922..0e3509a78c 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remote_dir_file2.txt
\ No newline at end of file +# relpath: remotedir/remote_dir_file2.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt index 611294cb81..b970be4122 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file1.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remotesubdir/remote_dir_file1.txt
\ No newline at end of file +# relpath: remotedir/remotesubdir/remote_dir_file1.txt diff --git a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt index e0396542a4..a82def80b2 100644 --- a/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt +++ b/spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/remote_subdir_file2.txt @@ -1,3 +1,3 @@ # remote directory # file specificity: default -# relpath: remotedir/remotesubdir/remote_dir_file2.txt
\ No newline at end of file +# relpath: remotedir/remotesubdir/remote_dir_file2.txt diff --git a/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb b/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb index af82f1d96c..ca40f8425b 100644 --- a/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb +++ b/spec/data/cookbooks/openldap/templates/default/openldap_stuff.conf.erb @@ -1 +1 @@ -slappiness is <%= node[:slappiness] -%>
\ No newline at end of file +slappiness is <%= node[:slappiness] -%> diff --git a/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb b/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb index fa25999b6a..1957786e74 100644 --- a/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb +++ b/spec/data/cookbooks/openldap/templates/default/some_windows_line_endings.erb @@ -1,4 +1,3 @@ Template rendering libraries -should support
+should support different line endings -
diff --git a/spec/data/definitions/test.rb b/spec/data/definitions/test.rb index b0d0effc27..aaec15b8a0 100644 --- a/spec/data/definitions/test.rb +++ b/spec/data/definitions/test.rb @@ -2,4 +2,4 @@ define :rico_suave, :rich => "smooth" do zen_master "test" do something "#{params[:rich]}" end -end
\ No newline at end of file +end diff --git a/spec/data/environment-config.rb b/spec/data/environment-config.rb index a157ecf0ea..984017b57a 100644 --- a/spec/data/environment-config.rb +++ b/spec/data/environment-config.rb @@ -2,4 +2,4 @@ # Sample Chef Config File # -environment "production"
\ No newline at end of file +environment "production" diff --git a/spec/data/kitchen/openldap/attributes/robinson.rb b/spec/data/kitchen/openldap/attributes/robinson.rb index 9d6b44d464..8c7d52c268 100644 --- a/spec/data/kitchen/openldap/attributes/robinson.rb +++ b/spec/data/kitchen/openldap/attributes/robinson.rb @@ -1,3 +1,3 @@ # # Smokey lives here -#
\ No newline at end of file +# diff --git a/spec/data/kitchen/openldap/definitions/drewbarrymore.rb b/spec/data/kitchen/openldap/definitions/drewbarrymore.rb index 510f0c35da..83bb5b1a15 100644 --- a/spec/data/kitchen/openldap/definitions/drewbarrymore.rb +++ b/spec/data/kitchen/openldap/definitions/drewbarrymore.rb @@ -1,3 +1,3 @@ # -# Was in people magazine this month... -#
\ No newline at end of file +# Was in people magazine this month... +# diff --git a/spec/data/kitchen/openldap/recipes/gigantor.rb b/spec/data/kitchen/openldap/recipes/gigantor.rb index 70a41960eb..0ac8a9bb4b 100644 --- a/spec/data/kitchen/openldap/recipes/gigantor.rb +++ b/spec/data/kitchen/openldap/recipes/gigantor.rb @@ -1,3 +1,3 @@ cat "blanket" do pretty_kitty true -end
\ No newline at end of file +end diff --git a/spec/data/kitchen/openldap/recipes/ignoreme.rb b/spec/data/kitchen/openldap/recipes/ignoreme.rb index 15095986c6..d80a313a50 100644 --- a/spec/data/kitchen/openldap/recipes/ignoreme.rb +++ b/spec/data/kitchen/openldap/recipes/ignoreme.rb @@ -1,3 +1,3 @@ # # this file will never be seen -#
\ No newline at end of file +# diff --git a/spec/data/knife_subcommand/test_explicit_category.rb b/spec/data/knife_subcommand/test_explicit_category.rb index 96d50691a1..2b68c161af 100644 --- a/spec/data/knife_subcommand/test_explicit_category.rb +++ b/spec/data/knife_subcommand/test_explicit_category.rb @@ -4,4 +4,4 @@ module KnifeSpecs # category instead of cookbook (which is what would be assumed) category "cookbook site" end -end
\ No newline at end of file +end diff --git a/spec/data/knife_subcommand/test_name_mapping.rb b/spec/data/knife_subcommand/test_name_mapping.rb index 25c49b0df0..8fcf1b6a1d 100644 --- a/spec/data/knife_subcommand/test_name_mapping.rb +++ b/spec/data/knife_subcommand/test_name_mapping.rb @@ -1,4 +1,4 @@ module KnifeSpecs class TestNameMapping < Chef::Knife - end + end end diff --git a/spec/data/lwrp_override/providers/buck_passer.rb b/spec/data/lwrp_override/providers/buck_passer.rb index 75917a58c9..8d5156af81 100644 --- a/spec/data/lwrp_override/providers/buck_passer.rb +++ b/spec/data/lwrp_override/providers/buck_passer.rb @@ -7,4 +7,4 @@ action :pass_buck do action :twiddle_thumbs provider :lwrp_thumb_twiddler end -end
\ No newline at end of file +end diff --git a/spec/data/recipes/test.rb b/spec/data/recipes/test.rb index c33d714a2c..89ae003ab5 100644 --- a/spec/data/recipes/test.rb +++ b/spec/data/recipes/test.rb @@ -1,7 +1,7 @@ -file "/etc/nsswitch.conf" do +file "/etc/nsswitch.conf" do action :create owner "root" - group "root" + group "root" mode 0644 end diff --git a/spec/data/remote_directory_data/remote_dir_file.txt b/spec/data/remote_directory_data/remote_dir_file.txt index 17aa3a6838..96efb55215 100644 --- a/spec/data/remote_directory_data/remote_dir_file.txt +++ b/spec/data/remote_directory_data/remote_dir_file.txt @@ -1 +1 @@ -I'm a file inside a the root remote_directory source dir.
\ No newline at end of file +I'm a file inside a the root remote_directory source dir. diff --git a/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt b/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt index a73728a4bb..2531df2345 100644 --- a/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt +++ b/spec/data/remote_directory_data/remote_subdirectory/remote_subdir_file.txt @@ -1 +1 @@ -I'm a file in a subdirectory inside a remote_directory source
\ No newline at end of file +I'm a file in a subdirectory inside a remote_directory source diff --git a/spec/data/shef-config.rb b/spec/data/shef-config.rb index 3c3ae9045a..378ac29e65 100644 --- a/spec/data/shef-config.rb +++ b/spec/data/shef-config.rb @@ -1,6 +1,6 @@ -Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' +Ohai::Config[:disabled_plugins] << 'darwin::system_profiler' << 'darwin::kernel' << 'darwin::ssh_host_key' << 'network_listeners' Ohai::Config[:disabled_plugins] << "virtualization" << "darwin::virtualization" -Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' +Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java' Ohai::Config[:disabled_plugins] << "linux::block_device" << "linux::kernel" << "linux::ssh_host_key" << "linux::virtualization" Ohai::Config[:disabled_plugins] << "linux::cpu" << "linux::memory" << "ec2" << "rackspace" << "eucalyptus" << "ip_scopes" Ohai::Config[:disabled_plugins] << "solaris2::cpu" << "solaris2::dmi" << "solaris2::filesystem" << "solaris2::kernel" diff --git a/spec/data/templates/seattle.txt b/spec/data/templates/seattle.txt index 19f6290939..e1b2fe006e 100644 --- a/spec/data/templates/seattle.txt +++ b/spec/data/templates/seattle.txt @@ -1 +1 @@ -Seattle is a great town. Next time you visit, you should buy me a beer.
\ No newline at end of file +Seattle is a great town. Next time you visit, you should buy me a beer. diff --git a/spec/functional/knife/cookbook_delete_spec.rb b/spec/functional/knife/cookbook_delete_spec.rb index 1dbd604ca5..2d52fb91a3 100644 --- a/spec/functional/knife/cookbook_delete_spec.rb +++ b/spec/functional/knife/cookbook_delete_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -94,7 +94,7 @@ describe Chef::Knife::CookbookDelete do stdout.string.should match(/#{Regexp.escape('Are you sure you want to purge files')}/) stdout.string.should match(/#{Regexp.escape('Do you really want to delete obsolete-cookbook version 1.0.0? (Y/N)')}/) cb100_deleted.should be_true - + end end diff --git a/spec/functional/resource/batch_spec.rb b/spec/functional/resource/batch_spec.rb index 7f7125a91e..818cc7a0f4 100644 --- a/spec/functional/resource/batch_spec.rb +++ b/spec/functional/resource/batch_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,14 +22,14 @@ shared_context Chef::Resource::WindowsScript do before(:all) do ohai_reader = Ohai::System.new - ohai_reader.require_plugin("os") + ohai_reader.require_plugin("os") ohai_reader.require_plugin("windows::platform") new_node = Chef::Node.new new_node.consume_external_attrs(ohai_reader.data,{}) - + events = Chef::EventDispatch::Dispatcher.new - + @run_context = Chef::RunContext.new(new_node, {}, events) end @@ -38,7 +38,7 @@ shared_context Chef::Resource::WindowsScript do end before(:each) do -k File.delete(script_output_path) if File.exists?(script_output_path) +k File.delete(script_output_path) if File.exists?(script_output_path) end after(:each) do @@ -54,11 +54,11 @@ describe Chef::Resource::WindowsScript::Batch, :windows_only do end context "when the run action is invoked on Windows" do - include_context Chef::Resource::WindowsScript + include_context Chef::Resource::WindowsScript it "executes the script code" do resource.code(script_content + " > #{script_output_path}") resource.returns(0) resource.run_action(:run) end - end + end end diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb index 35be2bbaa6..4c20023d78 100644 --- a/spec/functional/resource/cron_spec.rb +++ b/spec/functional/resource/cron_spec.rb @@ -78,7 +78,7 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do it "should delete a crontab entry" do # Note that test cron is created by previous test new_resource.run_action(:delete) - + cron_should_not_exists(new_resource.name) end end @@ -144,4 +144,4 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do end end -end
\ No newline at end of file +end diff --git a/spec/functional/resource/mount_spec.rb b/spec/functional/resource/mount_spec.rb index 4070cacfda..7eedfeab41 100644 --- a/spec/functional/resource/mount_spec.rb +++ b/spec/functional/resource/mount_spec.rb @@ -83,7 +83,7 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do validation_cmd << " | grep #{options.join(',')} " unless options.nil? || options.empty? puts "validation_cmd = #{validation_cmd}" expect(shell_out(validation_cmd).exitstatus).to eq(0) - end + end end def mount_should_not_exists(mount_point) @@ -100,7 +100,7 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do else mount_config = "/etc/fstab" end - end + end def mount_should_be_enabled(mount_point, device) if windows? @@ -108,10 +108,10 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do case ohai[:platform] when 'aix' expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}:\" ").exitstatus).to eq(0) - else + else expect(shell_out("cat #{unix_mount_config_file} | grep \"#{mount_point}\" | grep \"#{device}\" ").exitstatus).to eq(0) end - end + end end def mount_should_be_disabled(mount_point) @@ -228,4 +228,4 @@ describe Chef::Resource::Mount, :requires_root, :external => include_flag do mount_should_be_disabled(new_resource.mount_point) end end -end
\ No newline at end of file +end diff --git a/spec/functional/resource/powershell_spec.rb b/spec/functional/resource/powershell_spec.rb index 4d31eb3ef1..d217515ce1 100644 --- a/spec/functional/resource/powershell_spec.rb +++ b/spec/functional/resource/powershell_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'functional/resource/batch_spec.rb' describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do - include_context Chef::Resource::WindowsScript + include_context Chef::Resource::WindowsScript let(:successful_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe $env:systemroot" } let(:failed_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe /badargument" } @@ -36,7 +36,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do let(:arbitrary_nonzero_process_exit_code) { 4193 } let(:arbitrary_nonzero_process_exit_code_content) { "exit #{arbitrary_nonzero_process_exit_code}" } let(:invalid_powershell_interpreter_flag) { "/thisflagisinvalid" } - let(:valid_powershell_interpreter_flag) { "-Sta" } + let(:valid_powershell_interpreter_flag) { "-Sta" } let!(:resource) do r = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context) r.code(successful_executable_script_content) @@ -53,31 +53,31 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do it "returns the process exit code" do resource.code(arbitrary_nonzero_process_exit_code_content) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a cmdlet that succeeded" do resource.code(cmdlet_exit_code_success_content) resource.returns(0) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a cmdlet that succeeded and was preceded by a non-cmdlet Windows binary that failed" do resource.code([windows_process_exit_code_not_found_content, cmdlet_exit_code_success_content].join(';')) resource.returns(0) - resource.run_action(:run) + resource.run_action(:run) end - + it "returns 1 if the last command was a cmdlet that failed" do resource.code(cmdlet_exit_code_not_found_content) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end it "returns 1 if the last command was a cmdlet that failed and was preceded by a successfully executed non-cmdlet Windows binary" do resource.code([windows_process_exit_code_success_content, cmdlet_exit_code_not_found_content].join(';')) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end # This somewhat ambiguous case, two failures of different types, @@ -91,34 +91,34 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do it "returns 1 if the last command was a cmdlet that failed and was preceded by an unsuccessfully executed non-cmdlet Windows binary" do resource.code([arbitrary_nonzero_process_exit_code_content,cmdlet_exit_code_not_found_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if the last command was a non-cmdlet Windows binary that succeeded and was preceded by a failed cmdlet" do resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end - + it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that succeeded" do resource.code([cmdlet_exit_code_success_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end it "returns a specific error code if the last command was a non-cmdlet Windows binary that failed and was preceded by cmdlet that failed" do resource.code([cmdlet_exit_code_not_found_content, arbitrary_nonzero_process_exit_code_content].join(';')) resource.returns(arbitrary_nonzero_process_exit_code) - resource.run_action(:run) + resource.run_action(:run) end - + it "executes a script with a 64-bit process on a 64-bit OS, otherwise a 32-bit process" do resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}") resource.returns(0) resource.run_action(:run) is_64_bit = (ENV['PROCESSOR_ARCHITECTURE'] == 'AMD64') || (ENV['PROCESSOR_ARCHITEW6432'] == 'AMD64') - + detected_64_bit = source_contains_case_insensitive_content?( get_script_output, 'AMD64' ) is_64_bit.should == detected_64_bit @@ -128,15 +128,15 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do resource.code(cmdlet_exit_code_success_content) resource.flags(invalid_powershell_interpreter_flag) resource.returns(1) - resource.run_action(:run) + resource.run_action(:run) end it "returns 0 if a valid flag is passed to the interpreter" do resource.code(cmdlet_exit_code_success_content) resource.flags(valid_powershell_interpreter_flag) resource.returns(0) - resource.run_action(:run) - end + resource.run_action(:run) + end end context "when running on a 32-bit version of Windows", :windows32_only do @@ -167,7 +167,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do source_contains_case_insensitive_content?( get_script_output, 'AMD64' ).should == true end - + it "executes a script with a 32-bit process if :i386 arch is specified" do resource.code(processor_architecture_script_content + " | out-file -encoding ASCII #{script_output_path}") resource.architecture(:i386) diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb index 518f1f7adf..64bd28f16c 100644 --- a/spec/functional/shell_spec.rb +++ b/spec/functional/shell_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -58,7 +58,7 @@ describe Shell do sleep 0.01 end exitstatus[1] - end + end def run_chef_shell_with(options) case ohai[:platform] diff --git a/spec/functional/tiny_server_spec.rb b/spec/functional/tiny_server_spec.rb index 68ab9e7294..4262d9e536 100644 --- a/spec/functional/tiny_server_spec.rb +++ b/spec/functional/tiny_server_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/functional/win32/versions_spec.rb b/spec/functional/win32/versions_spec.rb index 5cf3a13fd8..acb8bb126d 100644 --- a/spec/functional/win32/versions_spec.rb +++ b/spec/functional/win32/versions_spec.rb @@ -44,7 +44,7 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only do # The name from WMI is actually what we want in Win2k8R2+. # So this expectation sould continue to hold without modification # as new versions of Windows are released. - @current_os_version = host.caption + @current_os_version = host.caption end @version = Chef::ReservedNames::Win32::Version.new @@ -55,10 +55,10 @@ describe "Chef::ReservedNames::Win32::Version", :windows_only do @current_os_version.should include(@version.marketing_name) end end - + def is_windows_server_2008?(wmi_host) is_win2k8 = false - + os_version = wmi_host.send('Version') # The operating system version is a string in the following form diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb index eb5761bded..bb7dc17856 100644 --- a/spec/integration/knife/download_spec.rb +++ b/spec/integration/knife/download_spec.rb @@ -592,7 +592,7 @@ EOM context 'except the role file is textually different, but not ACTUALLY different' do file 'roles/x.json', <<EOM -{ +{ "chef_type": "role" , "default_attributes": { }, @@ -604,7 +604,7 @@ EOM "override_attributes": { }, "run_list": [ - + ] } EOM diff --git a/spec/support/lib/chef/provider/easy.rb b/spec/support/lib/chef/provider/easy.rb index 054b45256c..a4d285a838 100644 --- a/spec/support/lib/chef/provider/easy.rb +++ b/spec/support/lib/chef/provider/easy.rb @@ -6,9 +6,9 @@ # 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. @@ -22,11 +22,11 @@ class Chef def load_current_resource true end - + def action_sell true end - + def action_buy true end diff --git a/spec/support/lib/chef/provider/snakeoil.rb b/spec/support/lib/chef/provider/snakeoil.rb index c5d8d52a82..e9d01f654f 100644 --- a/spec/support/lib/chef/provider/snakeoil.rb +++ b/spec/support/lib/chef/provider/snakeoil.rb @@ -6,9 +6,9 @@ # 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. @@ -22,7 +22,7 @@ class Chef def load_current_resource true end - + def action_purr @new_resource.updated_by_last_action(true) true @@ -31,7 +31,7 @@ class Chef def action_sell true end - + def action_buy true end diff --git a/spec/support/lib/chef/resource/cat.rb b/spec/support/lib/chef/resource/cat.rb index 83eb9f08a3..ecca50cb53 100644 --- a/spec/support/lib/chef/resource/cat.rb +++ b/spec/support/lib/chef/resource/cat.rb @@ -6,9 +6,9 @@ # 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. @@ -19,15 +19,15 @@ class Chef class Resource class Cat < Chef::Resource - + attr_accessor :action - + def initialize(name, run_context=nil) @resource_name = :cat super @action = "sell" end - + def pretty_kitty(arg=nil) if arg == true or arg == false @pretty_kitty = arg diff --git a/spec/support/shared/unit/script_resource.rb b/spec/support/shared/unit/script_resource.rb index 0451f4694a..5f37506df6 100644 --- a/spec/support/shared/unit/script_resource.rb +++ b/spec/support/shared/unit/script_resource.rb @@ -7,9 +7,9 @@ # 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. @@ -23,26 +23,26 @@ shared_examples_for "a script resource" do before(:each) do @resource = script_resource - end + end it "should create a new Chef::Resource::Script" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Script) end - + it "should have a resource name of :script" do @resource.resource_name.should eql(resource_name) end - + it "should set command to the argument provided to new" do @resource.command.should eql(resource_instance_name) end - + it "should accept a string for the code" do @resource.code "hey jude" @resource.code.should eql("hey jude") end - + it "should accept a string for the flags" do @resource.flags "-f" @resource.flags.should eql("-f") diff --git a/spec/support/shared/unit/windows_script_resource.rb b/spec/support/shared/unit/windows_script_resource.rb index 0a0079a287..23dbfbe722 100644 --- a/spec/support/shared/unit/windows_script_resource.rb +++ b/spec/support/shared/unit/windows_script_resource.rb @@ -6,9 +6,9 @@ # 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. @@ -29,10 +29,10 @@ shared_examples_for "a Windows script resource" do node.default["kernel"][:machine] = :x86_64.to_s run_context = Chef::RunContext.new(node, nil, nil) - + @resource = resource_instance - end + end it "should be a kind of Chef::Resource::WindowsScript" do @resource.should be_a_kind_of(Chef::Resource) @@ -40,9 +40,9 @@ shared_examples_for "a Windows script resource" do end context "script" do - let(:script_resource) { resource_instance } - it_should_behave_like "a script resource" + let(:script_resource) { resource_instance } + it_should_behave_like "a script resource" end - + end diff --git a/spec/tiny_server.rb b/spec/tiny_server.rb index fb8dfc6290..340c5d5fb6 100644 --- a/spec/tiny_server.rb +++ b/spec/tiny_server.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/api_client/registration_spec.rb b/spec/unit/api_client/registration_spec.rb index 3efbe9914b..0d21730664 100644 --- a/spec/unit/api_client/registration_spec.rb +++ b/spec/unit/api_client/registration_spec.rb @@ -57,7 +57,7 @@ describe Chef::ApiClient::Registration do end it "creates a new ApiClient on the server using the validator identity" do - response = {"uri" => "https://chef.local/clients/silent-bob", + response = {"uri" => "https://chef.local/clients/silent-bob", "private_key" => "--begin rsa key etc--"} http_mock.should_receive(:post). with("clients", :name => 'silent-bob', :admin => false). diff --git a/spec/unit/application/apply.rb b/spec/unit/application/apply.rb index 8a00413225..0dc24544b0 100644 --- a/spec/unit/application/apply.rb +++ b/spec/unit/application/apply.rb @@ -60,7 +60,7 @@ describe Chef::Application::Apply do describe "temp_recipe_file" do before do @app.instance_variable_set(:@recipe_text, @recipe_text) - @app.temp_recipe_file + @app.temp_recipe_file @recipe_fh = @app.instance_variable_get(:@recipe_fh) end it "should open a tempfile" do diff --git a/spec/unit/chef_spec.rb b/spec/unit/chef_spec.rb index cf60e64629..b0f0359806 100644 --- a/spec/unit/chef_spec.rb +++ b/spec/unit/chef_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb index 2757f92506..9822146131 100644 --- a/spec/unit/cookbook/metadata_spec.rb +++ b/spec/unit/cookbook/metadata_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/cookbook/metadata' -describe Chef::Cookbook::Metadata do +describe Chef::Cookbook::Metadata do before(:each) do @cookbook = Chef::CookbookVersion.new('test_cookbook') @meta = Chef::Cookbook::Metadata.new(@cookbook) @@ -86,7 +86,7 @@ describe Chef::Cookbook::Metadata do it "should return a Chef::Cookbook::Metadata object" do @meta.should be_a_kind_of(Chef::Cookbook::Metadata) end - + it "should allow a cookbook as the first argument" do lambda { Chef::Cookbook::Metadata.new(@cookbook) }.should_not raise_error end @@ -96,7 +96,7 @@ describe Chef::Cookbook::Metadata do end it "should set the maintainer name from the second argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown') md.maintainer.should == 'Bobo T. Clown' end @@ -105,7 +105,7 @@ describe Chef::Cookbook::Metadata do end it "should set the maintainer email from the third argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co') md.maintainer_email.should == 'bobo@clown.co' end @@ -114,10 +114,10 @@ describe Chef::Cookbook::Metadata do end it "should set the license from the fourth argument" do - md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1') + md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1') md.license.should == 'Clown License v1' end - end + end describe "cookbook" do it "should return the cookbook we were initialized with" do @@ -133,7 +133,7 @@ describe Chef::Cookbook::Metadata do describe "platforms" do it "should return the current platform hash" do - @meta.platforms.should be_a_kind_of(Hash) + @meta.platforms.should be_a_kind_of(Hash) end end @@ -235,7 +235,7 @@ describe Chef::Cookbook::Metadata do end end end - + describe "attribute groupings" do it "should allow you set a grouping" do group = { @@ -312,7 +312,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:choice].should == [] end - + it "should let calculated be true or false" do lambda { @meta.attribute("db/mysql/databases", :calculated => true) @@ -324,7 +324,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", :calculated => Hash.new) }.should raise_error(ArgumentError) end - + it "should set calculated to false by default" do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:calculated].should == false @@ -350,7 +350,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", :type => "symbol") }.should_not raise_error(ArgumentError) end - + it "should let type be hash (backwards compatability only)" do lambda { @meta.attribute("db/mysql/databases", :type => "hash") @@ -375,7 +375,7 @@ describe Chef::Cookbook::Metadata do }.should_not raise_error(ArgumentError) #attrib = @meta.attributes["db/mysql/databases"][:required].should == "required" end - + it "should convert required false to optional" do lambda { @meta.attribute("db/mysql/databases", :required => false) @@ -387,7 +387,7 @@ describe Chef::Cookbook::Metadata do @meta.attribute("db/mysql/databases", {}) @meta.attributes["db/mysql/databases"][:required].should == 'optional' end - + it "should make sure recipes is an array" do lambda { @meta.attribute("db/mysql/databases", :recipes => []) @@ -399,7 +399,7 @@ describe Chef::Cookbook::Metadata do it "should set recipes to an empty array by default" do @meta.attribute("db/mysql/databases", {}) - @meta.attributes["db/mysql/databases"][:recipes].should == [] + @meta.attributes["db/mysql/databases"][:recipes].should == [] end it "should allow the default value to be a string, array, or hash" do @@ -438,14 +438,14 @@ describe Chef::Cookbook::Metadata do lambda { attrs = { :choice => [ "a", "b", "c"], - :default => "b" + :default => "b" } @meta.attribute("db/mysql/databases", attrs) }.should_not raise_error(ArgumentError) lambda { attrs = { :choice => [ "a", "b", "c", "d", "e"], - :default => ["b", "d"] + :default => ["b", "d"] } @meta.attribute("db/mysql/databases", attrs) }.should_not raise_error(ArgumentError) @@ -455,7 +455,7 @@ describe Chef::Cookbook::Metadata do lambda { attrs = { :choice => [ "a", "b", "c"], - :default => "d" + :default => "d" } @meta.attribute("db/mysql/databases", attrs) }.should raise_error(ArgumentError) @@ -470,11 +470,11 @@ describe Chef::Cookbook::Metadata do end describe "recipes" do - before(:each) do + before(:each) do @cookbook.recipe_files = [ "default.rb", "enlighten.rb" ] @meta = Chef::Cookbook::Metadata.new(@cookbook) end - + it "should have the names of the recipes" do @meta.recipes["test_cookbook"].should == "" @meta.recipes["test_cookbook::enlighten"].should == "" @@ -493,7 +493,7 @@ describe Chef::Cookbook::Metadata do end describe "json" do - before(:each) do + before(:each) do @cookbook.recipe_files = [ "default.rb", "enlighten.rb" ] @meta = Chef::Cookbook::Metadata.new(@cookbook) @meta.version "1.0" @@ -509,8 +509,8 @@ describe Chef::Cookbook::Metadata do @meta.provides "foo(:bar, :baz)" @meta.replaces "snarkitron" @meta.recipe "test_cookbook::enlighten", "is your buddy" - @meta.attribute "bizspark/has_login", - :display_name => "You have nothing" + @meta.attribute "bizspark/has_login", + :display_name => "You have nothing" @meta.version "1.2.3" end @@ -524,23 +524,23 @@ describe Chef::Cookbook::Metadata do end %w{ - name - description - long_description - maintainer - maintainer_email + name + description + long_description + maintainer + maintainer_email license - platforms - dependencies - suggestions - recommendations - conflicting + platforms + dependencies + suggestions + recommendations + conflicting providing - replacing - attributes + replacing + attributes recipes version - }.each do |t| + }.each do |t| it "should include '#{t}'" do @serial[t].should == @meta.send(t.to_sym) end @@ -557,23 +557,23 @@ describe Chef::Cookbook::Metadata do end %w{ - name - description - long_description - maintainer - maintainer_email + name + description + long_description + maintainer + maintainer_email license - platforms - dependencies - suggestions - recommendations - conflicting + platforms + dependencies + suggestions + recommendations + conflicting providing - replacing - attributes + replacing + attributes recipes version - }.each do |t| + }.each do |t| it "should match '#{t}'" do @deserial.send(t.to_sym).should == @meta.send(t.to_sym) end diff --git a/spec/unit/cookbook/synchronizer_spec.rb b/spec/unit/cookbook/synchronizer_spec.rb index 4c6aa0c0ed..31f30c5bf4 100644 --- a/spec/unit/cookbook/synchronizer_spec.rb +++ b/spec/unit/cookbook/synchronizer_spec.rb @@ -176,11 +176,11 @@ describe Chef::CookbookSynchronizer do @cookbook_a_template_default_tempfile = mock("Tempfile for cookbook_a apache.conf.erb template", :path => "/tmp/cookbook_a_template_default_tempfile") end - + after do Chef::Config[:no_lazy_load] = false end - + it "fetches templates and cookbook files" do @file_cache.should_receive(:has_key?). with("cookbooks/cookbook_a/files/default/megaman.conf"). @@ -206,7 +206,7 @@ describe Chef::CookbookSynchronizer do @file_cache.should_receive(:load). with("cookbooks/cookbook_a/templates/default/apache2.conf.erb", false). and_return("/file-cache/cookbooks/cookbook_a/templates/default/apache2.conf.erb") - + @synchronizer.sync_cookbooks end end diff --git a/spec/unit/cookbook_loader_spec.rb b/spec/unit/cookbook_loader_spec.rb index c3303dd09a..59079a82de 100644 --- a/spec/unit/cookbook_loader_spec.rb +++ b/spec/unit/cookbook_loader_spec.rb @@ -71,7 +71,7 @@ describe Chef::CookbookLoader do seen[5].should == "openldap" end end - + describe "load_cookbooks" do it "should find all the cookbooks in the cookbook path" do Chef::Config.cookbook_path << File.expand_path(File.join(CHEF_SPEC_DATA, "hidden-cookbooks")) @@ -79,7 +79,7 @@ describe Chef::CookbookLoader do @cookbook_loader.should have_key(:openldap) @cookbook_loader.should have_key(:apache2) end - + it "should allow you to override an attribute file via cookbook_path" do @cookbook_loader[:openldap].attribute_filenames.detect { |f| f =~ /cookbooks\/openldap\/attributes\/default.rb/ @@ -88,13 +88,13 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/attributes\/default.rb/ }.should eql(nil) end - + it "should load different attribute files from deeper paths" do @cookbook_loader[:openldap].attribute_filenames.detect { |f| f =~ /kitchen\/openldap\/attributes\/robinson.rb/ }.should_not eql(nil) end - + it "should allow you to override a definition file via cookbook_path" do @cookbook_loader[:openldap].definition_filenames.detect { |f| f =~ /cookbooks\/openldap\/definitions\/client.rb/ @@ -103,13 +103,13 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/definitions\/client.rb/ }.should eql(nil) end - + it "should load definition files from deeper paths" do @cookbook_loader[:openldap].definition_filenames.detect { |f| f =~ /kitchen\/openldap\/definitions\/drewbarrymore.rb/ }.should_not eql(nil) end - + it "should allow you to override a recipe file via cookbook_path" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /cookbooks\/openldap\/recipes\/gigantor.rb/ @@ -118,19 +118,19 @@ describe Chef::CookbookLoader do f =~ /kitchen\/openldap\/recipes\/gigantor.rb/ }.should eql(nil) end - + it "should load recipe files from deeper paths" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /kitchen\/openldap\/recipes\/woot.rb/ }.should_not eql(nil) end - + it "should allow you to have an 'ignore' file, which skips loading files in later cookbooks" do @cookbook_loader[:openldap].recipe_filenames.detect { |f| f =~ /kitchen\/openldap\/recipes\/ignoreme.rb/ }.should eql(nil) end - + it "should find files that start with a ." do @cookbook_loader[:openldap].file_filenames.detect { |f| f =~ /\.dotfile$/ @@ -139,7 +139,7 @@ describe Chef::CookbookLoader do f =~ /\.ssh\/id_rsa$/ }.should =~ /\.ssh\/id_rsa$/ end - + it "should load the metadata for the cookbook" do @cookbook_loader.metadata[:openldap].name.should == :openldap @cookbook_loader.metadata[:openldap].should be_a_kind_of(Chef::Cookbook::Metadata) @@ -202,7 +202,7 @@ describe Chef::CookbookLoader do end seen.should have_key("openldap") seen.should have_key("apache2") - end + end end end # loading only one cookbook end diff --git a/spec/unit/cookbook_manifest_spec.rb b/spec/unit/cookbook_manifest_spec.rb index 7da87e93a5..e87b8e1e9a 100644 --- a/spec/unit/cookbook_manifest_spec.rb +++ b/spec/unit/cookbook_manifest_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -96,7 +96,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-host-2", :specificity => "host-examplehost.example.org" }, - + { :name => "anotherfile1.rb", :path => "files/ubuntu-9.10/adirectory/anotherfile1.rb.platform-full-version", @@ -122,7 +122,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-platver-partial-2", :specificity => "nweubuntu-9" }, - + { :name => "anotherfile1.rb", :path => "files/ubuntu/adirectory/anotherfile1.rb.platform", @@ -135,7 +135,7 @@ describe "Chef::CookbookVersion manifest" do :checksum => "csum-plat-2", :specificity => "ubuntu" }, - + { :name => "anotherfile1.rb", :path => "files/default/adirectory/anotherfile1.rb.default", @@ -201,8 +201,8 @@ describe "Chef::CookbookVersion manifest" do } end - - + + it "should return a manifest record based on priority preference: host" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -213,7 +213,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-host" end - + it "should return a manifest record based on priority preference: platform & full version" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -235,7 +235,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-platver-partial" end - + it "should return a manifest record based on priority preference: platform only" do node = Chef::Node.new node.automatic_attrs[:platform] = "ubuntu" @@ -246,7 +246,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum-plat" end - + it "should return a manifest record based on priority preference: default" do node = Chef::Node.new node.automatic_attrs[:platform] = "notubuntu" @@ -301,7 +301,7 @@ describe "Chef::CookbookVersion manifest" do manifest_record.should_not be_nil manifest_record[:checksum].should == "csum4-platver-full" end - + describe "when fetching the contents of a directory by file specificity" do it "should return a directory of manifest records based on priority preference: host" do diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb index 6f46c81054..6bc5954fa5 100644 --- a/spec/unit/data_bag_item_spec.rb +++ b/spec/unit/data_bag_item_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -130,7 +130,7 @@ describe Chef::DataBagItem do end describe "to_hash" do - before(:each) do + before(:each) do @data_bag_item.data_bag("still_lost") @data_bag_item.raw_data = { "id" => "whoa", "i_know" => "kung_fu" } @to_hash = @data_bag_item.to_hash @@ -197,7 +197,7 @@ describe Chef::DataBagItem do before do @rest = mock("Chef::REST") Chef::REST.stub!(:new).and_return(@rest) - @data_bag_item['id'] = "heart of darkness" + @data_bag_item['id'] = "heart of darkness" raw_data = {"id" => "heart_of_darkness", "author" => "Conrad"} @data_bag_item.raw_data = raw_data @data_bag_item.data_bag("books") @@ -207,7 +207,7 @@ describe Chef::DataBagItem do @data_bag_item.save end - it "should create if the item is not found" do + it "should create if the item is not found" do exception = mock("404 error", :code => "404") @rest.should_receive(:put_rest).and_raise(Net::HTTPServerException.new("foo", exception)) @rest.should_receive(:post_rest).with("data/books", @data_bag_item) @@ -228,7 +228,7 @@ describe Chef::DataBagItem do end end - + end describe "when loading" do diff --git a/spec/unit/data_bag_spec.rb b/spec/unit/data_bag_spec.rb index 273ef38d9f..d8ad535915 100644 --- a/spec/unit/data_bag_spec.rb +++ b/spec/unit/data_bag_spec.rb @@ -69,7 +69,7 @@ describe Chef::DataBag do end - describe "when saving" do + describe "when saving" do before do @data_bag.name('piggly_wiggly') @rest = mock("Chef::REST") @@ -77,16 +77,16 @@ describe Chef::DataBag do end it "should update the data bag when it already exists" do - @rest.should_receive(:put_rest).with("data/piggly_wiggly", @data_bag) + @rest.should_receive(:put_rest).with("data/piggly_wiggly", @data_bag) @data_bag.save end - it "should create the data bag when it is not found" do + it "should create the data bag when it is not found" do exception = mock("404 error", :code => "404") @rest.should_receive(:put_rest).and_raise(Net::HTTPServerException.new("foo", exception)) @rest.should_receive(:post_rest).with("data", @data_bag) @data_bag.save - end + end describe "when whyrun mode is enabled" do before do diff --git a/spec/unit/digester_spec.rb b/spec/unit/digester_spec.rb index 28e3e918fe..7f0074c670 100644 --- a/spec/unit/digester_spec.rb +++ b/spec/unit/digester_spec.rb @@ -8,9 +8,9 @@ # 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. @@ -34,7 +34,7 @@ describe Chef::Digester do it "computes a checksum of a file" do fixture_file = CHEF_SPEC_DATA + "/checksum/random.txt" - expected = "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394" + expected = "dc6665c18676f5f30fdaa420343960edf1883790f83f51f437dbfa0ff678499d" @cache.checksum_for_file(fixture_file).should == expected end diff --git a/spec/unit/file_cache_spec.rb b/spec/unit/file_cache_spec.rb index 6596326565..7680852cb9 100644 --- a/spec/unit/file_cache_spec.rb +++ b/spec/unit/file_cache_spec.rb @@ -41,7 +41,7 @@ describe Chef::FileCache do end end - + describe "when storing a file" do before do File.stub!(:open).and_yield(@io) diff --git a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb index e1f8f28bb9..0b20b0ef86 100644 --- a/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -98,7 +98,7 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do before do Chef::Config.stub!(:cookbook_path).and_return([ "C:/opscode/chef/var/cache/cookbooks" ]) recipe_lines = BAD_RECIPE.split("\n").map {|l| l << "\n" } - IO.should_receive(:readlines).at_least(1).times.with(/:\/opscode\/chef\/var\/cache\/cookbooks\/foo\/recipes\/default.rb/).and_return(recipe_lines) + IO.should_receive(:readlines).at_least(1).times.with(/:\/opscode\/chef\/var\/cache\/cookbooks\/foo\/recipes\/default.rb/).and_return(recipe_lines) @trace = [ "C:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb:14 in `from_file'", "C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.0/lib/chef/run_context.rb:144:in `rescue in block in load_libraries'", @@ -141,7 +141,7 @@ describe Chef::Formatters::ErrorInspectors::CompileErrorInspector do @inspector.add_explanation(@description) @inspector.culprit_file.should == "c:/opscode/chef/var/cache/cookbooks/foo/recipes/default.rb" end - end + end it "finds the line number of the error from the stack trace" do @inspector.culprit_line.should == 14 diff --git a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb index cf668fbb0d..93129eadb8 100644 --- a/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb index 6db7aaaa0d..eb8d302e5b 100644 --- a/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb index bd3cc6b764..d2bbffafee 100644 --- a/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb index 4fcf034d80..4c21dadd82 100644 --- a/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. 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 b6d48d0255..fdbb601005 100644 --- a/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -129,7 +129,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) @inspector.recipe_snippet.should match(/^# In \/home\/btm/) end - + context "when the recipe file does not exist" do before do File.stub!(:exists?).and_return(false) @@ -141,7 +141,7 @@ describe Chef::Formatters::ErrorInspectors::ResourceFailureInspector do @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) @inspector.recipe_snippet.should be_nil end - + it "does not raise an exception trying to load a non-existant file (CHEF-3411)" do @resource.source_line = "/somewhere/in/space" @inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(@resource, :create, @exception) diff --git a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb index 4b6751a120..706ff59c06 100644 --- a/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +++ b/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/handler_spec.rb b/spec/unit/handler_spec.rb index 9eeba478ac..eab98e76a2 100644 --- a/spec/unit/handler_spec.rb +++ b/spec/unit/handler_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -126,9 +126,9 @@ describe Chef::Handler do @end_time = @start_time + 4.2 Time.stub!(:now).and_return(@start_time, @end_time) @run_status.start_clock - @run_status.stop_clock + @run_status.stop_clock end - + it "has a shortcut for all resources" do @handler.all_resources.should == @all_resources end @@ -158,7 +158,7 @@ describe Chef::Handler do end it "has a shortcut for the success? and failed? predicates" do - @handler.success?.should be_true + @handler.success?.should be_true @handler.failed?.should be_false end diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index f77268333b..de11a6ef15 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -205,7 +205,7 @@ describe Chef::Knife::Bootstrap do it "configures the ssh port" do @knife_ssh.config[:ssh_port].should == '4001' end - + it "configures the ssh agent forwarding" do @knife_ssh.config[:forward_agent].should == true end @@ -265,7 +265,7 @@ describe Chef::Knife::Bootstrap do it "configures the ssh port" do @knife_ssh.config[:ssh_port].should == '2430' end - + it "configures the ssh agent forwarding" do @knife_ssh.config[:forward_agent].should == true end diff --git a/spec/unit/knife/client_bulk_delete_spec.rb b/spec/unit/knife/client_bulk_delete_spec.rb index 55351554d1..b7864ed098 100644 --- a/spec/unit/knife/client_bulk_delete_spec.rb +++ b/spec/unit/knife/client_bulk_delete_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -37,31 +37,31 @@ describe Chef::Knife::ClientBulkDelete do end Chef::ApiClient.stub!(:list).and_return(@clients) end - + describe "run" do - + it "should get the list of the clients" do Chef::ApiClient.should_receive(:list).and_return(@clients) @knife.run end - + it "should print the clients you are about to delete" do @knife.run @stdout.string.should match(/#{@knife.ui.list(@clients.keys.sort, :columns_down)}/) end - + it "should confirm you really want to delete them" do @knife.ui.should_receive(:confirm) @knife.run end - + it "should delete each client" do @clients.each_value do |c| c.should_receive(:destroy) end @knife.run end - + it "should only delete clients that match the regex" do @knife.name_args = ["tim"] @clients["tim"].should_receive(:destroy) diff --git a/spec/unit/knife/client_create_spec.rb b/spec/unit/knife/client_create_spec.rb index c049748074..d07b6ceb17 100644 --- a/spec/unit/knife/client_create_spec.rb +++ b/spec/unit/knife/client_create_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb index 865f19f713..9ebccbae15 100644 --- a/spec/unit/knife/client_delete_spec.rb +++ b/spec/unit/knife/client_delete_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/client_edit_spec.rb b/spec/unit/knife/client_edit_spec.rb index 1308d14fd5..1d7049be30 100644 --- a/spec/unit/knife/client_edit_spec.rb +++ b/spec/unit/knife/client_edit_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/client_list_spec.rb b/spec/unit/knife/client_list_spec.rb index 6237a0d14c..c4834ad8d1 100644 --- a/spec/unit/knife/client_list_spec.rb +++ b/spec/unit/knife/client_list_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/client_reregister_spec.rb b/spec/unit/knife/client_reregister_spec.rb index d9fc8ec180..d84978c497 100644 --- a/spec/unit/knife/client_reregister_spec.rb +++ b/spec/unit/knife/client_reregister_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/client_show_spec.rb b/spec/unit/knife/client_show_spec.rb index 5bac3b4af6..ce5f93ab5f 100644 --- a/spec/unit/knife/client_show_spec.rb +++ b/spec/unit/knife/client_show_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/cookbook_metadata_from_file_spec.rb b/spec/unit/knife/cookbook_metadata_from_file_spec.rb index 60555d89dc..6f406de6b7 100644 --- a/spec/unit/knife/cookbook_metadata_from_file_spec.rb +++ b/spec/unit/knife/cookbook_metadata_from_file_spec.rb @@ -8,9 +8,9 @@ # 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. diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb index 2f2d841fea..96fe738b0b 100644 --- a/spec/unit/knife/cookbook_show_spec.rb +++ b/spec/unit/knife/cookbook_show_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -171,7 +171,7 @@ describe Chef::Knife::CookbookShow do @response = "Example recipe text" end - + describe "with --fqdn" do it "should pass the fqdn" do @knife.config[:platform] = "example_platform" diff --git a/spec/unit/knife/cookbook_site_install_spec.rb b/spec/unit/knife/cookbook_site_install_spec.rb index 43afe09f5e..f7d7a397e6 100644 --- a/spec/unit/knife/cookbook_site_install_spec.rb +++ b/spec/unit/knife/cookbook_site_install_spec.rb @@ -25,7 +25,7 @@ describe Chef::Knife::CookbookSiteInstall do @knife.config = {} if Chef::Platform.windows? @install_path = 'C:/tmp/chef' - else + else @install_path = '/var/tmp/chef' end @knife.config[:cookbook_path] = [ @install_path ] diff --git a/spec/unit/knife/data_bag_show_spec.rb b/spec/unit/knife/data_bag_show_spec.rb index 08ecfaa0a7..d64b4f286d 100644 --- a/spec/unit/knife/data_bag_show_spec.rb +++ b/spec/unit/knife/data_bag_show_spec.rb @@ -7,9 +7,9 @@ # 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. diff --git a/spec/unit/knife/environment_from_file_spec.rb b/spec/unit/knife/environment_from_file_spec.rb index d2234d9be1..7d028ae3b8 100644 --- a/spec/unit/knife/environment_from_file_spec.rb +++ b/spec/unit/knife/environment_from_file_spec.rb @@ -49,13 +49,13 @@ describe Chef::Knife::EnvironmentFromFile do @env_apple.name("apple") @knife.loader.stub!(:load_from).with("apple.rb").and_return @env_apple end - + it "loads multiple environments if given" do @knife.name_args = [ "spec.rb", "apple.rb" ] @environment.should_receive(:save).twice @knife.run end - + it "loads all environments with -a" do File.stub!(:expand_path).with("./environments/*.{json,rb}").and_return("/tmp/environments") Dir.stub!(:glob).with("/tmp/environments").and_return(["spec.rb", "apple.rb"]) diff --git a/spec/unit/knife/index_rebuild_spec.rb b/spec/unit/knife/index_rebuild_spec.rb index 414ec95fad..eb4e8020c8 100644 --- a/spec/unit/knife/index_rebuild_spec.rb +++ b/spec/unit/knife/index_rebuild_spec.rb @@ -91,7 +91,7 @@ describe Chef::Knife::IndexRebuild do context "against a Chef 11 server" do let(:api_info) do - {"flavor" => "osc", + {"flavor" => "osc", "version" => "11.0.0", "erchef" => "1.2.3" } diff --git a/spec/unit/knife/node_delete_spec.rb b/spec/unit/knife/node_delete_spec.rb index b1b3db1aa4..bc30ae7e83 100644 --- a/spec/unit/knife/node_delete_spec.rb +++ b/spec/unit/knife/node_delete_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -28,7 +28,7 @@ describe Chef::Knife::NodeDelete do @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) @knife.stub!(:confirm).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() @node.stub!(:destroy).and_return(true) Chef::Node.stub!(:load).and_return(@node) @stdout = StringIO.new diff --git a/spec/unit/knife/node_edit_spec.rb b/spec/unit/knife/node_edit_spec.rb index 0ba2e90cfe..e8f6937a31 100644 --- a/spec/unit/knife/node_edit_spec.rb +++ b/spec/unit/knife/node_edit_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/knife/node_list_spec.rb b/spec/unit/knife/node_list_spec.rb index 5637d679c8..3482eab87c 100644 --- a/spec/unit/knife/node_list_spec.rb +++ b/spec/unit/knife/node_list_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -49,7 +49,7 @@ describe Chef::Knife::NodeList do Chef::Node.should_receive(:list_by_environment).with("prod").and_return(@list) @knife.run end - + describe "with -w or --with-uri" do it "should pretty print the hash" do @knife.config[:with_uri] = true diff --git a/spec/unit/knife/node_run_list_add_spec.rb b/spec/unit/knife/node_run_list_add_spec.rb index ee0cfc9038..80e372c30a 100644 --- a/spec/unit/knife/node_run_list_add_spec.rb +++ b/spec/unit/knife/node_run_list_add_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -27,7 +27,7 @@ describe Chef::Knife::NodeRunListAdd do } @knife.name_args = [ "adam", "role[monkey]" ] @knife.stub!(:output).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() @node.stub!(:save).and_return(true) Chef::Node.stub!(:load).and_return(@node) end diff --git a/spec/unit/knife/node_show_spec.rb b/spec/unit/knife/node_show_spec.rb index 6600b2aa96..eb3593fea1 100644 --- a/spec/unit/knife/node_show_spec.rb +++ b/spec/unit/knife/node_show_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -29,7 +29,7 @@ describe Chef::Knife::NodeShow do } @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) - @node = Chef::Node.new() + @node = Chef::Node.new() Chef::Node.stub!(:load).and_return(@node) end diff --git a/spec/unit/knife/role_create_spec.rb b/spec/unit/knife/role_create_spec.rb index af3a6bf539..39fed8fb68 100644 --- a/spec/unit/knife/role_create_spec.rb +++ b/spec/unit/knife/role_create_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -27,7 +27,7 @@ describe Chef::Knife::RoleCreate do } @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) - @role = Chef::Role.new() + @role = Chef::Role.new() @role.stub!(:save) Chef::Role.stub!(:new).and_return(@role) @knife.stub!(:edit_data).and_return(@role) diff --git a/spec/unit/knife/role_delete_spec.rb b/spec/unit/knife/role_delete_spec.rb index d2d8b889b3..37b16de7df 100644 --- a/spec/unit/knife/role_delete_spec.rb +++ b/spec/unit/knife/role_delete_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -28,7 +28,7 @@ describe Chef::Knife::RoleDelete do @knife.name_args = [ "adam" ] @knife.stub!(:output).and_return(true) @knife.stub!(:confirm).and_return(true) - @role = Chef::Role.new() + @role = Chef::Role.new() @role.stub!(:destroy).and_return(true) Chef::Role.stub!(:load).and_return(@role) @stdout = StringIO.new diff --git a/spec/unit/knife/role_list_spec.rb b/spec/unit/knife/role_list_spec.rb index 1a5e8e2a72..d0cd3b4413 100644 --- a/spec/unit/knife/role_list_spec.rb +++ b/spec/unit/knife/role_list_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/log_spec.rb b/spec/unit/log_spec.rb index b91ee020bb..7be40f77e6 100644 --- a/spec/unit/log_spec.rb +++ b/spec/unit/log_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/mash_spec.rb b/spec/unit/mash_spec.rb index b9a7cd0932..7358781e60 100644 --- a/spec/unit/mash_spec.rb +++ b/spec/unit/mash_spec.rb @@ -35,7 +35,7 @@ describe Mash do @copy = @orig.dup @copy.to_hash.should == Mash.new(data).to_hash @copy[:z] << 4 - @orig[:z].should == [1,2,3] + @orig[:z].should == [1,2,3] end it "should duplicate a nested mash to a new mash" do @@ -44,7 +44,7 @@ describe Mash do @copy = @orig.dup @copy.to_hash.should == Mash.new(data).to_hash @copy[:z][:a] << 4 - @orig[:z][:a].should == [1,2,3] + @orig[:z][:a].should == [1,2,3] end # add more! diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb index 19af1c7d2b..cb31df828d 100644 --- a/spec/unit/mixin/checksum_spec.rb +++ b/spec/unit/mixin/checksum_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/mixin/checksum' require 'stringio' -class Chef::CMCCheck +class Chef::CMCCheck include Chef::Mixin::Checksum end @@ -34,7 +34,7 @@ describe Chef::Mixin::Checksum do end it "gets the checksum of a file" do - @checksum_user.checksum(@file).should == "09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394" + @checksum_user.checksum(@file).should == "dc6665c18676f5f30fdaa420343960edf1883790f83f51f437dbfa0ff678499d" end end diff --git a/spec/unit/mixin/convert_to_class_name_spec.rb b/spec/unit/mixin/convert_to_class_name_spec.rb index b78d3f9101..240decc6da 100644 --- a/spec/unit/mixin/convert_to_class_name_spec.rb +++ b/spec/unit/mixin/convert_to_class_name_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -23,23 +23,23 @@ class ConvertToClassTestHarness end describe Chef::Mixin::ConvertToClassName do - + before do @convert = ConvertToClassTestHarness.new end - + it "converts a_snake_case_word to a CamelCaseWord" do @convert.convert_to_class_name("now_camelized").should == "NowCamelized" end - + it "converts a CamelCaseWord to a snake_case_word" do @convert.convert_to_snake_case("NowImASnake").should == "now_im_a_snake" end - + it "removes the base classes before snake casing" do @convert.convert_to_snake_case("NameSpaced::Class::ThisIsWin", "NameSpaced::Class").should == "this_is_win" end - + it "removes the base classes without explicitly naming them and returns snake case" do @convert.snake_case_basename("NameSpaced::Class::ExtraWin").should == "extra_win" end diff --git a/spec/unit/mixin/deprecation_spec.rb b/spec/unit/mixin/deprecation_spec.rb index c3170007de..3ebf06e830 100644 --- a/spec/unit/mixin/deprecation_spec.rb +++ b/spec/unit/mixin/deprecation_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb index aa37362dc3..2947ebea4a 100644 --- a/spec/unit/mixin/params_validate_spec.rb +++ b/spec/unit/mixin/params_validate_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -20,7 +20,7 @@ require 'spec_helper' class TinyClass include Chef::Mixin::ParamsValidate - + def music(is_good=true) is_good end @@ -30,136 +30,136 @@ describe Chef::Mixin::ParamsValidate do before(:each) do @vo = TinyClass.new() end - + it "should allow a hash and a hash as arguments to validate" do lambda { @vo.validate({:one => "two"}, {}) }.should_not raise_error(ArgumentError) end - + it "should raise an argument error if validate is called incorrectly" do lambda { @vo.validate("one", "two") }.should raise_error(ArgumentError) end - + it "should require validation map keys to be symbols or strings" do lambda { @vo.validate({:one => "two"}, { :one => true }) }.should_not raise_error(ArgumentError) lambda { @vo.validate({:one => "two"}, { "one" => true }) }.should_not raise_error(ArgumentError) lambda { @vo.validate({:one => "two"}, { Hash.new => true }) }.should raise_error(ArgumentError) end - + it "should allow options to be required with true" do lambda { @vo.validate({:one => "two"}, { :one => true }) }.should_not raise_error(ArgumentError) end - + it "should allow options to be optional with false" do lambda { @vo.validate({}, {:one => false})}.should_not raise_error(ArgumentError) - end - + end + it "should allow you to check what kind_of? thing an argument is with kind_of" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => String } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => Array } } - ) + ) }.should raise_error(ArgumentError) end - + it "should allow you to specify an argument is required with required" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :required => true } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:two => "string"}, + {:two => "string"}, { :one => { :required => true } } - ) + ) }.should raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:two => "string"}, + {:two => "string"}, { :one => { :required => false } } - ) + ) }.should_not raise_error(ArgumentError) end - + it "should allow you to specify whether an object has a method with respond_to" do - lambda { + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => "validate" } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => "monkey" } } - ) + ) }.should raise_error(ArgumentError) end - + it "should allow you to specify whether an object has all the given methods with respond_to and an array" do - lambda { + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => ["validate", "music"] } } - ) + ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( - {:one => @vo}, + {:one => @vo}, { :one => { :respond_to => ["monkey", "validate"] } } - ) + ) }.should raise_error(ArgumentError) end - + it "should let you set a default value with default => value" do arguments = Hash.new @vo.validate(arguments, { @@ -169,9 +169,9 @@ describe Chef::Mixin::ParamsValidate do }) arguments[:one].should == "is the loneliest number" end - + it "should let you check regular expressions" do - lambda { + lambda { @vo.validate( { :one => "is good" }, { @@ -181,8 +181,8 @@ describe Chef::Mixin::ParamsValidate do } ) }.should_not raise_error(ArgumentError) - - lambda { + + lambda { @vo.validate( { :one => "is good" }, { @@ -193,9 +193,9 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should let you specify your own callbacks" do - lambda { + lambda { @vo.validate( { :one => "is good" }, { @@ -208,9 +208,9 @@ describe Chef::Mixin::ParamsValidate do } } ) - }.should_not raise_error(ArgumentError) - - lambda { + }.should_not raise_error(ArgumentError) + + lambda { @vo.validate( { :one => "is bad" }, { @@ -223,12 +223,12 @@ describe Chef::Mixin::ParamsValidate do } } ) - }.should raise_error(ArgumentError) + }.should raise_error(ArgumentError) end - + it "should let you combine checks" do args = { :one => "is good", :two => "is bad" } - lambda { + lambda { @vo.validate( args, { @@ -276,7 +276,7 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should raise an ArgumentError if the validation map has an unknown check" do lambda { @vo.validate( { :one => "two" }, @@ -288,43 +288,43 @@ describe Chef::Mixin::ParamsValidate do ) }.should raise_error(ArgumentError) end - + it "should accept keys that are strings in the options" do lambda { - @vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ }}) + @vo.validate({ "one" => "two" }, { :one => { :regex => /^two$/ }}) }.should_not raise_error(ArgumentError) end - + it "should allow an array to kind_of" do - lambda { + lambda { @vo.validate( - {:one => "string"}, + {:one => "string"}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should_not raise_error(ArgumentError) - lambda { + lambda { @vo.validate( - {:one => ["string"]}, + {:one => ["string"]}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should_not raise_error(ArgumentError) - lambda { + lambda { @vo.validate( - {:one => Hash.new}, + {:one => Hash.new}, { :one => { :kind_of => [ String, Array ] } } - ) + ) }.should raise_error(ArgumentError) end @@ -403,5 +403,5 @@ describe Chef::Mixin::ParamsValidate do @vo.set_or_return(:test, nil, {}).object_id.should == value.object_id @vo.set_or_return(:test, nil, {}).should be_a(Proc) end - + end diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb index c7813a5efc..f59602d716 100644 --- a/spec/unit/mixin/windows_architecture_helper_spec.rb +++ b/spec/unit/mixin/windows_architecture_helper_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -32,7 +32,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do @node_i386 = Chef::Node.new @node_x86_64 = Chef::Node.new end - + it "returns true when valid architectures are passed to valid_windows_architecture?" do @valid_architectures.each do | architecture | valid_windows_architecture?(architecture).should == true @@ -67,7 +67,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do it "returns false for each unsupported desired architecture for all nodes with each valid architecture passed to node_supports_windows_architecture?" do enumerate_architecture_node_combinations(true) end - + def enumerate_architecture_node_combinations(only_valid_combinations) @valid_architectures.each do | node_architecture | new_node = Chef::Node.new @@ -76,7 +76,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do @valid_architectures.each do | supported_architecture | node_supports_windows_architecture?(new_node, supported_architecture).should == true if only_valid_combinations && (supported_architecture != :x86_64 && node_architecture != :i386 ) - node_supports_windows_architecture?(new_node, supported_architecture).should == false if ! only_valid_combinations && (supported_architecture == :x86_64 && node_architecture == :i386 ) + node_supports_windows_architecture?(new_node, supported_architecture).should == false if ! only_valid_combinations && (supported_architecture == :x86_64 && node_architecture == :i386 ) end end end diff --git a/spec/unit/mixin/xml_escape_spec.rb b/spec/unit/mixin/xml_escape_spec.rb index d05854ade4..83debb5907 100644 --- a/spec/unit/mixin/xml_escape_spec.rb +++ b/spec/unit/mixin/xml_escape_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 5aa563aedf..70905d334b 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -20,9 +20,9 @@ require 'spec_helper' require 'chef/node/attribute' -describe Chef::Node::Attribute do +describe Chef::Node::Attribute do before(:each) do - @attribute_hash = + @attribute_hash = {"dmi"=>{}, "command"=>{"ps"=>"ps -ef"}, "platform_version"=>"10.5.7", @@ -193,7 +193,7 @@ describe Chef::Node::Attribute do @default_hash = { "domain" => "opscode.com", "hot" => { "day" => "saturday" }, - "music" => { + "music" => { "jimmy_eat_world" => "is fun!", "mastodon" => "rocks", "mars_volta" => "is loud and nutty", @@ -225,7 +225,7 @@ describe Chef::Node::Attribute do [ :normal, :default, :override, :automatic ].each do |accessor| it "should set #{accessor}" do na = Chef::Node::Attribute.new({ :normal => true }, { :default => true }, { :override => true }, { :automatic => true }) - na.send(accessor).should == { accessor.to_s => true } + na.send(accessor).should == { accessor.to_s => true } end end @@ -520,7 +520,7 @@ describe Chef::Node::Attribute do [:include?, :key?, :member?].each do |method| it "should alias the method #{method} to itself" do - @attributes.should respond_to(method) + @attributes.should respond_to(method) end it "#{method} should behave like has_key?" do @@ -582,7 +582,7 @@ describe Chef::Node::Attribute do collect.include?("snakes").should == true collect.include?("snack").should == true collect.include?("place").should == true - collect.length.should == 5 + collect.length.should == 5 end it "should yield lower if we go deeper" do @@ -593,7 +593,7 @@ describe Chef::Node::Attribute do collect.include?("two").should == true collect.include?("four").should == true collect.include?("six").should == true - collect.length.should == 3 + collect.length.should == 3 end it "should not raise an exception if one of the hashes has a nil value on a deep lookup" do @@ -667,7 +667,7 @@ describe Chef::Node::Attribute do @attributes.each_key do |k| collect << k end - + collect.should include("one") collect.should include("snack") collect.should include("hut") @@ -710,7 +710,7 @@ describe Chef::Node::Attribute do collect["snack"].should == "cookies" end end - + describe "each_value" do before do @attributes = Chef::Node::Attribute.new( diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb index db4a79f21b..0c2b878cd2 100644 --- a/spec/unit/node/immutable_collections_spec.rb +++ b/spec/unit/node/immutable_collections_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/platform_spec.rb b/spec/unit/platform_spec.rb index 03357830cc..3904435ea0 100644 --- a/spec/unit/platform_spec.rb +++ b/spec/unit/platform_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -32,7 +32,7 @@ describe "Chef::Platform supports" do :redhat, :oracle, :gentoo, - :arch, + :arch, :solaris, :mswin, :mingw32, @@ -50,11 +50,11 @@ describe Chef::Platform do before :all do @original_platform_map = Chef::Platform.platforms end - + after :all do || Chef::Platform.platforms = @original_platform_map end - + before(:each) do Chef::Platform.platforms = { :darwin => { @@ -80,13 +80,13 @@ describe Chef::Platform do } @events = Chef::EventDispatch::Dispatcher.new end - + it "should allow you to look up a platform by name and version, returning the provider map for it" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap.should be_a_kind_of(Hash) pmap[:file].should eql("darwinian") end - + it "should allow you to look up a platform by name and version using \"greater than\" style operators" do pmap = Chef::Platform.find("Darwin", "11.1.0") pmap.should be_a_kind_of(Hash) @@ -98,46 +98,46 @@ describe Chef::Platform do pmap.should be_a_kind_of(Hash) pmap[:file].should eql("old school") end - + it "should use the default providers if the os doesn't give me a default, but does exist" do pmap = Chef::Platform.find("mars_volta", "1") pmap.should be_a_kind_of(Hash) pmap[:file].should eql(Chef::Provider::File) end - + it "should use the default provider if the os does not exist" do pmap = Chef::Platform.find("AIX", "1") pmap.should be_a_kind_of(Hash) pmap[:file].should eql(Chef::Provider::File) end - + it "should merge the defaults for an os with the specific version" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap[:file].should eql("darwinian") pmap[:snicker].should eql("snack") end - + it "should merge the defaults for an os with the universal defaults" do pmap = Chef::Platform.find("Darwin", "9.2.2") pmap[:file].should eql("darwinian") pmap[:pax].should eql("brittania") end - + it "should allow you to look up a provider for a platform directly by symbol" do Chef::Platform.find_provider("Darwin", "9.2.2", :file).should eql("darwinian") end - + it "should raise an exception if a provider cannot be found for a resource type" do lambda { Chef::Platform.find_provider("Darwin", "9.2.2", :coffee) }.should raise_error(ArgumentError) end - + it "should look up a provider for a resource with a Chef::Resource object" do kitty = Chef::Resource::Cat.new("loulou") Chef::Platform.find_provider("Darwin", "9.2.2", kitty).should eql("nice") end - + it "should look up a provider with a node and a Chef::Resource object" do - kitty = Chef::Resource::Cat.new("loulou") + kitty = Chef::Resource::Cat.new("loulou") node = Chef::Node.new node.name("Intel") node.automatic_attrs[:platform] = "mac_os_x" @@ -150,7 +150,7 @@ describe Chef::Platform do end it "should prefer an explicit provider" do - kitty = Chef::Resource::Cat.new("loulou") + kitty = Chef::Resource::Cat.new("loulou") kitty.stub!(:provider).and_return(Chef::Provider::File) node = Chef::Node.new node.name("Intel") @@ -169,7 +169,7 @@ describe Chef::Platform do node.automatic_attrs[:platform_version] = "8.5" Chef::Platform.find_provider_for_node(node, kitty).should eql(Chef::Provider::Cat) end - + def setup_file_resource node = Chef::Node.new node.automatic_attrs[:platform] = "mac_os_x" @@ -185,7 +185,7 @@ describe Chef::Platform do provider.new_resource.should equal(file) provider.run_context.should equal(run_context) end - + it "returns a provider object given a Chef::Resource object which has a valid run context without an action" do file, run_context = setup_file_resource provider = Chef::Platform.provider_for_resource(file) @@ -193,7 +193,7 @@ describe Chef::Platform do provider.new_resource.should equal(file) provider.run_context.should equal(run_context) end - + it "raises an error when trying to find the provider for a resource with no run context" do file = Chef::Resource::File.new("whateva") lambda {Chef::Platform.provider_for_resource(file)}.should raise_error(ArgumentError) @@ -203,44 +203,44 @@ describe Chef::Platform do lambda {Chef::Platform.provider_for_node('node', 'resource')}.should raise_error(NotImplementedError) end - it "should update the provider map with map" do + it "should update the provider map with map" do Chef::Platform.set( :platform => :darwin, :version => "9.2.2", - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:darwin]["9.2.2"][:file].should eql("masterful") Chef::Platform.set( :platform => :darwin, :resource => :file, - :provider => "masterful" + :provider => "masterful" ) Chef::Platform.platforms[:darwin][:default][:file].should eql("masterful") Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" - ) + ) Chef::Platform.platforms[:default][:file].should eql("masterful") - + Chef::Platform.set( :platform => :hero, :version => "9.2.2", - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:hero]["9.2.2"][:file].should eql("masterful") - + Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:default][:file].should eql("masterful") - + Chef::Platform.platforms = {} - + Chef::Platform.set( - :resource => :file, + :resource => :file, :provider => "masterful" ) Chef::Platform.platforms[:default][:file].should eql("masterful") @@ -248,8 +248,8 @@ describe Chef::Platform do Chef::Platform.platforms = { :neurosis => {} } Chef::Platform.set(:platform => :neurosis, :resource => :package, :provider => "masterful") Chef::Platform.platforms[:neurosis][:default][:package].should eql("masterful") - + end - - + + end diff --git a/spec/unit/provider/cron_spec.rb b/spec/unit/provider/cron_spec.rb index f0d800741d..8a819b699c 100644 --- a/spec/unit/provider/cron_spec.rb +++ b/spec/unit/provider/cron_spec.rb @@ -181,7 +181,7 @@ CRONTAB before :each do @provider.stub!(:read_crontab).and_return(<<-CRONTAB) 0 2 * * * /some/other/command - + # Chef Name: cronhole some stuff * 5 * Jan Mon /bin/true param1 param2 # Chef Name: something else @@ -196,7 +196,7 @@ CRONTAB @provider.cron_exists.should == true @provider.cron_empty.should == false end - + it "should pull the details out of the cron line" do cron = @provider.load_current_resource cron.minute.should == '*' @@ -581,7 +581,7 @@ CRONTAB end it "should log nothing changed" do - Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'") + Chef::Log.should_receive(:debug).with("Found cron '#{@new_resource.name}'") Chef::Log.should_receive(:debug).with("Skipping existing cron entry '#{@new_resource.name}'") @provider.run_action(:create) end diff --git a/spec/unit/provider/deploy/timestamped_spec.rb b/spec/unit/provider/deploy/timestamped_spec.rb index b891a03ce2..a9cea1142e 100644 --- a/spec/unit/provider/deploy/timestamped_spec.rb +++ b/spec/unit/provider/deploy/timestamped_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Provider::Deploy::Timestamped do - + before do @release_time = Time.utc( 2004, 8, 15, 16, 23, 42) Time.stub!(:now).and_return(@release_time) @@ -32,9 +32,9 @@ describe Chef::Provider::Deploy::Timestamped do @runner = mock("runnah") Chef::Runner.stub!(:new).and_return(@runner) end - + it "gives a timestamp for release_slug" do @timestamped_deploy.send(:release_slug).should == "20040815162342" end - + end diff --git a/spec/unit/provider/deploy_spec.rb b/spec/unit/provider/deploy_spec.rb index 0d837f99c3..1a9fee8831 100644 --- a/spec/unit/provider/deploy_spec.rb +++ b/spec/unit/provider/deploy_spec.rb @@ -163,18 +163,18 @@ describe Chef::Provider::Deploy do @provider.stub!(:deploy).and_return{ raise "Unexpected error" } @provider.stub!(:previous_release_path).and_return('previous_release') @provider.should_not_receive(:rollback) - lambda { + lambda { @provider.run_action(:deploy) }.should raise_exception(RuntimeError, "Unexpected error") end - + it "rollbacks to previous release if error happens on deploy" do @resource.rollback_on_error true @provider.stub!(:all_releases).and_return(['previous_release']) @provider.stub!(:deploy).and_return{ raise "Unexpected error" } @provider.stub!(:previous_release_path).and_return('previous_release') @provider.should_receive(:rollback) - lambda { + lambda { @provider.run_action(:deploy) }.should raise_exception(RuntimeError, "Unexpected error") end @@ -225,15 +225,15 @@ describe Chef::Provider::Deploy do #FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/releases/20040815162342") #@provider.run_action(:rollback) #@provider.release_path.should eql(NIL) -- no check needed since assertions will fail - lambda { + lambda { @provider.run_action(:rollback) }.should raise_exception(RuntimeError, "There is no release to rollback to!") end - + it "an exception is raised when there are no releases" do all_releases = [] Dir.stub!(:glob).with("/my/deploy/dir/releases/*").and_return(all_releases) - lambda { + lambda { @provider.run_action(:rollback) }.should raise_exception(RuntimeError, "There is no release to rollback to!") end @@ -433,7 +433,7 @@ describe Chef::Provider::Deploy do @provider.should_receive(:enforce_ownership) @provider.link_tempfiles_to_current_release end - + end it "does nothing for restart if restart_command is empty" do diff --git a/spec/unit/provider/execute_spec.rb b/spec/unit/provider/execute_spec.rb index bf913cca12..0d108f521d 100644 --- a/spec/unit/provider/execute_spec.rb +++ b/spec/unit/provider/execute_spec.rb @@ -31,7 +31,7 @@ describe Chef::Provider::Execute do @provider = Chef::Provider::Execute.new(@new_resource, @run_context) @current_resource = Chef::Resource::Ifconfig.new("foo_resource", @run_context) @provider.current_resource = @current_resource - Chef::Log.level = :info + Chef::Log.level = :info # FIXME: There should be a test for how STDOUT.tty? changes the live_stream option being passed STDOUT.stub!(:tty?).and_return(true) end @@ -73,7 +73,7 @@ describe Chef::Provider::Execute do @provider.run_action(:run) @new_resource.should_not be_updated - end + end it "should warn if user specified relative path without cwd" do @new_resource.creates "foo_resource" diff --git a/spec/unit/provider/group/dscl_spec.rb b/spec/unit/provider/group/dscl_spec.rb index b526848dfd..28d78cbdbd 100644 --- a/spec/unit/provider/group/dscl_spec.rb +++ b/spec/unit/provider/group/dscl_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -27,14 +27,14 @@ describe Chef::Provider::Group::Dscl do @current_resource = Chef::Resource::Group.new("aj") @provider = Chef::Provider::Group::Dscl.new(@new_resource, @run_context) @provider.current_resource = @current_resource - @status = mock("Process::Status", :exitstatus => 0) + @status = mock("Process::Status", :exitstatus => 0) @pid = 2342 @stdin = StringIO.new @stdout = StringIO.new("\n") @stderr = StringIO.new("") @provider.stub!(:popen4).and_yield(@pid,@stdin,@stdout,@stderr).and_return(@status) end - + it "should run popen4 with the supplied array of arguments appended to the dscl command" do @provider.should_receive(:popen4).with("dscl . -cmd /Path arg1 arg2") @provider.dscl("cmd", "/Path", "arg1", "arg2") @@ -52,7 +52,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:dscl).and_return(["cmd", @status, "stdout", "stderr"]) end - + it "should run dscl with the supplied cmd /Path args" do @provider.should_receive(:dscl).with("cmd /Path args") @provider.safe_dscl("cmd /Path args") @@ -84,7 +84,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.safe_dscl("cmd /Path arguments") }.should raise_error(Chef::Exceptions::Group) end end - + describe "with the dscl command returning a zero exit status" do it "should return the third array element, the string of standard output" do safe_dscl_retval = @provider.safe_dscl("cmd /Path args") @@ -100,7 +100,7 @@ describe Chef::Provider::Group::Dscl do @provider = Chef::Provider::Group::Dscl.new(@node, @new_resource) @provider.stub!(:safe_dscl).and_return("\naj 200\njt 201\n") end - + it "should run safe_dscl with list /Groups gid" do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.get_free_gid @@ -109,7 +109,7 @@ describe Chef::Provider::Group::Dscl do it "should return the first unused gid number on or above 200" do @provider.get_free_gid.should equal(202) end - + it "should raise an exception when the search limit is exhausted" do search_limit = 1 lambda { @provider.get_free_gid(search_limit) }.should raise_error(RuntimeError) @@ -127,7 +127,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:safe_dscl).with("list /Groups gid") @provider.gid_used?(500) end - + it "should return true for a used gid number" do @provider.gid_used?(500).should be_true end @@ -151,7 +151,7 @@ describe Chef::Provider::Group::Dscl do lambda { @provider.set_gid }.should raise_error(Chef::Exceptions::Group) end end - + describe "with no gid number for the new resources" do it "should run get_free_gid and return a valid, unused gid number" do @provider.should_receive(:get_free_gid).and_return(501) @@ -220,7 +220,7 @@ describe Chef::Provider::Group::Dscl do @provider.set_members end end - + describe "with no members in the new resource" do before do @new_resource.append(true) @@ -276,7 +276,7 @@ describe Chef::Provider::Group::Dscl do @provider.should_receive(:set_gid) @provider.manage_group end - + it "should manage the members if it changed and the new resources members is not null" do @current_resource.members(%{charlie root}) @new_resource.members(%{crab revenge}) diff --git a/spec/unit/provider/group/gpasswd_spec.rb b/spec/unit/provider/group/gpasswd_spec.rb index 59da88e851..8889ba322e 100644 --- a/spec/unit/provider/group/gpasswd_spec.rb +++ b/spec/unit/provider/group/gpasswd_spec.rb @@ -36,8 +36,8 @@ describe Chef::Provider::Group::Gpasswd, "modify_group_members" do @provider.define_resource_requirements end - # Checking for required binaries is already done in the spec - # for Chef::Provider::Group - no need to repeat it here. We'll + # Checking for required binaries is already done in the spec + # for Chef::Provider::Group - no need to repeat it here. We'll # include only what's specific to this provider. it "should raise an error if the required binary /usr/bin/gpasswd doesn't exist" do File.stub!(:exists?).and_return(true) diff --git a/spec/unit/provider/group/groupmod_spec.rb b/spec/unit/provider/group/groupmod_spec.rb index c9c56313b5..69b96c6edb 100644 --- a/spec/unit/provider/group/groupmod_spec.rb +++ b/spec/unit/provider/group/groupmod_spec.rb @@ -29,7 +29,7 @@ describe Chef::Provider::Group::Groupmod do @new_resource.append false @provider = Chef::Provider::Group::Groupmod.new(@new_resource, @run_context) end - + describe "manage_group" do describe "when determining the current group state" do it "should raise an error if the required binary /usr/sbin/group doesn't exist" do @@ -41,25 +41,25 @@ describe Chef::Provider::Group::Groupmod do File.should_receive(:exists?).with("/usr/sbin/user").and_return(false) lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if the required binaries exist" do File.stub!(:exists?).and_return(true) lambda { @provider.load_current_resource }.should_not raise_error(Chef::Exceptions::Group) end end - + describe "after the group's current state is known" do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource end - + describe "when no group members are specified and append is not set" do before do @new_resource.append(false) @new_resource.members([]) end - + it "logs a message and sets group's members to 'none', then removes existing group members" do Chef::Log.should_receive(:debug).with("group[wheel] setting group members to: none") Chef::Log.should_receive(:debug).with("group[wheel] removing members lobster, rage, fist") @@ -69,26 +69,26 @@ describe Chef::Provider::Group::Groupmod do @provider.manage_group end end - + describe "when no group members are specified and append is set" do before do @new_resource.append(true) @new_resource.members([]) end - + it "logs a message and does not modify group membership" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members to add") @provider.should_not_receive(:shell_out!) @provider.manage_group end end - + describe "when removing some group members" do before do @new_resource.append(false) @new_resource.members(%w{ lobster }) end - + it "updates group membership correctly" do Chef::Log.stub!(:debug) @provider.should_receive(:shell_out!).with("group mod -n wheel_bak wheel") @@ -100,14 +100,14 @@ describe Chef::Provider::Group::Groupmod do end end end - + describe "create_group" do describe "when creating a new group" do before do @current_resource = Chef::Resource::Group.new("wheel") @provider.current_resource = @current_resource end - + it "should run a group add command and some user mod commands" do @provider.should_receive(:shell_out!).with("group add -g '123' wheel") @provider.should_receive(:shell_out!).with("user mod -G wheel lobster") @@ -117,14 +117,14 @@ describe Chef::Provider::Group::Groupmod do end end end - + describe "remove_group" do describe "when removing an existing group" do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource end - + it "should run a group del command" do @provider.should_receive(:shell_out!).with("group del wheel") @provider.remove_group diff --git a/spec/unit/provider/group/pw_spec.rb b/spec/unit/provider/group/pw_spec.rb index a7dbdb8615..e7c38f9555 100644 --- a/spec/unit/provider/group/pw_spec.rb +++ b/spec/unit/provider/group/pw_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -23,7 +23,7 @@ describe Chef::Provider::Group::Pw do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Group.new("wheel") @new_resource.gid 50 @new_resource.members [ "root", "aj"] @@ -34,12 +34,12 @@ describe Chef::Provider::Group::Pw do @provider = Chef::Provider::Group::Pw.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when setting options for the pw command" do it "does not set the gid option if gids match or are unmanaged" do @provider.set_options.should == " wheel" end - + it "sets the option for gid if it is not nil" do @new_resource.gid(42) @provider.set_options.should eql(" wheel -g '42'") @@ -55,7 +55,7 @@ describe Chef::Provider::Group::Pw do end describe "when managing the group" do - + it "should run pw groupmod with the return of set_options" do @new_resource.gid(42) @provider.should_receive(:run_command).with({ :command => "pw groupmod wheel -g '42' -M root,aj" }).and_return(true) @@ -72,18 +72,18 @@ describe Chef::Provider::Group::Pw do end describe "when setting group membership" do - + describe "with an empty members array in both the new and current resource" do before do @new_resource.stub!(:members).and_return([]) @current_resource.stub!(:members).and_return([]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members") @provider.set_members_option end - + it "should set no options" do @provider.set_members_option.should eql("") end @@ -94,28 +94,28 @@ describe Chef::Provider::Group::Pw do @new_resource.stub!(:members).and_return([]) @current_resource.stub!(:members).and_return(["all", "your", "base"]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] removing group members all, your, base") @provider.set_members_option end - + it "should set the -d option with the members joined by ','" do @provider.set_members_option.should eql(" -d all,your,base") end end - + describe "with supplied members array in the new resource and an empty members array in the current resource" do before do @new_resource.stub!(:members).and_return(["all", "your", "base"]) @current_resource.stub!(:members).and_return([]) end - + it "should log an appropriate debug message" do Chef::Log.should_receive(:debug).with("group[wheel] setting group members to all, your, base") @provider.set_members_option end - + it "should set the -M option with the members joined by ','" do @provider.set_members_option.should eql(" -M all,your,base") end @@ -123,7 +123,7 @@ describe Chef::Provider::Group::Pw do end describe"load_current_resource" do - before (:each) do + before (:each) do @provider.load_current_resource @provider.define_resource_requirements end @@ -131,7 +131,7 @@ describe Chef::Provider::Group::Pw do File.should_receive(:exists?).with("/usr/sbin/pw").and_return(false) lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if /usr/sbin/pw exists" do File.stub!(:exists?).and_return(true) lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group) diff --git a/spec/unit/provider/group/usermod_spec.rb b/spec/unit/provider/group/usermod_spec.rb index 880a3b01e4..7f2931f2e2 100644 --- a/spec/unit/provider/group/usermod_spec.rb +++ b/spec/unit/provider/group/usermod_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -28,20 +28,20 @@ describe Chef::Provider::Group::Usermod do @provider = Chef::Provider::Group::Usermod.new(@new_resource, @run_context) @provider.stub!(:run_command) end - + describe "modify_group_members" do - + describe "with an empty members array" do before do @new_resource.stub!(:members).and_return([]) end - + it "should log an appropriate message" do Chef::Log.should_receive(:debug).with("group[wheel] not changing group members, the group has no members") @provider.modify_group_members end end - + describe "with supplied members" do platforms = { "openbsd" => "-G", @@ -61,10 +61,10 @@ describe Chef::Provider::Group::Usermod do @provider.define_resource_requirements @provider.load_current_resource @provider.instance_variable_set("@group_exists", true) - @provider.action = :modify + @provider.action = :modify lambda { @provider.run_action(@provider.process_resource_requirements) }.should raise_error(Chef::Exceptions::Group, "setting group members directly is not supported by #{@provider.to_s}, must set append true in group") end - + platforms.each do |platform, flags| it "should usermod each user when the append option is set on #{platform}" do @node.automatic_attrs[:platform] = platform @@ -89,7 +89,7 @@ describe Chef::Provider::Group::Usermod do File.should_receive(:exists?).with("/usr/sbin/usermod").and_return(false) lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Group) end - + it "shouldn't raise an error if the required binaries exist" do File.stub!(:exists?).and_return(true) lambda { @provider.process_resource_requirements }.should_not raise_error(Chef::Exceptions::Group) diff --git a/spec/unit/provider/group_spec.rb b/spec/unit/provider/group_spec.rb index 8fceb7428e..caad9878b6 100644 --- a/spec/unit/provider/group_spec.rb +++ b/spec/unit/provider/group_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -33,7 +33,7 @@ describe Chef::Provider::User do @current_resource = Chef::Resource::Group.new("aj", @run_context) @current_resource.gid 500 @current_resource.members "aj" - + @provider.current_resource = @current_resource @pw_group = mock("Struct::Group", @@ -43,13 +43,13 @@ describe Chef::Provider::User do ) Etc.stub!(:getgrnam).with('wheel').and_return(@pw_group) end - + it "assumes the group exists by default" do @provider.group_exists.should be_true end describe "when establishing the current state of the group" do - + it "sets the group name of the current resource to the group name of the new resource" do @provider.load_current_resource @provider.current_resource.group_name.should == 'wheel' @@ -65,22 +65,22 @@ describe Chef::Provider::User do @provider.load_current_resource @new_resource.gid.should == 20 end - + it "looks up the group in /etc/group with getgrnam" do Etc.should_receive(:getgrnam).with(@new_resource.group_name).and_return(@pw_group) @provider.load_current_resource @provider.current_resource.gid.should == 20 @provider.current_resource.members.should == %w{root aj} end - + it "should flip the value of exists if it cannot be found in /etc/group" do Etc.stub!(:getgrnam).and_raise(ArgumentError) @provider.load_current_resource @provider.group_exists.should be_false end - + it "should return the current resource" do - @provider.load_current_resource.should equal(@provider.current_resource) + @provider.load_current_resource.should equal(@provider.current_resource) end end @@ -91,7 +91,7 @@ describe Chef::Provider::User do @provider.compare_group.should be_true end end - + it "should return false if gid and members are equal" do @provider.compare_group.should be_false end @@ -116,28 +116,28 @@ describe Chef::Provider::User do @provider.should_receive(:create_group).and_return(true) @provider.run_action(:create) end - + it "should set the new_resources updated flag when it creates the group" do @provider.group_exists = false @provider.stub!(:create_group) @provider.run_action(:create) @provider.new_resource.should be_updated end - + it "should check to see if the group has mismatched attributes if the group exists" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(false) @provider.run_action(:create) @provider.new_resource.should_not be_updated end - + it "should call manage_group if the group exists and has mismatched attributes" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:create) end - + it "should set the new_resources updated flag when it creates the group if we call manage_group" do @provider.group_exists = true @provider.stub!(:compare_group).and_return(true) @@ -148,14 +148,14 @@ describe Chef::Provider::User do end describe "when removing a group" do - + it "should not call remove_group if the group does not exist" do @provider.group_exists = false - @provider.should_not_receive(:remove_group) + @provider.should_not_receive(:remove_group) @provider.run_action(:remove) @provider.new_resource.should_not be_updated end - + it "should call remove_group if the group exists" do @provider.group_exists = true @provider.should_receive(:remove_group) @@ -169,26 +169,26 @@ describe Chef::Provider::User do @provider.group_exists = true @provider.stub!(:manage_group).and_return(true) end - + it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:manage) end - + it "should set the new resources updated flag to true if manage_group is called" do @provider.stub!(:compare_group).and_return(true) @provider.stub!(:manage_group).and_return(true) @provider.run_action(:manage) @new_resource.should be_updated end - + it "should not run manage_group if the group does not exist" do @provider.group_exists = false @provider.should_not_receive(:manage_group) @provider.run_action(:manage) end - + it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) @provider.should_not_receive(:manage_group) @@ -201,26 +201,26 @@ describe Chef::Provider::User do @provider.group_exists = true @provider.stub!(:manage_group).and_return(true) end - + it "should run manage_group if the group exists and has mismatched attributes" do @provider.should_receive(:compare_group).and_return(true) @provider.should_receive(:manage_group).and_return(true) @provider.run_action(:modify) end - + it "should set the new resources updated flag to true if manage_group is called" do @provider.stub!(:compare_group).and_return(true) @provider.stub!(:manage_group).and_return(true) @provider.run_action(:modify) @new_resource.should be_updated end - + it "should not run manage_group if the group exists but has no differing attributes" do @provider.should_receive(:compare_group).and_return(false) @provider.should_not_receive(:manage_group) @provider.run_action(:modify) end - + it "should raise a Chef::Exceptions::Group if the group doesn't exist" do @provider.group_exists = false lambda { @provider.run_action(:modify) }.should raise_error(Chef::Exceptions::Group) @@ -230,7 +230,7 @@ describe Chef::Provider::User do describe "when determining the reason for a change" do it "should report which group members are missing if members are missing and appending to the group" do @new_resource.members << "user1" - @new_resource.members << "user2" + @new_resource.members << "user2" @new_resource.stub!(:append).and_return true @provider.compare_group.should be_true @provider.change_desc.should == "add missing member(s): user1, user2" @@ -238,7 +238,7 @@ describe Chef::Provider::User do it "should report that the group members will be overwritten if not appending" do @new_resource.members << "user1" - @new_resource.stub!(:append).and_return false + @new_resource.stub!(:append).and_return false @provider.compare_group.should be_true @provider.change_desc.should == "replace group members with new list of members" end diff --git a/spec/unit/provider/ifconfig/aix_spec.rb b/spec/unit/provider/ifconfig/aix_spec.rb index a97853b22c..39e9919740 100644 --- a/spec/unit/provider/ifconfig/aix_spec.rb +++ b/spec/unit/provider/ifconfig/aix_spec.rb @@ -20,7 +20,7 @@ require 'spec_helper' require 'chef/exceptions' describe Chef::Provider::Ifconfig::Aix do - + before(:all) do @ifconfig_output = <<-IFCONFIG en1: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> @@ -47,8 +47,8 @@ IFCONFIG @provider = Chef::Provider::Ifconfig::Aix.new(@new_resource, @run_context) end - describe "#load_current_resource" do - before do + describe "#load_current_resource" do + before do status = double("Status", :exitstatus => 0) @provider.should_receive(:popen4).with("ifconfig -a").and_yield(@pid,@stdin,StringIO.new(@ifconfig_output),@stderr).and_return(status) @new_resource.device "en0" @@ -177,4 +177,4 @@ IFCONFIG end end end -end
\ No newline at end of file +end diff --git a/spec/unit/provider/ifconfig_spec.rb b/spec/unit/provider/ifconfig_spec.rb index d1d20f7f22..f4fdc23353 100644 --- a/spec/unit/provider/ifconfig_spec.rb +++ b/spec/unit/provider/ifconfig_spec.rb @@ -38,20 +38,20 @@ describe Chef::Provider::Ifconfig do status = mock("Status", :exitstatus => 0) @provider.instance_variable_set("@status", status) @provider.current_resource = @current_resource - + end - describe Chef::Provider::Ifconfig, "load_current_resource" do - before do + describe Chef::Provider::Ifconfig, "load_current_resource" do + before do status = mock("Status", :exitstatus => 1) - @provider.should_receive(:popen4).and_return status + @provider.should_receive(:popen4).and_return status @provider.load_current_resource end it "should track state of ifconfig failure." do @provider.instance_variable_get("@status").exitstatus.should_not == 0 end - it "should thrown an exception when ifconfig fails" do + it "should thrown an exception when ifconfig fails" do @provider.define_resource_requirements - lambda { @provider.process_resource_requirements }.should raise_error Chef::Exceptions::Ifconfig + lambda { @provider.process_resource_requirements }.should raise_error Chef::Exceptions::Ifconfig end end describe Chef::Provider::Ifconfig, "action_add" do @@ -84,7 +84,7 @@ describe Chef::Provider::Ifconfig do end describe Chef::Provider::Ifconfig, "action_enable" do - + it "should enable interface if does not exist" do @provider.stub!(:load_current_resource) @current_resource.inet_addr nil @@ -129,7 +129,7 @@ describe Chef::Provider::Ifconfig do @new_resource.should_not be_updated end end - + describe Chef::Provider::Ifconfig, "action_disable" do it "should disable interface if it exists" do diff --git a/spec/unit/provider/link_spec.rb b/spec/unit/provider/link_spec.rb index 171e21171c..bd3204510b 100644 --- a/spec/unit/provider/link_spec.rb +++ b/spec/unit/provider/link_spec.rb @@ -241,8 +241,8 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do result end it 'create does no work' do - provider.file_class.should_not_receive(:symlink) - provider.file_class.should_not_receive(:link) + provider.file_class.should_not_receive(:symlink) + provider.file_class.should_not_receive(:link) provider.access_controls.should_not_receive(:set_all) provider.run_action(:create) end diff --git a/spec/unit/provider/log_spec.rb b/spec/unit/provider/log_spec.rb index fe3733240a..f6ff526dd4 100644 --- a/spec/unit/provider/log_spec.rb +++ b/spec/unit/provider/log_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -25,7 +25,7 @@ describe Chef::Provider::Log::ChefLog do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - end + end it "should be registered with the default platform hash" do Chef::Platform.platforms[:default][:log].should_not be_nil @@ -37,7 +37,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:info).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at debug level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :debug @@ -53,7 +53,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:info).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at warn level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :warn @@ -61,7 +61,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:warn).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at error level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :error @@ -69,7 +69,7 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:error).with(@log_str).and_return(true) @provider.action_write end - + it "should write the string to the Chef::Log object at fatal level" do @new_resource = Chef::Resource::Log.new(@log_str) @new_resource.level :fatal @@ -77,5 +77,5 @@ describe Chef::Provider::Log::ChefLog do Chef::Log.should_receive(:fatal).with(@log_str).and_return(true) @provider.action_write end - + end diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index 92aa8177f2..89de47038a 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -217,7 +217,7 @@ ENABLED mount = true options = rw ETCFILESYSTEMS - + filesystems = StringIO.new ::File.stub!(:open).with("/etc/filesystems", "w").and_yield(filesystems) @@ -234,4 +234,4 @@ ETCFILESYSTEMS @provider.run_action(:disable) end end -end
\ No newline at end of file +end diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb index 74579b14fe..4c9916ae87 100644 --- a/spec/unit/provider/mount/windows_spec.rb +++ b/spec/unit/provider/mount/windows_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/provider/mount_spec.rb b/spec/unit/provider/mount_spec.rb index 1a98f10cb0..a44f9705ee 100644 --- a/spec/unit/provider/mount_spec.rb +++ b/spec/unit/provider/mount_spec.rb @@ -23,13 +23,13 @@ describe Chef::Provider::Mount do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Mount.new('/tmp/foo') @new_resource.device "/dev/sdz1" @new_resource.name "/tmp/foo" @new_resource.mount_point "/tmp/foo" @new_resource.fstype "ext3" - + @current_resource = Chef::Resource::Mount.new('/tmp/foo') @current_resource.device "/dev/sdz1" @current_resource.name "/tmp/foo" @@ -39,7 +39,7 @@ describe Chef::Provider::Mount do @provider = Chef::Provider::Mount.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when the target state is a mounted filesystem" do it "should mount the filesystem if it isn't mounted" do @@ -78,7 +78,7 @@ describe Chef::Provider::Mount do before do @new_resource.supports[:remount] = true end - + it "should remount the filesystem if it is mounted" do @current_resource.stub!(:mounted).and_return(true) @provider.should_receive(:remount_fs).and_return(true) @@ -93,8 +93,8 @@ describe Chef::Provider::Mount do @new_resource.should_not be_updated_by_last_action end end - describe "when the filesystem should be remounted and the resource does not support remounting" do - before do + describe "when the filesystem should be remounted and the resource does not support remounting" do + before do @new_resource.supports[:remount] = false end diff --git a/spec/unit/provider/package/apt_spec.rb b/spec/unit/provider/package/apt_spec.rb index eb11c1e417..32b55163b4 100644 --- a/spec/unit/provider/package/apt_spec.rb +++ b/spec/unit/provider/package/apt_spec.rb @@ -87,18 +87,18 @@ VPKG_STDOUT @provider.should_receive(:shell_out!).with("apt-cache policy libmysqlclient15-dev").and_return(virtual_package) showpkg_out =<<-SHOWPKG_STDOUT Package: libmysqlclient15-dev -Versions: +Versions: -Reverse Depends: +Reverse Depends: libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev libmysqlclient-dev,libmysqlclient15-dev -Dependencies: -Provides: -Reverse Provides: +Dependencies: +Provides: +Reverse Provides: libmysqlclient-dev 5.1.41-3ubuntu12.7 libmysqlclient-dev 5.1.41-3ubuntu12.10 libmysqlclient-dev 5.1.41-3ubuntu12 @@ -135,17 +135,17 @@ VPKG_STDOUT @provider.should_receive(:shell_out!).with("apt-cache policy mp3-decoder").and_return(virtual_package) showpkg_out=<<-SHOWPKG_STDOUT Package: mp3-decoder -Versions: +Versions: -Reverse Depends: +Reverse Depends: nautilus,mp3-decoder vux,mp3-decoder plait,mp3-decoder ecasound,mp3-decoder nautilus,mp3-decoder -Dependencies: -Provides: -Reverse Provides: +Dependencies: +Provides: +Reverse Provides: vlc-nox 1.0.6-1ubuntu1.8 vlc 1.0.6-1ubuntu1.8 vlc-nox 1.0.6-1ubuntu1 diff --git a/spec/unit/provider/package/dpkg_spec.rb b/spec/unit/provider/package/dpkg_spec.rb index aa22e0a2a3..30021e31f3 100644 --- a/spec/unit/provider/package/dpkg_spec.rb +++ b/spec/unit/provider/package/dpkg_spec.rb @@ -60,15 +60,15 @@ describe Chef::Provider::Package::Dpkg do @provider.current_resource.package_name.should == "wget" @new_resource.version.should == version end - + it 'if short version provided' do check_version('1.11.4') end - + it 'if extended version provided' do check_version('1.11.4-1ubuntu1') end - + it 'if distro-specific version provided' do check_version('1.11.4-1ubuntu1~lucid') end diff --git a/spec/unit/provider/package/ips_spec.rb b/spec/unit/provider/package/ips_spec.rb index 641a527012..95839dbe89 100644 --- a/spec/unit/provider/package/ips_spec.rb +++ b/spec/unit/provider/package/ips_spec.rb @@ -170,7 +170,7 @@ PKG_STATUS before do @new_resource.stub!(:accept_license).and_return(true) end - + it "should run pkg install with the --accept flag" do @provider.should_receive(:run_command_with_systems_locale).with({ :command => "pkg install -q --accept crypto/gnupg@2.0.17" diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb index 9dd94a7441..86327be42b 100644 --- a/spec/unit/provider/package/rpm_spec.rb +++ b/spec/unit/provider/package/rpm_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,35 +23,35 @@ describe Chef::Provider::Package::Rpm do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Package.new("emacs") @new_resource.source "/tmp/emacs-21.4-20.el5.i386.rpm" - + @provider = Chef::Provider::Package::Rpm.new(@new_resource, @run_context) - + @status = mock("Status", :exitstatus => 0) ::File.stub!(:exists?).and_return(true) end - + describe "when determining the current state of the package" do - + it "should create a current resource with the name of new_resource" do @provider.stub!(:popen4).and_return(@status) @provider.load_current_resource @provider.current_resource.name.should == "emacs" end - + it "should set the current reource package name to the new resource package name" do @provider.stub!(:popen4).and_return(@status) @provider.load_current_resource @provider.current_resource.package_name.should == 'emacs' end - + it "should raise an exception if a source is supplied but not found" do ::File.stub!(:exists?).and_return(false) lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end - + it "should get the source package version from rpm if provided" do @stdout = StringIO.new("emacs 21.4-20.el5") @provider.should_receive(:popen4).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/emacs-21.4-20.el5.i386.rpm").and_yield(@pid, @stdin, @stdout, @stderr).and_return(@status) @@ -60,7 +60,7 @@ describe Chef::Provider::Package::Rpm do @provider.current_resource.package_name.should == "emacs" @provider.new_resource.version.should == "21.4-20.el5" end - + it "should return the current version installed if found by rpm" do @stdout = StringIO.new("emacs 21.4-20.el5") @provider.should_receive(:popen4).with("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' /tmp/emacs-21.4-20.el5.i386.rpm").and_return(@status) @@ -68,20 +68,20 @@ describe Chef::Provider::Package::Rpm do @provider.load_current_resource @provider.current_resource.version.should == "21.4-20.el5" end - + it "should raise an exception if the source is not set but we are installing" do new_resource = Chef::Resource::Package.new("emacs") provider = Chef::Provider::Package::Rpm.new(new_resource, @run_context) lambda { provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end - + it "should raise an exception if rpm fails to run" do status = mock("Status", :exitstatus => -1) @provider.stub!(:popen4).and_return(status) lambda { @provider.run_action(:any) }.should raise_error(Chef::Exceptions::Package) end end - + describe "after the current resource is loaded" do before do @current_resource = Chef::Resource::Package.new("emacs") @@ -95,7 +95,7 @@ describe Chef::Provider::Package::Rpm do }) @provider.install_package("emacs", "21.4-20.el5") end - + it "should run rpm -U with the package source to upgrade" do @current_resource.version("21.4-19.el5") @provider.should_receive(:run_command_with_systems_locale).with({ diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb index 71ea3fab04..e5092f69d9 100644 --- a/spec/unit/provider/package/smartos_spec.rb +++ b/spec/unit/provider/package/smartos_spec.rb @@ -27,8 +27,8 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do @run_context = Chef::RunContext.new(@node, {}, @events) @new_resource = Chef::Resource::Package.new("varnish") @current_resource = Chef::Resource::Package.new("varnish") - - + + @status = mock("Status", :exitstatus => 0) @provider = Chef::Provider::Package::SmartOS.new(@new_resource, @run_context) Chef::Resource::Package.stub!(:new).and_return(@current_resource) @@ -88,7 +88,7 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do end describe "when manipulating a resource" do - + it "run pkgin and install the package" do out = OpenStruct.new(:stdout => nil) @provider.should_receive(:shell_out!).with("/opt/local/sbin/pkg_info -E \"varnish*\"", {:env => nil, :returns=>[0,1]}).and_return(@shell_out) diff --git a/spec/unit/provider/package_spec.rb b/spec/unit/provider/package_spec.rb index 85aab981e8..f80eed17bd 100644 --- a/spec/unit/provider/package_spec.rb +++ b/spec/unit/provider/package_spec.rb @@ -286,7 +286,7 @@ describe Chef::Provider::Package do @provider.should_not_receive(:reconfig_package) @provider.run_action(:reconfig) @new_resource.should_not be_updated_by_last_action - end + end it "should debug log and not reconfigure the package if no response_file is given" do @current_resource.stub!(:version).and_return('1.0') diff --git a/spec/unit/provider/powershell_spec.rb b/spec/unit/provider/powershell_spec.rb index ac4160080e..33c402836b 100644 --- a/spec/unit/provider/powershell_spec.rb +++ b/spec/unit/provider/powershell_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -24,7 +24,7 @@ describe Chef::Provider::PowershellScript, "action_run" do @node.default["kernel"] = Hash.new @node.default["kernel"][:machine] = :x86_64.to_s - + @run_context = Chef::RunContext.new(@node, {}, @events) @new_resource = Chef::Resource::PowershellScript.new('run some powershell code', @run_context) diff --git a/spec/unit/provider/remote_directory_spec.rb b/spec/unit/provider/remote_directory_spec.rb index f2bb1b4a3f..d3f1438f0f 100644 --- a/spec/unit/provider/remote_directory_spec.rb +++ b/spec/unit/provider/remote_directory_spec.rb @@ -57,10 +57,10 @@ describe Chef::Provider::RemoteDirectory do @provider_second_run.run_action(:create) end it "identifies that the state has changed the after first run" do - @provider_second_run.new_resource.updated_by_last_action? == true + @provider_second_run.new_resource.updated_by_last_action? == true end it "identifies that the state has not changed after the second run" do - @provider_second_run.new_resource.updated_by_last_action? == false + @provider_second_run.new_resource.updated_by_last_action? == false end end diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index 072cb2a698..863f12641c 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -111,13 +111,13 @@ describe Chef::Provider::Route do it "should not delete config file for :add action (CHEF-3332)" do @node.automatic_attrs[:platform] = 'centos' - + route_file = StringIO.new File.should_receive(:new).and_return(route_file) @resource_add = Chef::Resource::Route.new('192.168.1.0/24 via 192.168.0.1') @run_context.resource_collection << @resource_add @provider.stub!(:run_command).and_return(true) - + @resource_add.action(:add) @provider.run_action(:add) route_file.string.split("\n").should have(1).items diff --git a/spec/unit/provider/ruby_block_spec.rb b/spec/unit/provider/ruby_block_spec.rb index 7fc58c9c70..6e5c9a638b 100644 --- a/spec/unit/provider/ruby_block_spec.rb +++ b/spec/unit/provider/ruby_block_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/provider/service/arch_service_spec.rb b/spec/unit/provider/service/arch_service_spec.rb index 42e7868600..0865fdae86 100644 --- a/spec/unit/provider/service/arch_service_spec.rb +++ b/spec/unit/provider/service/arch_service_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -61,7 +61,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do @provider.should_receive(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/etc/rc.d/chef status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource @@ -92,7 +92,7 @@ describe Chef::Provider::Service::Arch, "load_current_resource" do @provider.should_receive(:shell_out).with("/etc/rc.d/chefhasmonkeypants status").and_return(OpenStruct.new(:exitstatus => 0)) @provider.load_current_resource end - + end it "should raise error if the node has a nil ps attribute and no other means to get status" do @@ -129,7 +129,7 @@ aj 8119 6041 0 21:34 pts/3 00:00:03 vi init_service_spec.rb DEFAULT_PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) - + @node.automatic_attrs[:command] = {:ps => "ps -ef"} end @@ -139,7 +139,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status.stub!(:stdout).and_return(@stdout) - @provider.load_current_resource + @provider.load_current_resource @provider.current_resource.running.should be_true end @@ -162,13 +162,13 @@ RUNNING_PS ::File.stub!(:read).with("/etc/rc.conf").and_return("DAEMONS=(network !apache ssh)") @provider.daemons.should == ['network', '!apache', 'ssh'] end - + context "when the current service status is known" do before do @current_resource = Chef::Resource::Service.new("chef") @provider.current_resource = @current_resource end - + describe Chef::Provider::Service::Arch, "enable_service" do # before(:each) do # @new_resource = mock("Chef::Resource::Service", @@ -178,7 +178,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -199,7 +199,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -221,11 +221,11 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:start_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end - + it "should call the start command if one is specified" do @new_resource.stub!(:start_command).and_return("/etc/rc.d/chef startyousillysally") @provider.should_receive(:shell_out!).with("/etc/rc.d/chef startyousillysally") @@ -235,7 +235,7 @@ RUNNING_PS it "should call '/etc/rc.d/service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/etc/rc.d/#{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Arch, "stop_service" do @@ -247,7 +247,7 @@ RUNNING_PS # :running => false # ) # @new_resource.stub!(:stop_command).and_return(false) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -274,7 +274,7 @@ RUNNING_PS # ) # @new_resource.stub!(:restart_command).and_return(false) # @new_resource.stub!(:supports).and_return({:restart => false}) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end @@ -309,7 +309,7 @@ RUNNING_PS # ) # @new_resource.stub!(:reload_command).and_return(false) # @new_resource.stub!(:supports).and_return({:reload => false}) - # + # # @provider = Chef::Provider::Service::Arch.new(@node, @new_resource) # Chef::Resource::Service.stub!(:new).and_return(@current_resource) # end diff --git a/spec/unit/provider/service/debian_service_spec.rb b/spec/unit/provider/service/debian_service_spec.rb index bea9360561..b1aa193f0e 100644 --- a/spec/unit/provider/service/debian_service_spec.rb +++ b/spec/unit/provider/service/debian_service_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/provider/service/freebsd_service_spec.rb b/spec/unit/provider/service/freebsd_service_spec.rb index 72e896a16b..7861764309 100644 --- a/spec/unit/provider/service/freebsd_service_spec.rb +++ b/spec/unit/provider/service/freebsd_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -125,7 +125,7 @@ RC_SAMPLE @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + describe "when executing assertions" do it "should verify that /etc/rc.conf exists" do ::File.should_receive(:exists?).with("/etc/rc.conf") @@ -138,7 +138,7 @@ RC_SAMPLE it "should raise an exception when the action is #{action}" do ::File.stub!(:exists?).and_return(false) @provider.load_current_resource - @provider.define_resource_requirements + @provider.define_resource_requirements @provider.instance_variable_get("@rcd_script_found").should be_false @provider.action = action lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) @@ -157,7 +157,7 @@ RC_SAMPLE ::File.should_receive(:exists?).with("/etc/rc.conf").and_return false @provider.load_current_resource @provider.instance_variable_get("@enabled_state_found").should be_false - end + end it "update state when current resource enabled state could be determined" do ::File.stub!(:exist?).with("/usr/local/etc/rc.d/#{@new_resource.service_name}").and_return(true) @@ -165,10 +165,10 @@ RC_SAMPLE @provider.load_current_resource @provider.instance_variable_get("@enabled_state_found").should be_false @provider.instance_variable_get("@rcd_script_found").should be_true - @provider.define_resource_requirements + @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service, "Could not find the service name in /usr/local/etc/rc.d/#{@current_resource.service_name} and rcvar") - end + end it "should throw an exception if service line is missing from rc.d script" do pending "not implemented" do @@ -197,7 +197,7 @@ RC_SAMPLE it "should set running to true if the regex matches the output" do @stdout.stub!(:each_line).and_yield("555 ?? Ss 0:05.16 /usr/sbin/cron -s"). and_yield(" 9881 ?? Ss 0:06.67 /usr/local/sbin/httpd -DNOHTTPACCEPT") - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb index 8d4ada043b..b658cab4d8 100644 --- a/spec/unit/provider/service/gentoo_service_spec.rb +++ b/spec/unit/provider/service/gentoo_service_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -24,10 +24,10 @@ describe Chef::Provider::Service::Gentoo do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Service.new("chef") @current_resource = Chef::Resource::Service.new("chef") - + @provider = Chef::Provider::Service::Gentoo.new(@new_resource, @run_context) Chef::Resource::Service.stub!(:new).and_return(@current_resource) @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @@ -39,7 +39,7 @@ describe Chef::Provider::Service::Gentoo do end # new test: found_enabled state # - describe "load_current_resource" do + describe "load_current_resource" do it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do File.should_receive(:exists?).with("/sbin/rc-update").and_return(false) @provider.define_resource_requirements @@ -79,7 +79,7 @@ describe Chef::Provider::Service::Gentoo do File.stub!(:exists?).with("/etc/runlevels/default/chef").and_return(true) File.stub!(:readable?).with("/etc/runlevels/default/chef").and_return(false) end - + it "should set enabled to false" do @provider.load_current_resource @current_resource.enabled.should be_false @@ -101,10 +101,10 @@ describe Chef::Provider::Service::Gentoo do end end - + it "should return the current_resource" do @provider.load_current_resource.should == @current_resource - end + end it "should support the status command automatically" do @provider.load_current_resource @@ -122,7 +122,7 @@ describe Chef::Provider::Service::Gentoo do end end - + describe "action_methods" do before(:each) { @provider.stub!(:load_current_resource).and_return(@current_resource) } diff --git a/spec/unit/provider/service/init_service_spec.rb b/spec/unit/provider/service/init_service_spec.rb index 4131ee61a8..c7d47e6281 100644 --- a/spec/unit/provider/service/init_service_spec.rb +++ b/spec/unit/provider/service/init_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -40,7 +40,7 @@ PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do @provider.load_current_resource @provider.current_resource.should equal(@current_resource) @@ -60,7 +60,7 @@ PS @provider.should_receive(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/etc/init.d/#{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource @@ -90,9 +90,9 @@ PS @provider.should_receive(:shell_out).with("/etc/init.d/chefhasmonkeypants status").and_return(@status) @provider.load_current_resource end - + end - + describe "when an init command has been specified" do before do @new_resource.stub!(:init_command).and_return("/opt/chef-server/service/erchef") @@ -107,7 +107,7 @@ PS end describe "when the node has not specified a ps command" do - + it "should raise an error if the node has a nil ps attribute" do @node.automatic_attrs[:command] = {:ps => nil} @provider.load_current_resource @@ -123,7 +123,7 @@ PS @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + end @@ -139,7 +139,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 chef aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status.stub!(:stdout).and_return(@stdout) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -172,7 +172,7 @@ RUNNING_PS it "should call '/etc/init.d/service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/etc/init.d/#{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Init, "stop_service" do diff --git a/spec/unit/provider/service/insserv_service_spec.rb b/spec/unit/provider/service/insserv_service_spec.rb index c823d511b5..8b5f09e78c 100644 --- a/spec/unit/provider/service/insserv_service_spec.rb +++ b/spec/unit/provider/service/insserv_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -35,7 +35,7 @@ describe Chef::Provider::Service::Insserv do describe "load_current_resource" do describe "when startup links exist" do - before do + before do Dir.stub!(:glob).with("/etc/rc**/S*initgrediant").and_return(["/etc/rc5.d/S18initgrediant", "/etc/rc2.d/S18initgrediant", "/etc/rc4.d/S18initgrediant", "/etc/rc3.d/S18initgrediant"]) end @@ -46,7 +46,7 @@ describe Chef::Provider::Service::Insserv do end describe "when startup links do not exist" do - before do + before do Dir.stub!(:glob).with("/etc/rc**/S*initgrediant").and_return([]) end @@ -65,7 +65,7 @@ describe Chef::Provider::Service::Insserv do @provider.enable_service end end - + describe "disable_service" do it "should call insserv and remove the links" do @provider.should_receive(:run_command).with({:command=>"/sbin/insserv -r -f #{@new_resource.service_name}"}) diff --git a/spec/unit/provider/service/invokercd_service_spec.rb b/spec/unit/provider/service/invokercd_service_spec.rb index 798b987dd5..ca20657405 100644 --- a/spec/unit/provider/service/invokercd_service_spec.rb +++ b/spec/unit/provider/service/invokercd_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -40,7 +40,7 @@ PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do @provider.load_current_resource @provider.current_resource.should equal(@current_resource) @@ -60,7 +60,7 @@ PS @provider.should_receive(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource end - + it "should set running to true if the status command returns 0" do @provider.stub!(:shell_out).with("/usr/sbin/invoke-rc.d #{@current_resource.service_name} status").and_return(@status) @provider.load_current_resource @@ -90,9 +90,9 @@ PS @provider.should_receive(:shell_out).with("/usr/sbin/invoke-rc.d chefhasmonkeypants status").and_return(@status) @provider.load_current_resource end - + end - + describe "when the node has not specified a ps command" do it "should raise error if the node has a nil ps attribute and no other means to get status" do @node.automatic_attrs[:command] = {:ps => nil} @@ -107,7 +107,7 @@ PS @provider.define_resource_requirements lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end - + end @@ -125,7 +125,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos RUNNING_PS @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.should_receive(:shell_out!).and_return(@status) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -159,7 +159,7 @@ RUNNING_PS it "should call '/usr/sbin/invoke-rc.d service_name start' if no start command is specified" do @provider.should_receive(:shell_out!).with("/usr/sbin/invoke-rc.d #{@new_resource.service_name} start") @provider.start_service() - end + end end describe Chef::Provider::Service::Invokercd, "stop_service" do diff --git a/spec/unit/provider/service/redhat_spec.rb b/spec/unit/provider/service/redhat_spec.rb index dd874a4f05..3ce4301026 100644 --- a/spec/unit/provider/service/redhat_spec.rb +++ b/spec/unit/provider/service/redhat_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -47,7 +47,7 @@ describe "Chef::Provider::Service::Redhat" do @node.automatic_attrs[:command] = {:ps => 'foo'} @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::Service.new("chef") @current_resource = Chef::Resource::Service.new("chef") @@ -73,7 +73,7 @@ describe "Chef::Provider::Service::Redhat" do @provider.load_current_resource @current_resource.enabled.should be_true end - + it "sets the current enabled status to false if the regex does not match" do status = mock("Status", :exitstatus => 0, :stdout => "" , :stderr => "") @provider.should_receive(:shell_out).with("/sbin/service chef status").and_return(status) @@ -84,10 +84,10 @@ describe "Chef::Provider::Service::Redhat" do @current_resource.enabled.should be_false end end - + describe "define resource requirements" do it_should_behave_like "define_resource_requirements_common" - + context "when the service does not exist" do before do status = mock("Status", :exitstatus => 1, :stdout => "", :stderr => "chef: unrecognized service") diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb index cc0173e246..73cb3766d2 100644 --- a/spec/unit/provider/service/simple_service_spec.rb +++ b/spec/unit/provider/service/simple_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -39,7 +39,7 @@ NOMOCKINGSTRINGSPLZ @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) end - + it "should create a current resource with the name of the new resource" do Chef::Resource::Service.should_receive(:new).and_return(@current_resource) @provider.load_current_resource @@ -81,7 +81,7 @@ aj 7842 5057 0 21:26 pts/2 00:00:06 poos NOMOCKINGSTRINGSPLZ @status = mock("Status", :exitstatus => 0, :stdout => @stdout) @provider.stub!(:shell_out!).and_return(@status) - @provider.load_current_resource + @provider.load_current_resource @current_resource.running.should be_true end @@ -117,7 +117,7 @@ NOMOCKINGSTRINGSPLZ @provider.define_resource_requirements @provider.action = :start lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) - end + end end describe "when stopping a service" do @@ -144,7 +144,7 @@ NOMOCKINGSTRINGSPLZ it "should raise an exception if the resource doesn't support restart, no restart command is provided, and no stop command is provided" do @provider.define_resource_requirements @provider.action = :restart - lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) + lambda { @provider.process_resource_requirements }.should raise_error(Chef::Exceptions::Service) end it "should just call stop, then start when the resource doesn't support restart and no restart_command is specified" do diff --git a/spec/unit/provider/service/solaris_smf_service_spec.rb b/spec/unit/provider/service/solaris_smf_service_spec.rb index 5cda6ddb77..64afee078c 100644 --- a/spec/unit/provider/service/solaris_smf_service_spec.rb +++ b/spec/unit/provider/service/solaris_smf_service_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -44,7 +44,7 @@ describe Chef::Provider::Service::Solaris do it "should raise an error if /bin/svcs does not exist" do File.should_receive(:exists?).with("/bin/svcs").and_return(false) lambda { @provider.load_current_resource }.should raise_error(Chef::Exceptions::Service) - end + end describe "on a host with /bin/svcs" do @@ -63,7 +63,7 @@ describe Chef::Provider::Service::Solaris do it "should return the current resource" do @provider.stub!(:popen4).with("/bin/svcs -l chef").and_return(@status) @provider.load_current_resource.should eql(@current_resource) - end + end it "should popen4 '/bin/svcs -l service_name'" do @provider.should_receive(:popen4).with("/bin/svcs -l chef").and_return(@status) diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb index bca28a2d92..a107888b0b 100644 --- a/spec/unit/provider/service/systemd_service_spec.rb +++ b/spec/unit/provider/service/systemd_service_spec.rb @@ -79,19 +79,19 @@ describe Chef::Provider::Service::Systemd do @provider.load_current_resource @provider.instance_variable_get("@status_check_success").should be_true end - + it "should set running to false if it catches a Chef::Exceptions::Exec when using a status command" do @provider.stub!(:run_command_with_systems_locale).and_raise(Chef::Exceptions::Exec) @current_resource.should_receive(:running).with(false) @provider.load_current_resource end - + it "should update state to indicate status check failed when an exception is thrown using a status command" do @provider.stub!(:run_command_with_systems_locale).and_raise(Chef::Exceptions::Exec) @provider.load_current_resource @provider.instance_variable_get("@status_check_success").should be_false end - end + end it "should check if the service is enabled" do @provider.should_receive(:is_enabled?) diff --git a/spec/unit/provider/service/upstart_service_spec.rb b/spec/unit/provider/service/upstart_service_spec.rb index 4224b229e5..8628a4eaf7 100644 --- a/spec/unit/provider/service/upstart_service_spec.rb +++ b/spec/unit/provider/service/upstart_service_spec.rb @@ -73,7 +73,7 @@ describe Chef::Provider::Service::Upstart do @stdout = StringIO.new @stderr = StringIO.new @pid = mock("PID") - + ::File.stub!(:exists?).and_return(true) ::File.stub!(:open).and_return(true) end @@ -172,7 +172,7 @@ describe Chef::Provider::Service::Upstart do @provider.load_current_resource end - it "should track state when the user-provided status command fails" do + it "should track state when the user-provided status command fails" do @provider.stub!(:popen4).and_yield(@pid, @stdin, @stdout, @stderr).and_raise(Chef::Exceptions::Exec) @provider.load_current_resource @provider.instance_variable_get("@command_success").should == false @@ -190,7 +190,7 @@ describe Chef::Provider::Service::Upstart do @provider.load_current_resource @provider.instance_variable_get("@command_success").should == false end - + it "should return the current resource" do @provider.load_current_resource.should eql(@current_resource) end diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index a68e798d36..7ec4ccf96a 100644 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -95,7 +95,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do end describe Chef::Provider::Service::Windows, "stop_service" do - + before(:each) do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( mock("StatusStruct", :current_state => "running"), @@ -143,9 +143,9 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should stop then start the service if it is running" do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( - mock("StatusStruct", :current_state => "running"), - mock("StatusStruct", :current_state => "stopped"), - mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "running"), + mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), mock("StatusStruct", :current_state => "running")) Win32::Service.should_receive(:stop).with(@new_resource.service_name) Win32::Service.should_receive(:start).with(@new_resource.service_name) @@ -155,8 +155,8 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do it "should just start the service if it is stopped" do Win32::Service.stub!(:status).with(@new_resource.service_name).and_return( - mock("StatusStruct", :current_state => "stopped"), - mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), + mock("StatusStruct", :current_state => "stopped"), mock("StatusStruct", :current_state => "running")) Win32::Service.should_receive(:start).with(@new_resource.service_name) @provider.restart_service @@ -201,7 +201,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do @new_resource.updated_by_last_action?.should be_false end end - + describe Chef::Provider::Service::Windows, "disable_service" do before(:each) do diff --git a/spec/unit/provider/subversion_spec.rb b/spec/unit/provider/subversion_spec.rb index 81e5860225..dd020d4597 100644 --- a/spec/unit/provider/subversion_spec.rb +++ b/spec/unit/provider/subversion_spec.rb @@ -247,7 +247,7 @@ describe Chef::Provider::Subversion do ::File.stub!(:directory?).with("/my/deploy").and_return(true) ::File.should_receive(:exist?).with("/my/deploy/dir/.svn").twice.and_return(false) @provider.should_receive(:action_checkout) - @provider.run_action(:sync) + @provider.run_action(:sync) end it "runs the sync_command on action_sync if the deploy dir exists and isn't empty" do diff --git a/spec/unit/provider/user/dscl_spec.rb b/spec/unit/provider/user/dscl_spec.rb index 3894cd61b4..dd98c55bd1 100644 --- a/spec/unit/provider/user/dscl_spec.rb +++ b/spec/unit/provider/user/dscl_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -29,7 +29,7 @@ describe Chef::Provider::User::Dscl do @new_resource = Chef::Resource::User.new("toor") @provider = Chef::Provider::User::Dscl.new(@new_resource, @run_context) end - + describe "when shelling out to dscl" do it "should run dscl with the supplied cmd /Path args" do shell_return = ShellCmdResult.new('stdout', 'err', 0) @@ -66,7 +66,7 @@ describe Chef::Provider::User::Dscl do before do @provider.stub!(:safe_dscl).and_return("\nwheel 200\nstaff 201\n") end - + it "should run safe_dscl with list /Users uid" do @provider.should_receive(:safe_dscl).with("list /Users uid") @provider.get_free_uid @@ -75,7 +75,7 @@ describe Chef::Provider::User::Dscl do it "should return the first unused uid number on or above 200" do @provider.get_free_uid.should == 202 end - + it "should raise an exception when the search limit is exhausted" do search_limit = 1 lambda { @provider.get_free_uid(search_limit) }.should raise_error(RuntimeError) @@ -91,7 +91,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("list /Users uid") @provider.uid_used?(500) end - + it "should return true for a used uid number" do @provider.uid_used?(500).should be_true end @@ -111,7 +111,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:get_free_uid).and_return(501) lambda { @provider.set_uid }.should raise_error(Chef::Exceptions::RequestedUIDUnavailable) end - + it "finds a valid, unused uid when none is specified" do @provider.should_receive(:safe_dscl).with("list /Users uid").and_return('') @provider.should_receive(:safe_dscl).with("create /Users/toor UniqueID 501") @@ -119,7 +119,7 @@ describe Chef::Provider::User::Dscl do @provider.set_uid @new_resource.uid.should == 501 end - + it "sets the uid specified in the resource" do @new_resource.uid(1000) @provider.should_receive(:safe_dscl).with("create /Users/toor UniqueID 1000").and_return(true) @@ -132,7 +132,7 @@ describe Chef::Provider::User::Dscl do before do @new_resource.supports({ :manage_home => true }) @new_resource.home('/Users/toor') - + @current_resource = @new_resource.dup @provider.current_resource = @current_resource end @@ -142,7 +142,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("delete /Users/toor NFSHomeDirectory").and_return(true) @provider.modify_home end - + it "raises InvalidHomeDirectory when the resource's home directory doesn't look right" do @new_resource.home('epic-fail') @@ -151,20 +151,20 @@ describe Chef::Provider::User::Dscl do it "moves the users home to the new location if it exists and the target location is different" do @new_resource.supports(:manage_home => true) - + current_home = CHEF_SPEC_DATA + '/old_home_dir' current_home_files = [current_home + '/my-dot-emacs', current_home + '/my-dot-vim'] @current_resource.home(current_home) @new_resource.gid(23) ::File.stub!(:exists?).with('/old/home/toor').and_return(true) ::File.stub!(:exists?).with('/Users/toor').and_return(true) - + FileUtils.should_receive(:mkdir_p).with('/Users/toor').and_return(true) FileUtils.should_receive(:rmdir).with(current_home) ::Dir.should_receive(:glob).with("#{CHEF_SPEC_DATA}/old_home_dir/*",::File::FNM_DOTMATCH).and_return(current_home_files) FileUtils.should_receive(:mv).with(current_home_files, "/Users/toor", :force => true) FileUtils.should_receive(:chown_R).with('toor','23','/Users/toor') - + @provider.should_receive(:safe_dscl).with("create /Users/toor NFSHomeDirectory '/Users/toor'") @provider.modify_home end @@ -251,7 +251,7 @@ describe Chef::Provider::User::Dscl do before do @new_resource.password("F"*48) end - + it "should write a shadow hash file with the expected salted sha1" do uuid = "B398449E-CEE0-45E0-80F8-B0B5B1BFDEAA" File.should_receive(:open).with('/var/db/shadow/hash/B398449E-CEE0-45E0-80F8-B0B5B1BFDEAA', "w", 384).and_yield(@output) @@ -262,7 +262,7 @@ describe Chef::Provider::User::Dscl do expected_shadow_hash[168] = expected_salted_sha1 @provider.modify_password @output.string.strip.should == expected_shadow_hash - end + end end describe "when given a shadow hash file for the password" do @@ -292,7 +292,7 @@ describe Chef::Provider::User::Dscl do @provider.should_receive(:safe_dscl).with("read /Users/toor").and_return("\nAuthenticationAuthority: ;ShadowHash;\n") @provider.modify_password @output.string.strip.should match(/^0{168}(FFFFFFFF1C1AA7935D4E1190AFEC92343F31F7671FBF126D)0{1071}$/) - end + end end it "should write the output directly to the shadow hash file at /var/db/shadow/hash/GUID" do @@ -392,7 +392,7 @@ describe Chef::Provider::User::Dscl do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource - + # These are all different from @current_resource @new_resource.username "mud" @new_resource.uid 2342 @@ -400,7 +400,7 @@ describe Chef::Provider::User::Dscl do @new_resource.home '/Users/death' @new_resource.password 'goaway' end - + it "sets the user, comment field, uid, gid, moves the home directory, sets the shell, and sets the password" do @provider.should_receive :dscl_create_user @provider.should_receive :dscl_create_comment @@ -417,11 +417,11 @@ describe Chef::Provider::User::Dscl do before do @current_resource = @new_resource.dup @provider.current_resource = @current_resource - + # This is different from @current_resource @new_resource.gid 2342 end - + it "sets the gid" do @provider.should_receive :dscl_set_gid @provider.manage_user @@ -436,7 +436,7 @@ describe Chef::Provider::User::Dscl do FileUtils.should_receive(:rm_rf).with("/Users/fuuuuuuuuuuuuu") @provider.remove_user end - + it "removes the user from any group memberships" do Etc.stub(:group).and_yield(OpenStruct.new(:name => 'ragefisters', :mem => 'toor')) @provider.should_receive(:safe_dscl).with("delete /Users/toor") diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb index b7503ea15f..ea5bcfe740 100644 --- a/spec/unit/provider/user/pw_spec.rb +++ b/spec/unit/provider/user/pw_spec.rb @@ -23,7 +23,7 @@ describe Chef::Provider::User::Pw do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - + @new_resource = Chef::Resource::User.new("adam") @new_resource.comment "Adam Jacob" @new_resource.uid 1000 @@ -31,7 +31,7 @@ describe Chef::Provider::User::Pw do @new_resource.home "/home/adam" @new_resource.shell "/usr/bin/zsh" @new_resource.password "abracadabra" - + @new_resource.supports :manage_home => true @current_resource = Chef::Resource::User.new("adam") diff --git a/spec/unit/provider/user/windows_spec.rb b/spec/unit/provider/user/windows_spec.rb index 6ede11b28c..b11eeaebe5 100644 --- a/spec/unit/provider/user/windows_spec.rb +++ b/spec/unit/provider/user/windows_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -41,7 +41,7 @@ describe Chef::Provider::User::Windows do @provider = Chef::Provider::User::Windows.new(@new_resource, @run_context) @provider.current_resource = @current_resource end - + describe "when comparing the user's current attributes to the desired attributes" do before do @new_resource.comment "Adam Jacob" @@ -79,7 +79,7 @@ describe Chef::Provider::User::Windows do end end - + describe "and the attributes do not match" do before do @current_resource = Chef::Resource::User.new("adam") @@ -130,7 +130,7 @@ describe Chef::Provider::User::Windows do before(:each) do @provider.stub!(:set_options).and_return(:name=> "monkey") end - + it "should call @net_user.update with the return of set_options" do @net_user.should_receive(:update).with(:name=> "monkey") @provider.manage_user diff --git a/spec/unit/provider/user_spec.rb b/spec/unit/provider/user_spec.rb index 8b1e0a54f4..d054fcc440 100644 --- a/spec/unit/provider/user_spec.rb +++ b/spec/unit/provider/user_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -58,7 +58,7 @@ describe Chef::Provider::User do describe "executing load_current_resource" do before(:each) do @node = Chef::Node.new - #@new_resource = mock("Chef::Resource::User", + #@new_resource = mock("Chef::Resource::User", # :null_object => true, # :username => "adam", # :comment => "Adam Jacob", @@ -152,17 +152,17 @@ describe Chef::Provider::User do @new_resource.password "some new password" Etc.stub!(:getpwnam).and_return(user) end - + unless shadow_lib_unavail? context "and we have the ruby-shadow gem" do - pending "and we are not root (rerun this again as root)", :requires_unprivileged_user => true - + pending "and we are not root (rerun this again as root)", :requires_unprivileged_user => true + context "and we are root", :requires_root => true do it "should pass assertions when ruby-shadow can be loaded" do @provider.action = 'create' original_method = @provider.method(:require) @provider.should_receive(:require) { |*args| original_method.call(*args) } - passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999, + passwd_info = Struct::PasswdEntry.new(:sp_namp => "adm ", :sp_pwdp => "$1$T0N0Q.lc$nyG6pFI3Dpqa5cxUz/57j0", :sp_lstchg => 14861, :sp_min => 0, :sp_max => 99999, :sp_warn => 7, :sp_inact => -1, :sp_expire => -1, :sp_flag => -1) Shadow::Passwd.should_receive(:getspnam).with("adam").and_return(passwd_info) @provider.load_current_resource @@ -177,7 +177,7 @@ describe Chef::Provider::User do @provider.should_receive(:require).with("shadow") { raise LoadError } @provider.load_current_resource @provider.define_resource_requirements - lambda {@provider.process_resource_requirements}.should raise_error Chef::Exceptions::MissingLibrary + lambda {@provider.process_resource_requirements}.should raise_error Chef::Exceptions::MissingLibrary end end @@ -214,13 +214,13 @@ describe Chef::Provider::User do it "should return false if the objects are identical" do @provider.compare_user.should eql(false) - end + end end describe "action_create" do before(:each) do @provider.stub!(:load_current_resource) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true, # :username => "adam", # :comment => "Adam Jacob", @@ -270,7 +270,7 @@ describe Chef::Provider::User do it "should not call remove_user if the user does not exist" do @provider.user_exists = false - @provider.should_not_receive(:remove_user) + @provider.should_not_receive(:remove_user) @provider.action_remove end @@ -293,10 +293,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) @@ -336,10 +336,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) @@ -405,10 +405,10 @@ describe Chef::Provider::User do before(:each) do @provider.stub!(:load_current_resource) # @node = Chef::Node.new - # @new_resource = mock("Chef::Resource::User", + # @new_resource = mock("Chef::Resource::User", # :null_object => true # ) - # @current_resource = mock("Chef::Resource::User", + # @current_resource = mock("Chef::Resource::User", # :null_object => true # ) # @provider = Chef::Provider::User.new(@node, @new_resource) diff --git a/spec/unit/resource/apt_package_spec.rb b/spec/unit/resource/apt_package_spec.rb index 795ffc6fc4..58b007c327 100644 --- a/spec/unit/resource/apt_package_spec.rb +++ b/spec/unit/resource/apt_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::AptPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::AptPackage.new("foo") end - + it "should return a Chef::Resource::AptPackage" do @resource.should be_a_kind_of(Chef::Resource::AptPackage) end - + it "should set the resource_name to :apt_package" do @resource.resource_name.should eql(:apt_package) end - + it "should set the provider to Chef::Provider::Package::Apt" do @resource.provider.should eql(Chef::Provider::Package::Apt) end diff --git a/spec/unit/resource/bash_spec.rb b/spec/unit/resource/bash_spec.rb index c7f31e1de6..d729db6977 100644 --- a/spec/unit/resource/bash_spec.rb +++ b/spec/unit/resource/bash_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,17 +22,17 @@ describe Chef::Resource::Bash do before(:each) do @resource = Chef::Resource::Bash.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Bash" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Bash) end - + it "should have a resource name of :bash" do @resource.resource_name.should eql(:bash) end - + it "should have an interpreter of bash" do @resource.interpreter.should eql("bash") end diff --git a/spec/unit/resource/batch_spec.rb b/spec/unit/resource/batch_spec.rb index 91b840908e..b74c7d24a7 100644 --- a/spec/unit/resource/batch_spec.rb +++ b/spec/unit/resource/batch_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -27,22 +27,22 @@ describe Chef::Resource::Batch do node.default["kernel"][:machine] = :x86_64.to_s run_context = Chef::RunContext.new(node, nil, nil) - + @resource = Chef::Resource::Batch.new("batch_unit_test", run_context) - end + end it "should create a new Chef::Resource::Batch" do @resource.should be_a_kind_of(Chef::Resource::Batch) end - + context "windows script" do let(:resource_instance) { @resource } let(:resource_instance_name ) { @resource.command } let(:resource_name) { :batch } let(:interpreter_file_name) { 'cmd.exe' } - it_should_behave_like "a Windows script resource" + it_should_behave_like "a Windows script resource" end - + end diff --git a/spec/unit/resource/breakpoint_spec.rb b/spec/unit/resource/breakpoint_spec.rb index 8eaabb546d..412211a038 100644 --- a/spec/unit/resource/breakpoint_spec.rb +++ b/spec/unit/resource/breakpoint_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,25 +19,25 @@ require 'spec_helper' describe Chef::Resource::Breakpoint do - + before do @breakpoint = Chef::Resource::Breakpoint.new end - + it "allows the action :break" do @breakpoint.allowed_actions.should include(:break) end - + it "defaults to the break action" do @breakpoint.action.should == "break" end - + it "names itself after the line number of the file where it's created" do @breakpoint.name.should match(/breakpoint_spec\.rb\:[\d]{2}\:in \`new\'$/) end - + it "uses the breakpoint provider" do @breakpoint.provider.should == Chef::Provider::Breakpoint end - + end diff --git a/spec/unit/resource/chef_gem_spec.rb b/spec/unit/resource/chef_gem_spec.rb index 54def9a49d..1d7ca8a81e 100644 --- a/spec/unit/resource/chef_gem_spec.rb +++ b/spec/unit/resource/chef_gem_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -20,19 +20,19 @@ require 'spec_helper' describe Chef::Resource::ChefGem, "initialize" do - + before(:each) do @resource = Chef::Resource::ChefGem.new("foo") end - + it "should return a Chef::Resource::ChefGem" do @resource.should be_a_kind_of(Chef::Resource::ChefGem) end - + it "should set the resource_name to :chef_gem" do @resource.resource_name.should eql(:chef_gem) end - + it "should set the provider to Chef::Provider::Package::Rubygems" do @resource.provider.should eql(Chef::Provider::Package::Rubygems) end diff --git a/spec/unit/resource/cookbook_file_spec.rb b/spec/unit/resource/cookbook_file_spec.rb index d0408c251a..6c55c8035a 100644 --- a/spec/unit/resource/cookbook_file_spec.rb +++ b/spec/unit/resource/cookbook_file_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,29 +23,29 @@ describe Chef::Resource::CookbookFile do before do @cookbook_file = Chef::Resource::CookbookFile.new('sourcecode_tarball.tgz') end - + it "uses the name parameter for the source parameter" do @cookbook_file.name.should == 'sourcecode_tarball.tgz' end - + it "has a source parameter" do @cookbook_file.name('config_file.conf') @cookbook_file.name.should == 'config_file.conf' end - + it "defaults to a nil cookbook parameter (current cookbook will be used)" do @cookbook_file.cookbook.should be_nil end - + it "has a cookbook parameter" do @cookbook_file.cookbook("munin") @cookbook_file.cookbook.should == 'munin' end - + it "sets the provider to Chef::Provider::CookbookFile" do @cookbook_file.provider.should == Chef::Provider::CookbookFile end - + describe "when it has a backup number, group, mode, owner, source, checksum, and cookbook on nix or path, rights, deny_rights, checksum on windows" do before do if Chef::Platform.windows? @@ -63,21 +63,21 @@ describe Chef::Resource::CookbookFile do @cookbook_file.checksum("1" * 64) end - + it "describes the state" do state = @cookbook_file.state if Chef::Platform.windows? puts state state[:rights].should == [{:permissions => :read, :principals => "Everyone"}] state[:deny_rights].should == [{:permissions => :full_control, :principals => "Clumsy_Sam"}] - else + else state[:group].should == "wheel" state[:mode].should == "0664" state[:owner].should == "root" end state[:checksum].should == "1" * 64 end - + it "returns the path as its identity" do if Chef::Platform.windows? @cookbook_file.identity.should == "C:/temp/origin/file.txt" diff --git a/spec/unit/resource/cron_spec.rb b/spec/unit/resource/cron_spec.rb index 403ffb009b..7f294fae11 100644 --- a/spec/unit/resource/cron_spec.rb +++ b/spec/unit/resource/cron_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,21 +23,21 @@ describe Chef::Resource::Cron do before(:each) do @resource = Chef::Resource::Cron.new("cronify") - end + end it "should create a new Chef::Resource::Cron" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Cron) end - + it "should have a name" do @resource.name.should eql("cronify") end - + it "should have a default action of 'create'" do @resource.action.should eql(:create) end - + it "should accept create or delete for action" do lambda { @resource.action :create }.should_not raise_error(ArgumentError) lambda { @resource.action :delete }.should_not raise_error(ArgumentError) @@ -63,7 +63,7 @@ describe Chef::Resource::Cron do @resource.hour "6" @resource.hour.should eql("6") end - + it "should allow you to specify the day" do @resource.day "10" @resource.day.should eql("10") @@ -110,7 +110,7 @@ describe Chef::Resource::Cron do @resource.send(x, "*").should eql("*") end end - + it "should allow ranges for all time and date values" do [ "minute", "hour", "day", "month", "weekday" ].each do |x| @resource.send(x, "1-2,5").should eql("1-2,5") @@ -130,31 +130,31 @@ describe Chef::Resource::Cron do it "should reject any minute over 59" do lambda { @resource.minute "60" }.should raise_error(RangeError) end - + it "should reject any hour over 23" do lambda { @resource.hour "24" }.should raise_error(RangeError) end - + it "should reject any day over 31" do lambda { @resource.day "32" }.should raise_error(RangeError) end - + it "should reject any month over 12" do lambda { @resource.month "13" }.should raise_error(RangeError) end - + it "should reject any weekday over 7" do lambda { @resource.weekday "8" }.should raise_error(RangeError) end - + it "should convert integer schedule values to a string" do [ "minute", "hour", "day", "month", "weekday" ].each do |x| @resource.send(x, 5).should eql("5") end end - + describe "when it has a time (minute, hour, day, month, weeekend) and user" do - before do + before do @resource.command("tackle") @resource.minute("1") @resource.hour("2") diff --git a/spec/unit/resource/csh_spec.rb b/spec/unit/resource/csh_spec.rb index 291c6ea745..e1534a8f5f 100644 --- a/spec/unit/resource/csh_spec.rb +++ b/spec/unit/resource/csh_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,17 +22,17 @@ describe Chef::Resource::Csh do before(:each) do @resource = Chef::Resource::Csh.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Csh" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Csh) end - + it "should have a resource name of :csh" do @resource.resource_name.should eql(:csh) end - + it "should have an interpreter of csh" do @resource.interpreter.should eql("csh") end diff --git a/spec/unit/resource/deploy_revision_spec.rb b/spec/unit/resource/deploy_revision_spec.rb index 671ba9a1f6..1f509992aa 100644 --- a/spec/unit/resource/deploy_revision_spec.rb +++ b/spec/unit/resource/deploy_revision_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Resource::DeployRevision do - + it "defaults to the revision deploy provider" do @resource = Chef::Resource::DeployRevision.new("deploy _this_!") @resource.provider.should == Chef::Provider::Deploy::Revision @@ -29,11 +29,11 @@ describe Chef::Resource::DeployRevision do @resource = Chef::Resource::DeployRevision.new("deploy _this_!") @resource.resource_name.should == :deploy_revision end - + end describe Chef::Resource::DeployBranch do - + it "defaults to the revision deploy provider" do @resource = Chef::Resource::DeployBranch.new("deploy _this_!") @resource.provider.should == Chef::Provider::Deploy::Revision @@ -43,5 +43,5 @@ describe Chef::Resource::DeployBranch do @resource = Chef::Resource::DeployBranch.new("deploy _this_!") @resource.resource_name.should == :deploy_branch end - + end diff --git a/spec/unit/resource/deploy_spec.rb b/spec/unit/resource/deploy_spec.rb index f2f6893654..7cc25ed41c 100644 --- a/spec/unit/resource/deploy_spec.rb +++ b/spec/unit/resource/deploy_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,7 +19,7 @@ require 'spec_helper' describe Chef::Resource::Deploy do - + class << self def resource_has_a_string_attribute(attr_name) it "has a String attribute for #{attr_name.to_s}" do @@ -28,7 +28,7 @@ describe Chef::Resource::Deploy do lambda {@resource.send(attr_name, 8675309)}.should raise_error(ArgumentError) end end - + def resource_has_a_boolean_attribute(attr_name, opts={:defaults_to=>false}) it "has a Boolean attribute for #{attr_name.to_s}" do @resource.send(attr_name).should eql(opts[:defaults_to]) @@ -36,7 +36,7 @@ describe Chef::Resource::Deploy do @resource.send(attr_name).should eql( !opts[:defaults_to] ) end end - + def resource_has_a_callback_attribute(attr_name) it "has a Callback attribute #{attr_name}" do callback_block = lambda { :noop } @@ -49,11 +49,11 @@ describe Chef::Resource::Deploy do end end end - + before do @resource = Chef::Resource::Deploy.new("/my/deploy/dir") end - + resource_has_a_string_attribute(:repo) resource_has_a_string_attribute(:deploy_to) resource_has_a_string_attribute(:role) @@ -70,15 +70,15 @@ describe Chef::Resource::Deploy do resource_has_a_string_attribute(:svn_password) resource_has_a_string_attribute(:svn_arguments) resource_has_a_string_attribute(:svn_info_args) - + resource_has_a_boolean_attribute(:migrate, :defaults_to=>false) resource_has_a_boolean_attribute(:enable_submodules, :defaults_to=>false) resource_has_a_boolean_attribute(:shallow_clone, :defaults_to=>false) - + it "uses the first argument as the deploy directory" do @resource.deploy_to.should eql("/my/deploy/dir") end - + # For git, any revision, branch, tag, whatever is resolved to a SHA1 ref. # For svn, the branch is included in the repo URL. # Therefore, revision and branch ARE NOT SEPARATE THINGS @@ -86,19 +86,19 @@ describe Chef::Resource::Deploy do @resource.branch "stable" @resource.revision.should eql("stable") end - + it "takes the SCM resource to use as a constant, and defaults to git" do @resource.scm_provider.should eql(Chef::Provider::Git) @resource.scm_provider Chef::Provider::Subversion @resource.scm_provider.should eql(Chef::Provider::Subversion) end - + it "allows scm providers to be set via symbol" do @resource.scm_provider.should == Chef::Provider::Git @resource.scm_provider :subversion @resource.scm_provider.should == Chef::Provider::Subversion end - + it "allows scm providers to be set via string" do @resource.scm_provider.should == Chef::Provider::Git @resource.scm_provider "subversion" @@ -111,105 +111,105 @@ describe Chef::Resource::Deploy do @resource.svn_force_export.should be_true lambda {@resource.svn_force_export(10053)}.should raise_error(ArgumentError) end - + it "takes arbitrary environment variables in a hash" do @resource.environment "RAILS_ENV" => "production" @resource.environment.should == {"RAILS_ENV" => "production"} end - + it "takes string arguments to environment for backwards compat, setting RAILS_ENV, RACK_ENV, and MERB_ENV" do @resource.environment "production" @resource.environment.should == {"RAILS_ENV"=>"production", "RACK_ENV"=>"production","MERB_ENV"=>"production"} end - + it "sets destination to $deploy_to/shared/$repository_cache" do @resource.destination.should eql("/my/deploy/dir/shared/cached-copy") end - + it "sets shared_path to $deploy_to/shared" do @resource.shared_path.should eql("/my/deploy/dir/shared") end - + it "sets current_path to $deploy_to/current" do @resource.current_path.should eql("/my/deploy/dir/current") end - + it "gets the current_path correct even if the shared_path is set (regression test)" do @resource.shared_path @resource.current_path.should eql("/my/deploy/dir/current") end - + it "gives #depth as 5 if shallow clone is true, nil otherwise" do @resource.depth.should be_nil @resource.shallow_clone true @resource.depth.should eql("5") end - + it "aliases repo as repository" do @resource.repository "git@github.com/opcode/cookbooks.git" @resource.repo.should eql("git@github.com/opcode/cookbooks.git") end - + it "aliases git_ssh_wrapper as ssh_wrapper" do @resource.ssh_wrapper "git_my_repo.sh" @resource.git_ssh_wrapper.should eql("git_my_repo.sh") end - + it "has an Array attribute purge_before_symlink, default: log, tmp/pids, public/system" do @resource.purge_before_symlink.should == %w{ log tmp/pids public/system } @resource.purge_before_symlink %w{foo bar baz} @resource.purge_before_symlink.should == %w{foo bar baz} end - + it "has an Array attribute create_dirs_before_symlink, default: tmp, public, config" do @resource.create_dirs_before_symlink.should == %w{tmp public config} @resource.create_dirs_before_symlink %w{foo bar baz} @resource.create_dirs_before_symlink.should == %w{foo bar baz} end - + it 'has a Hash attribute symlinks, default: {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}' do default = { "system" => "public/system", "pids" => "tmp/pids", "log" => "log"} @resource.symlinks.should == default @resource.symlinks "foo" => "bar/baz" @resource.symlinks.should == {"foo" => "bar/baz"} end - + it 'has a Hash attribute symlink_before_migrate, default "config/database.yml" => "config/database.yml"' do @resource.symlink_before_migrate.should == {"config/database.yml" => "config/database.yml"} @resource.symlink_before_migrate "wtf?" => "wtf is going on" @resource.symlink_before_migrate.should == {"wtf?" => "wtf is going on"} end - + resource_has_a_callback_attribute :before_migrate resource_has_a_callback_attribute :before_symlink resource_has_a_callback_attribute :before_restart resource_has_a_callback_attribute :after_restart - + it "aliases restart_command as restart" do @resource.restart "foobaz" @resource.restart_command.should == "foobaz" end - + it "takes a block for the restart parameter" do restart_like_this = lambda {p :noop} @resource.restart(&restart_like_this) @resource.restart.should == restart_like_this end - + it "defaults to using the Deploy::Timestamped provider" do @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + it "allows providers to be set with a full class name" do @resource.provider Chef::Provider::Deploy::Timestamped @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + it "allows deploy providers to be set via symbol" do @resource.provider :revision @resource.provider.should == Chef::Provider::Deploy::Revision end - + it "allows deploy providers to be set via string" do @resource.provider "revision" @resource.provider.should == Chef::Provider::Deploy::Revision @@ -245,7 +245,7 @@ describe Chef::Resource::Deploy do describe "when it has meta application root, revision, user, group, scm provider, repository cache, environment, simlinks and migrate" do - before do + before do @resource.repository("http://uri.org") @resource.deploy_to("/") @resource.revision("1.2.3") @@ -256,7 +256,7 @@ describe Chef::Resource::Deploy do @resource.environment({"SUDO" => "TRUE"}) @resource.symlinks({"system" => "public/system"}) @resource.migrate(false) - + end it "describes its state" do @@ -269,5 +269,5 @@ describe Chef::Resource::Deploy do @resource.identity.should == "http://uri.org" end end - + end diff --git a/spec/unit/resource/directory_spec.rb b/spec/unit/resource/directory_spec.rb index 9b0c8242e6..dc042c5a77 100644 --- a/spec/unit/resource/directory_spec.rb +++ b/spec/unit/resource/directory_spec.rb @@ -61,7 +61,7 @@ describe Chef::Resource::Directory do end describe "when it has group, mode, and owner" do - before do + before do @resource.path("/tmp/foo/bar/") @resource.group("wheel") @resource.mode("0664") diff --git a/spec/unit/resource/dpkg_package_spec.rb b/spec/unit/resource/dpkg_package_spec.rb index 000908712f..9ef498a577 100644 --- a/spec/unit/resource/dpkg_package_spec.rb +++ b/spec/unit/resource/dpkg_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::DpkgPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::DpkgPackage.new("foo") end - + it "should return a Chef::Resource::DpkgPackage" do @resource.should be_a_kind_of(Chef::Resource::DpkgPackage) end - + it "should set the resource_name to :dpkg_package" do @resource.resource_name.should eql(:dpkg_package) end - + it "should set the provider to Chef::Provider::Package::Dpkg" do @resource.provider.should eql(Chef::Provider::Package::Dpkg) end diff --git a/spec/unit/resource/env_spec.rb b/spec/unit/resource/env_spec.rb index 6862c669b2..b53cbe478f 100644 --- a/spec/unit/resource/env_spec.rb +++ b/spec/unit/resource/env_spec.rb @@ -66,7 +66,7 @@ describe Chef::Resource::Env do end describe "when it has key name and value" do - before do + before do @resource.key_name("charmander") @resource.value("level7") @resource.delim("hi") diff --git a/spec/unit/resource/erl_call_spec.rb b/spec/unit/resource/erl_call_spec.rb index ccad371723..49df9639d1 100644 --- a/spec/unit/resource/erl_call_spec.rb +++ b/spec/unit/resource/erl_call_spec.rb @@ -68,7 +68,7 @@ describe Chef::Resource::ErlCall do end describe "when it has cookie and node_name" do - before do + before do @resource.code("erl-call:function()") @resource.cookie("cookie") @resource.node_name("raster") diff --git a/spec/unit/resource/freebsd_package_spec.rb b/spec/unit/resource/freebsd_package_spec.rb index 697f5fff06..b80a94f98d 100644 --- a/spec/unit/resource/freebsd_package_spec.rb +++ b/spec/unit/resource/freebsd_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::FreebsdPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::FreebsdPackage.new("foo") end - + it "should return a Chef::Resource::FreebsdPackage" do @resource.should be_a_kind_of(Chef::Resource::FreebsdPackage) end - + it "should set the resource_name to :freebsd_package" do @resource.resource_name.should eql(:freebsd_package) end - + it "should set the provider to Chef::Provider::Package::freebsd" do @resource.provider.should eql(Chef::Provider::Package::Freebsd) end diff --git a/spec/unit/resource/gem_package_spec.rb b/spec/unit/resource/gem_package_spec.rb index 2404afa03a..98703455de 100644 --- a/spec/unit/resource/gem_package_spec.rb +++ b/spec/unit/resource/gem_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::GemPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::GemPackage.new("foo") end - + it "should return a Chef::Resource::GemPackage" do @resource.should be_a_kind_of(Chef::Resource::GemPackage) end - + it "should set the resource_name to :gem_package" do @resource.resource_name.should eql(:gem_package) end - + it "should set the provider to Chef::Provider::Package::Rubygems" do @resource.provider.should eql(Chef::Provider::Package::Rubygems) end diff --git a/spec/unit/resource/git_spec.rb b/spec/unit/resource/git_spec.rb index 69b40ffd42..95a30c28a4 100644 --- a/spec/unit/resource/git_spec.rb +++ b/spec/unit/resource/git_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,28 +19,28 @@ require 'spec_helper' describe Chef::Resource::Git do - + before(:each) do @git = Chef::Resource::Git.new("my awesome webapp") end - + it "is a kind of Scm Resource" do @git.should be_a_kind_of(Chef::Resource::Scm) @git.should be_an_instance_of(Chef::Resource::Git) end - + it "uses the git provider" do @git.provider.should eql(Chef::Provider::Git) end - + it "uses aliases revision as branch" do @git.branch "HEAD" @git.revision.should eql("HEAD") end - + it "aliases revision as reference" do @git.reference "v1.0 tag" @git.revision.should eql("v1.0 tag") end - + end diff --git a/spec/unit/resource/group_spec.rb b/spec/unit/resource/group_spec.rb index 4e6828ca30..df68c5691f 100644 --- a/spec/unit/resource/group_spec.rb +++ b/spec/unit/resource/group_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -22,7 +22,7 @@ require 'spec_helper' describe Chef::Resource::Group, "initialize" do before(:each) do @resource = Chef::Resource::Group.new("admin") - end + end it "should create a new Chef::Resource::Group" do @resource.should be_a_kind_of(Chef::Resource) @@ -32,7 +32,7 @@ describe Chef::Resource::Group, "initialize" do it "should set the resource_name to :group" do @resource.resource_name.should eql(:group) end - + it "should set the group_name equal to the argument to initialize" do @resource.group_name.should eql("admin") end @@ -40,7 +40,7 @@ describe Chef::Resource::Group, "initialize" do it "should default gid to nil" do @resource.gid.should eql(nil) end - + it "should default members to an empty array" do @resource.members.should eql([]) end @@ -48,11 +48,11 @@ describe Chef::Resource::Group, "initialize" do it "should alias users to members, also an empty array" do @resource.users.should eql([]) end - + it "should set action to :create" do @resource.action.should eql(:create) end - + %w{create remove modify manage}.each do |action| it "should allow action #{action}" do @resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym) @@ -125,11 +125,11 @@ describe Chef::Resource::Group, "append" do before(:each) do @resource = Chef::Resource::Group.new("admin") end - + it "should default to false" do @resource.append.should eql(false) end - + it "should allow a boolean" do @resource.append true @resource.append.should eql(true) @@ -138,9 +138,9 @@ describe Chef::Resource::Group, "append" do it "should not allow a hash" do lambda { @resource.send(:gid, { :aj => "is freakin awesome" }) }.should raise_error(ArgumentError) end - + describe "when it has members" do - before do + before do @resource.group_name("pokemon") @resource.members(["blastoise", "pikachu"]) end diff --git a/spec/unit/resource/http_request_spec.rb b/spec/unit/resource/http_request_spec.rb index 924cf66fc2..b636ca9994 100644 --- a/spec/unit/resource/http_request_spec.rb +++ b/spec/unit/resource/http_request_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,7 +23,7 @@ describe Chef::Resource::HttpRequest do before(:each) do @resource = Chef::Resource::HttpRequest.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::HttpRequest" do @resource.should be_a_kind_of(Chef::Resource) @@ -34,18 +34,18 @@ describe Chef::Resource::HttpRequest do @resource.url "http://slashdot.org" @resource.url.should eql("http://slashdot.org") end - + it "should set the message to the name by default" do @resource.message.should eql("fakey_fakerton") end - + it "should set message to a string" do @resource.message "monkeybars" @resource.message.should eql("monkeybars") end describe "when it has a message and headers" do - before do + before do @resource.url("http://www.trololol.net") @resource.message("Get sum post brah.") @resource.headers({"head" => "tail"}) @@ -55,5 +55,5 @@ describe Chef::Resource::HttpRequest do @resource.identity.should == "http://www.trololol.net" end end - + end diff --git a/spec/unit/resource/ifconfig_spec.rb b/spec/unit/resource/ifconfig_spec.rb index 58869d5107..10a4d09982 100644 --- a/spec/unit/resource/ifconfig_spec.rb +++ b/spec/unit/resource/ifconfig_spec.rb @@ -28,7 +28,7 @@ describe Chef::Resource::Ifconfig do end describe "when it has target, hardware address, inet address, and a mask" do - before do + before do @resource.device("charmander") @resource.target("team_rocket") @resource.hwaddr("11.2223.223") diff --git a/spec/unit/resource/ips_package_spec.rb b/spec/unit/resource/ips_package_spec.rb index 92e62606de..61661922fa 100644 --- a/spec/unit/resource/ips_package_spec.rb +++ b/spec/unit/resource/ips_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::IpsPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::IpsPackage.new("crypto/gnupg") end - + it "should return a Chef::Resource::IpsPackage" do @resource.should be_a_kind_of(Chef::Resource::IpsPackage) end - + it "should set the resource_name to :ips_package" do @resource.resource_name.should eql(:ips_package) end - + it "should set the provider to Chef::Provider::Package::Ips" do @resource.provider.should eql(Chef::Provider::Package::Ips) end diff --git a/spec/unit/resource/link_spec.rb b/spec/unit/resource/link_spec.rb index bf01bce766..fc3f7ff41c 100644 --- a/spec/unit/resource/link_spec.rb +++ b/spec/unit/resource/link_spec.rb @@ -97,7 +97,7 @@ describe Chef::Resource::Link do end describe "when it has to, link_type, owner, and group" do - before do + before do @resource.target_file("/var/target.tar") @resource.to("/to/dir/file.tar") @resource.link_type(:symbolic) diff --git a/spec/unit/resource/log_spec.rb b/spec/unit/resource/log_spec.rb index 4c6b2c122d..4e439f5c5f 100644 --- a/spec/unit/resource/log_spec.rb +++ b/spec/unit/resource/log_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -24,8 +24,8 @@ describe Chef::Resource::Log do before(:each) do @log_str = "this is my string to log" @resource = Chef::Resource::Log.new(@log_str) - end - + end + it "should create a new Chef::Resource::Log" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Log) @@ -47,7 +47,7 @@ describe Chef::Resource::Log do @resource.message "this is different" @resource.message.should == "this is different" end - + it "should accept a vaild level option" do @resource.level :debug @resource.level :info @@ -58,7 +58,7 @@ describe Chef::Resource::Log do end describe "when the identity is defined" do - before do + before do @resource = Chef::Resource::Log.new("ery day I'm loggin-in") end @@ -67,4 +67,3 @@ describe Chef::Resource::Log do end end end - diff --git a/spec/unit/resource/macports_package_spec.rb b/spec/unit/resource/macports_package_spec.rb index 7420fafeb5..7e2e200487 100644 --- a/spec/unit/resource/macports_package_spec.rb +++ b/spec/unit/resource/macports_package_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/resource/mdadm_spec.rb b/spec/unit/resource/mdadm_spec.rb index c4e6704ceb..310f420659 100644 --- a/spec/unit/resource/mdadm_spec.rb +++ b/spec/unit/resource/mdadm_spec.rb @@ -80,13 +80,13 @@ describe Chef::Resource::Mdadm do end describe "when it has devices, level, and chunk" do - before do + before do @resource.raid_device("raider") @resource.devices(["device1", "device2"]) @resource.level(1) @resource.chunk(42) end - + it "describes its state" do state = @resource.state state[:devices].should eql(["device1", "device2"]) @@ -98,5 +98,5 @@ describe Chef::Resource::Mdadm do @resource.identity.should == "raider" end end - + end diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index 9f9a534a4e..fb414018ba 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,7 +23,7 @@ describe Chef::Resource::Mount do before(:each) do @resource = Chef::Resource::Mount.new("filesystem") end - + it "should create a new Chef::Resource::Mount" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Mount) @@ -36,18 +36,18 @@ describe Chef::Resource::Mount do it "should set mount_point to the name" do @resource.mount_point.should eql("filesystem") end - + it "should have a default action of mount" do @resource.action.should eql(:mount) end - + it "should accept mount, umount and remount as actions" do lambda { @resource.action :mount }.should_not raise_error(ArgumentError) lambda { @resource.action :umount }.should_not raise_error(ArgumentError) lambda { @resource.action :remount }.should_not raise_error(ArgumentError) lambda { @resource.action :brooklyn }.should raise_error(ArgumentError) end - + it "should allow you to set the device attribute" do @resource.device "/dev/sdb3" @resource.device.should eql("/dev/sdb3") @@ -76,19 +76,19 @@ describe Chef::Resource::Mount do @resource.options "rw,noexec" @resource.options.should be_a_kind_of(Array) end - + it "should allow options attribute as an array" do @resource.options ["ro", "nosuid"] @resource.options.should be_a_kind_of(Array) end it "should accept true for mounted" do - @resource.mounted(true) + @resource.mounted(true) @resource.mounted.should eql(true) end it "should accept false for mounted" do - @resource.mounted(false) + @resource.mounted(false) @resource.mounted.should eql(false) end @@ -101,12 +101,12 @@ describe Chef::Resource::Mount do end it "should accept true for enabled" do - @resource.enabled(true) + @resource.enabled(true) @resource.enabled.should eql(true) end it "should accept false for enabled" do - @resource.enabled(false) + @resource.enabled(false) @resource.enabled.should eql(false) end @@ -152,7 +152,7 @@ describe Chef::Resource::Mount do end describe "when it has mount point, device type, and fstype" do - before do + before do @resource.device("charmander") @resource.mount_point("123.456") @resource.device_type(:device) @@ -172,7 +172,7 @@ describe Chef::Resource::Mount do end describe "when it has username, password and domain" do - before do + before do @resource.mount_point("T:") @resource.device("charmander") @resource.username("Administrator") diff --git a/spec/unit/resource/ohai_spec.rb b/spec/unit/resource/ohai_spec.rb index 82df61e509..b8d062b4c9 100644 --- a/spec/unit/resource/ohai_spec.rb +++ b/spec/unit/resource/ohai_spec.rb @@ -43,7 +43,7 @@ describe Chef::Resource::Ohai do end describe "when it has a plugin value" do - before do + before do @resource.name("test") @resource.plugin("passwd") end diff --git a/spec/unit/resource/package_spec.rb b/spec/unit/resource/package_spec.rb index 3f9cc7a408..0f175dda12 100644 --- a/spec/unit/resource/package_spec.rb +++ b/spec/unit/resource/package_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,7 +23,7 @@ describe Chef::Resource::Package do before(:each) do @resource = Chef::Resource::Package.new("emacs") - end + end it "should create a new Chef::Resource::Package" do @resource.should be_a_kind_of(Chef::Resource) @@ -38,12 +38,12 @@ describe Chef::Resource::Package do @resource.package_name "something" @resource.package_name.should eql("something") end - + it "should accept a string for the version" do @resource.version "something" @resource.version.should eql("something") end - + it "should accept a string for the response file" do @resource.response_file "something" @resource.response_file.should eql("something") @@ -71,7 +71,7 @@ describe Chef::Resource::Package do state[:version].should == "10.9.8" state[:options].should == "-al" end - + it "returns the file path as its identity" do @resource.identity.should == "tomcat" end diff --git a/spec/unit/resource/pacman_package_spec.rb b/spec/unit/resource/pacman_package_spec.rb index 53ecd296c9..ec5feeb82c 100644 --- a/spec/unit/resource/pacman_package_spec.rb +++ b/spec/unit/resource/pacman_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::PacmanPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::PacmanPackage.new("foo") end - + it "should return a Chef::Resource::PacmanPackage" do @resource.should be_a_kind_of(Chef::Resource::PacmanPackage) end - + it "should set the resource_name to :pacman_package" do @resource.resource_name.should eql(:pacman_package) end - + it "should set the provider to Chef::Provider::Package::Pacman" do @resource.provider.should eql(Chef::Provider::Package::Pacman) end diff --git a/spec/unit/resource/perl_spec.rb b/spec/unit/resource/perl_spec.rb index f0313e6fb9..d25dc98563 100644 --- a/spec/unit/resource/perl_spec.rb +++ b/spec/unit/resource/perl_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,17 +22,17 @@ describe Chef::Resource::Perl do before(:each) do @resource = Chef::Resource::Perl.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Perl" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Perl) end - + it "should have a resource name of :perl" do @resource.resource_name.should eql(:perl) end - + it "should have an interpreter of perl" do @resource.interpreter.should eql("perl") end diff --git a/spec/unit/resource/portage_package_spec.rb b/spec/unit/resource/portage_package_spec.rb index da086d95ba..510f3b5864 100644 --- a/spec/unit/resource/portage_package_spec.rb +++ b/spec/unit/resource/portage_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper")) describe Chef::Resource::PortagePackage, "initialize" do - + before(:each) do @resource = Chef::Resource::PortagePackage.new("foo") end - + it "should return a Chef::Resource::PortagePackage" do @resource.should be_a_kind_of(Chef::Resource::PortagePackage) end - + it "should set the resource_name to :portage_package" do @resource.resource_name.should eql(:portage_package) end - + it "should set the provider to Chef::Provider::Package::Portage" do @resource.provider.should eql(Chef::Provider::Package::Portage) end diff --git a/spec/unit/resource/powershell_spec.rb b/spec/unit/resource/powershell_spec.rb index 6ec37583e6..a35e37c696 100644 --- a/spec/unit/resource/powershell_spec.rb +++ b/spec/unit/resource/powershell_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -30,19 +30,19 @@ describe Chef::Resource::PowershellScript do @resource = Chef::Resource::PowershellScript.new("powershell_unit_test", run_context) - end + end it "should create a new Chef::Resource::PowershellScript" do @resource.should be_a_kind_of(Chef::Resource::PowershellScript) end - + context "windowsscript" do let(:resource_instance) { @resource } let(:resource_instance_name ) { @resource.command } let(:resource_name) { :powershell_script } let(:interpreter_file_name) { 'powershell.exe' } - it_should_behave_like "a Windows script resource" + it_should_behave_like "a Windows script resource" end end diff --git a/spec/unit/resource/python_spec.rb b/spec/unit/resource/python_spec.rb index ff9547db9a..3362b68c62 100644 --- a/spec/unit/resource/python_spec.rb +++ b/spec/unit/resource/python_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,17 +22,17 @@ describe Chef::Resource::Python do before(:each) do @resource = Chef::Resource::Python.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Python" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Python) end - + it "should have a resource name of :python" do @resource.resource_name.should eql(:python) end - + it "should have an interpreter of python" do @resource.interpreter.should eql("python") end diff --git a/spec/unit/resource/registry_key_spec.rb b/spec/unit/resource/registry_key_spec.rb index 9d7680de0c..3f227e26b6 100644 --- a/spec/unit/resource/registry_key_spec.rb +++ b/spec/unit/resource/registry_key_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/resource/remote_directory_spec.rb b/spec/unit/resource/remote_directory_spec.rb index e4fa8fc4e3..d3800062ae 100644 --- a/spec/unit/resource/remote_directory_spec.rb +++ b/spec/unit/resource/remote_directory_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,7 +22,7 @@ describe Chef::Resource::RemoteDirectory do before(:each) do @resource = Chef::Resource::RemoteDirectory.new("/etc/dunk") - end + end it "should create a new Chef::Resource::RemoteDirectory" do @resource.should be_a_kind_of(Chef::Resource) @@ -46,35 +46,35 @@ describe Chef::Resource::RemoteDirectory do @resource.files_backup 1 @resource.files_backup.should eql(1) end - + it "should accept false for the remote files backup" do @resource.files_backup false @resource.files_backup.should eql(false) end - + it "should accept 3 or 4 digets for the files_mode" do @resource.files_mode 100 @resource.files_mode.should eql(100) @resource.files_mode 1000 @resource.files_mode.should eql(1000) end - + it "should accept a string or number for the files group" do @resource.files_group "heart" @resource.files_group.should eql("heart") @resource.files_group 1000 @resource.files_group.should eql(1000) end - + it "should accept a string or number for the files owner" do @resource.files_owner "heart" @resource.files_owner.should eql("heart") @resource.files_owner 1000 @resource.files_owner.should eql(1000) end - + describe "when it has cookbook, files owner, files mode, and source" do - before do + before do @resource.path("/var/path/") @resource.cookbook("pokemon.rb") @resource.files_owner("root") diff --git a/spec/unit/resource/remote_file_spec.rb b/spec/unit/resource/remote_file_spec.rb index 93fb3c0c36..643bc8ba21 100644 --- a/spec/unit/resource/remote_file_spec.rb +++ b/spec/unit/resource/remote_file_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -123,7 +123,7 @@ describe Chef::Resource::RemoteFile do end describe "when it has group, mode, owner, source, and checksum" do - before do + before do if Chef::Platform.windows? @resource.path("C:/temp/origin/file.txt") @resource.rights(:read, "Everyone") @@ -144,7 +144,7 @@ describe Chef::Resource::RemoteFile do puts state state[:rights].should == [{:permissions => :read, :principals => "Everyone"}] state[:deny_rights].should == [{:permissions => :full_control, :principals => "Clumsy_Sam"}] - else + else state[:group].should == "pokemon" state[:mode].should == "0664" state[:owner].should == "root" diff --git a/spec/unit/resource/route_spec.rb b/spec/unit/resource/route_spec.rb index 966b3aed34..bca42f1101 100644 --- a/spec/unit/resource/route_spec.rb +++ b/spec/unit/resource/route_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,31 +23,31 @@ describe Chef::Resource::Route do before(:each) do @resource = Chef::Resource::Route.new("10.0.0.10") - end + end it "should create a new Chef::Resource::Route" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Route) end - + it "should have a name" do @resource.name.should eql("10.0.0.10") end - + it "should have a default action of 'add'" do @resource.action.should eql([:add]) end - + it "should accept add or delete for action" do lambda { @resource.action :add }.should_not raise_error(ArgumentError) lambda { @resource.action :delete }.should_not raise_error(ArgumentError) lambda { @resource.action :lolcat }.should raise_error(ArgumentError) end - + it "should use the object name as the target by default" do @resource.target.should eql("10.0.0.10") end - + it "should allow you to specify the netmask" do @resource.netmask "255.255.255.0" @resource.netmask.should eql("255.255.255.0") @@ -72,22 +72,22 @@ describe Chef::Resource::Route do @resource.route_type "host" @resource.route_type.should eql(:host) end - + it "should default to a host route type" do @resource.route_type.should eql(:host) end - + it "should accept a net route type" do @resource.route_type :net @resource.route_type.should eql(:net) end - + it "should reject any other route_type but :host and :net" do lambda { @resource.route_type "lolcat" }.should raise_error(ArgumentError) end - + describe "when it has netmask, gateway, and device" do - before do + before do @resource.target("charmander") @resource.netmask("lemask") @resource.gateway("111.111.111") diff --git a/spec/unit/resource/rpm_package_spec.rb b/spec/unit/resource/rpm_package_spec.rb index d59dc6b29c..25930a5484 100644 --- a/spec/unit/resource/rpm_package_spec.rb +++ b/spec/unit/resource/rpm_package_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/resource/ruby_block_spec.rb b/spec/unit/resource/ruby_block_spec.rb index 637d4fe34d..82bbd1ffc7 100644 --- a/spec/unit/resource/ruby_block_spec.rb +++ b/spec/unit/resource/ruby_block_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -33,7 +33,7 @@ describe Chef::Resource::RubyBlock do it "should have a default action of 'create'" do @resource.action.should eql("run") end - + it "should have a resource name of :ruby_block" do @resource.resource_name.should eql(:ruby_block) end @@ -50,7 +50,7 @@ describe Chef::Resource::RubyBlock do end describe "when it has been initialized with block code" do - before do + before do @resource.block_name("puts 'harrrr'") end diff --git a/spec/unit/resource/ruby_spec.rb b/spec/unit/resource/ruby_spec.rb index 48dfd90898..9bf7316e6d 100644 --- a/spec/unit/resource/ruby_spec.rb +++ b/spec/unit/resource/ruby_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,17 +22,17 @@ describe Chef::Resource::Ruby do before(:each) do @resource = Chef::Resource::Ruby.new("fakey_fakerton") - end + end it "should create a new Chef::Resource::Ruby" do @resource.should be_a_kind_of(Chef::Resource) @resource.should be_a_kind_of(Chef::Resource::Ruby) end - + it "should have a resource name of :ruby" do @resource.resource_name.should eql(:ruby) end - + it "should have an interpreter of ruby" do @resource.interpreter.should eql("ruby") end diff --git a/spec/unit/resource/scm_spec.rb b/spec/unit/resource/scm_spec.rb index d88a4160e7..8f6593a931 100644 --- a/spec/unit/resource/scm_spec.rb +++ b/spec/unit/resource/scm_spec.rb @@ -151,7 +151,7 @@ describe Chef::Resource::Scm do end describe "when it has repository, revision, user, and group" do - before do + before do @resource.destination("hell") @resource.repository("apt") @resource.revision("1.2.3") diff --git a/spec/unit/resource/script_spec.rb b/spec/unit/resource/script_spec.rb index 53735daf01..f100b0dc85 100644 --- a/spec/unit/resource/script_spec.rb +++ b/spec/unit/resource/script_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -20,7 +20,7 @@ require 'spec_helper' describe Chef::Resource::Script do - let(:resource_instance_name) { "fakey_fakerton" } + let(:resource_instance_name) { "fakey_fakerton" } let(:script_resource) { Chef::Resource::Script.new(resource_instance_name) } let(:resource_name) { :script } @@ -30,7 +30,7 @@ describe Chef::Resource::Script do end describe "when it has interpreter and flags" do - before do + before do script_resource.command("grep") script_resource.interpreter("gcc") script_resource.flags("-al") @@ -40,7 +40,7 @@ describe Chef::Resource::Script do script_resource.identity.should == "grep" end end - + it_behaves_like "a script resource" end diff --git a/spec/unit/resource/service_spec.rb b/spec/unit/resource/service_spec.rb index c06eb9dd77..067fa7d0d3 100644 --- a/spec/unit/resource/service_spec.rb +++ b/spec/unit/resource/service_spec.rb @@ -7,9 +7,9 @@ # 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. @@ -23,7 +23,7 @@ describe Chef::Resource::Service do before(:each) do @resource = Chef::Resource::Service.new("chef") - end + end it "should create a new Chef::Resource::Service" do @resource.should be_a_kind_of(Chef::Resource) @@ -42,7 +42,7 @@ describe Chef::Resource::Service do @resource.service_name "something" @resource.service_name.should eql("something") end - + it "should accept a string for the service pattern" do @resource.pattern ".*" @resource.pattern.should eql(".*") @@ -53,7 +53,7 @@ describe Chef::Resource::Service do @resource.pattern /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service start command" do @resource.start_command "/etc/init.d/chef start" @resource.start_command.should eql("/etc/init.d/chef start") @@ -64,7 +64,7 @@ describe Chef::Resource::Service do @resource.start_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service stop command" do @resource.stop_command "/etc/init.d/chef stop" @resource.stop_command.should eql("/etc/init.d/chef stop") @@ -75,23 +75,23 @@ describe Chef::Resource::Service do @resource.stop_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service status command" do @resource.status_command "/etc/init.d/chef status" @resource.status_command.should eql("/etc/init.d/chef status") end - + it "should not accept a regexp for the service status command" do lambda { @resource.status_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service restart command" do @resource.restart_command "/etc/init.d/chef restart" @resource.restart_command.should eql("/etc/init.d/chef restart") end - + it "should not accept a regexp for the service restart command" do lambda { @resource.restart_command /.*/ @@ -102,13 +102,13 @@ describe Chef::Resource::Service do @resource.reload_command "/etc/init.d/chef reload" @resource.reload_command.should eql("/etc/init.d/chef reload") end - + it "should not accept a regexp for the service reload command" do lambda { @resource.reload_command /.*/ }.should raise_error(ArgumentError) end - + it "should accept a string for the service init command" do @resource.init_command "/etc/init.d/chef" @resource.init_command.should eql("/etc/init.d/chef") @@ -122,15 +122,15 @@ describe Chef::Resource::Service do %w{enabled running}.each do |attrib| it "should accept true for #{attrib}" do - @resource.send(attrib, true) + @resource.send(attrib, true) @resource.send(attrib).should eql(true) end - + it "should accept false for #{attrib}" do @resource.send(attrib, false) @resource.send(attrib).should eql(false) end - + it "should not accept a string for #{attrib}" do lambda { @resource.send(attrib, "poop") }.should raise_error(ArgumentError) end @@ -138,7 +138,7 @@ describe Chef::Resource::Service do it "should default all the feature support to false" do support_hash = { :status => false, :restart => false, :reload=> false } @resource.supports.should == support_hash - end + end it "should allow you to set what features this resource supports as a array" do support_array = [ :status, :restart ] @@ -155,7 +155,7 @@ describe Chef::Resource::Service do end describe "when it has pattern and supports" do - before do + before do @resource.service_name("superfriend") @resource.enabled(true) @resource.running(false) @@ -172,5 +172,5 @@ describe Chef::Resource::Service do end end - + end diff --git a/spec/unit/resource/smartos_package_spec.rb b/spec/unit/resource/smartos_package_spec.rb index ca815320ad..4898311bf0 100644 --- a/spec/unit/resource/smartos_package_spec.rb +++ b/spec/unit/resource/smartos_package_spec.rb @@ -6,9 +6,9 @@ # 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. diff --git a/spec/unit/resource/subversion_spec.rb b/spec/unit/resource/subversion_spec.rb index 650eb010a6..67593c5a7c 100644 --- a/spec/unit/resource/subversion_spec.rb +++ b/spec/unit/resource/subversion_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,20 +19,20 @@ require 'spec_helper' describe Chef::Resource::Subversion do - + before do @svn = Chef::Resource::Subversion.new("ohai, svn project!") end - + it "is a subclass of Resource::Scm" do @svn.should be_an_instance_of(Chef::Resource::Subversion) @svn.should be_a_kind_of(Chef::Resource::Scm) end - + it "uses the subversion provider" do @svn.provider.should eql(Chef::Provider::Subversion) end - + it "allows the force_export action" do @svn.allowed_actions.should include(:force_export) end diff --git a/spec/unit/resource/timestamped_deploy_spec.rb b/spec/unit/resource/timestamped_deploy_spec.rb index 89b881830a..f380ffca87 100644 --- a/spec/unit/resource/timestamped_deploy_spec.rb +++ b/spec/unit/resource/timestamped_deploy_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,10 +19,10 @@ require 'spec_helper' describe Chef::Resource::TimestampedDeploy do - + it "defaults to the TimestampedDeploy provider" do @resource = Chef::Resource::TimestampedDeploy.new("stuff") @resource.provider.should == Chef::Provider::Deploy::Timestamped end - + end diff --git a/spec/unit/resource/user_spec.rb b/spec/unit/resource/user_spec.rb index 3454152367..caf12aa416 100644 --- a/spec/unit/resource/user_spec.rb +++ b/spec/unit/resource/user_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -21,7 +21,7 @@ require 'spec_helper' describe Chef::Resource::User, "initialize" do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should create a new Chef::Resource::User" do @resource.should be_a_kind_of(Chef::Resource) @@ -31,29 +31,29 @@ describe Chef::Resource::User, "initialize" do it "should set the resource_name to :user" do @resource.resource_name.should eql(:user) end - + it "should set the username equal to the argument to initialize" do @resource.username.should eql("adam") end - + %w{comment uid gid home shell password}.each do |attrib| it "should set #{attrib} to nil" do @resource.send(attrib).should eql(nil) end end - + it "should set action to :create" do @resource.action.should eql(:create) end - + it "should set supports[:manage_home] to false" do @resource.supports[:manage_home].should eql(false) end - + it "should set supports[:non_unique] to false" do @resource.supports[:non_unique].should eql(false) end - + %w{create remove modify manage lock unlock}.each do |action| it "should allow action #{action}" do @resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym) @@ -72,7 +72,7 @@ end describe Chef::Resource::User, attrib do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should allow a string" do @resource.send(attrib, "adam") @@ -89,13 +89,13 @@ end describe Chef::Resource::User, attrib do before(:each) do @resource = Chef::Resource::User.new("adam") - end + end it "should allow a string" do @resource.send(attrib, "100") @resource.send(attrib).should eql("100") end - + it "should allow an integer" do @resource.send(attrib, 100) @resource.send(attrib).should eql(100) @@ -105,7 +105,7 @@ end lambda { @resource.send(attrib, { :woot => "i found it" }) }.should raise_error(ArgumentError) end end - + describe "when it has uid, gid, and home" do before do @resource = Chef::Resource::User.new("root") diff --git a/spec/unit/resource/yum_package_spec.rb b/spec/unit/resource/yum_package_spec.rb index a0f4aaee55..783a539eb2 100644 --- a/spec/unit/resource/yum_package_spec.rb +++ b/spec/unit/resource/yum_package_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,19 +19,19 @@ require 'spec_helper' describe Chef::Resource::YumPackage, "initialize" do - + before(:each) do @resource = Chef::Resource::YumPackage.new("foo") end - + it "should return a Chef::Resource::YumPackage" do @resource.should be_a_kind_of(Chef::Resource::YumPackage) end - + it "should set the resource_name to :yum_package" do @resource.resource_name.should eql(:yum_package) end - + it "should set the provider to Chef::Provider::Package::Yum" do @resource.provider.should eql(Chef::Provider::Package::Yum) end @@ -56,7 +56,7 @@ describe Chef::Resource::YumPackage, "flush_cache" do it "should default the flush timing to false" do flush_hash = { :before => false, :after => false } @resource.flush_cache.should == flush_hash - end + end it "should allow you to set the flush timing with an array" do flush_array = [ :before, :after ] diff --git a/spec/unit/resource_collection/stepable_iterator_spec.rb b/spec/unit/resource_collection/stepable_iterator_spec.rb index 1da9de20cc..b649f8be6e 100644 --- a/spec/unit/resource_collection/stepable_iterator_spec.rb +++ b/spec/unit/resource_collection/stepable_iterator_spec.rb @@ -5,9 +5,9 @@ # 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. @@ -19,17 +19,17 @@ require 'spec_helper' describe Chef::ResourceCollection::StepableIterator do CRSI = Chef::ResourceCollection::StepableIterator - + it "has an empty array for its collection by default" do CRSI.new.collection.should == [] end - + describe "doing basic iteration" do before do @simple_collection = [1,2,3,4] @iterator = CRSI.for_collection(@simple_collection) end - + it "re-initializes the instance with a collection" do @iterator.collection.should equal(@simple_collection) @iterator.size.should == 4 @@ -51,7 +51,7 @@ describe Chef::ResourceCollection::StepableIterator do collected_by_index.should == @simple_collection collected_by_index.should_not equal(@simple_collection) end - + it "iterates over the collection with index and element" do collected = {} @iterator.each_with_index do |element, index| @@ -59,32 +59,32 @@ describe Chef::ResourceCollection::StepableIterator do end collected.should == {0=>1, 1=>2, 2=>3, 3=>4} end - + end - + describe "pausing and resuming iteration" do - + before do @collection = [] @snitch_var = nil @collection << lambda { @snitch_var = 23 } @collection << lambda { @iterator.pause } @collection << lambda { @snitch_var = 42 } - + @iterator = CRSI.for_collection(@collection) @iterator.each { |proc| proc.call } end - + it "allows the iteration to be paused" do @snitch_var.should == 23 end - + it "allows the iteration to be resumed" do @snitch_var.should == 23 @iterator.resume @snitch_var.should == 42 end - + it "allows iteration to be rewound" do @iterator.skip_back(2) @iterator.resume @@ -92,13 +92,13 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 42 end - + it "allows iteration to be fast forwarded" do @iterator.skip_forward @iterator.resume @snitch_var.should == 23 end - + it "allows iteration to be rewound" do @snitch_var = nil @iterator.rewind @@ -106,7 +106,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 23 end - + it "allows iteration to be stepped" do @snitch_var = nil @iterator.rewind @@ -114,13 +114,13 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.position.should == 1 @snitch_var.should == 23 end - + it "doesn't step if there are no more steps" do @iterator.step.should == 3 lambda {@iterator.step}.should_not raise_error @iterator.step.should be_nil end - + it "allows the iteration to start by being stepped" do @snitch_var = nil @iterator = CRSI.for_collection(@collection) @@ -129,7 +129,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.position.should == 1 @snitch_var.should == 23 end - + it "should work correctly when elements are added to the collection during iteration" do @collection.insert(2, lambda { @snitch_var = 815}) @collection.insert(3, lambda { @iterator.pause }) @@ -138,7 +138,7 @@ describe Chef::ResourceCollection::StepableIterator do @iterator.resume @snitch_var.should == 42 end - + end - + end diff --git a/spec/unit/resource_definition_spec.rb b/spec/unit/resource_definition_spec.rb index a29c15a1e3..abac4c1163 100644 --- a/spec/unit/resource_definition_spec.rb +++ b/spec/unit/resource_definition_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -22,16 +22,16 @@ describe Chef::ResourceDefinition do before(:each) do @def = Chef::ResourceDefinition.new() end - + describe "initialize" do it "should be a Chef::ResourceDefinition" do @def.should be_a_kind_of(Chef::ResourceDefinition) end - + it "should not initialize a new node if one is not provided" do @def.node.should eql(nil) end - + it "should accept a node as an argument" do node = Chef::Node.new node.name("bobo") @@ -39,7 +39,7 @@ describe Chef::ResourceDefinition do @def.node.name.should == "bobo" end end - + describe "node" do it "should set the node with node=" do node = Chef::Node.new @@ -47,32 +47,32 @@ describe Chef::ResourceDefinition do @def.node = node @def.node.name.should == "bobo" end - + it "should return the node" do @def.node = Chef::Node.new @def.node.should be_a_kind_of(Chef::Node) end end - + it "should accept a new definition with a symbol for a name" do - lambda { - @def.define :smoke do + lambda { + @def.define :smoke do end }.should_not raise_error(ArgumentError) - lambda { + lambda { @def.define "george washington" do - end + end }.should raise_error(ArgumentError) @def.name.should eql(:smoke) end - + it "should accept a new definition with a hash" do - lambda { + lambda { @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do end }.should_not raise_error(ArgumentError) end - + it "should expose the prototype hash params in the params hash" do @def.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do; end @def.params[:cigar].should eql("cuban") @@ -86,34 +86,34 @@ describe Chef::ResourceDefinition do @def.recipe.should be_a_kind_of(Proc) @def.recipe.call.should eql("I am what I am") end - + it "should set paramaters based on method_missing" do @def.mind "to fly" @def.params[:mind].should eql("to fly") end - + it "should raise an exception if prototype_params is not a hash" do lambda { @def.define :monkey, Array.new do end }.should raise_error(ArgumentError) end - + it "should raise an exception if define is called without a block" do - lambda { + lambda { @def.define :monkey }.should raise_error(ArgumentError) end - + it "should load a description from a file" do @def.from_file(File.join(CHEF_SPEC_DATA, "definitions", "test.rb")) @def.name.should eql(:rico_suave) @def.params[:rich].should eql("smooth") - end - + end + it "should turn itself into a string based on the name with to_s" do @def.name = :woot @def.to_s.should eql("woot") end - + end diff --git a/spec/unit/run_context/cookbook_compiler_spec.rb b/spec/unit/run_context/cookbook_compiler_spec.rb index fe6bef5618..52f4772206 100644 --- a/spec/unit/run_context/cookbook_compiler_spec.rb +++ b/spec/unit/run_context/cookbook_compiler_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -162,7 +162,7 @@ describe Chef::RunContext::CookbookCompiler do # Tests for this behavior are in RunContext's tests end - describe "listing cookbook order" do + describe "listing cookbook order" do it "should return an array of cookbook names as symbols without duplicates" do node.run_list("test-with-circular-deps::default", "circular-dep1::default", "circular-dep2::default") diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb index d75d6628bb..8063dffc77 100644 --- a/spec/unit/run_context_spec.rb +++ b/spec/unit/run_context_spec.rb @@ -8,9 +8,9 @@ # 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. diff --git a/spec/unit/run_list/run_list_item_spec.rb b/spec/unit/run_list/run_list_item_spec.rb index 62a17aa761..6b9de713da 100644 --- a/spec/unit/run_list/run_list_item_spec.rb +++ b/spec/unit/run_list/run_list_item_spec.rb @@ -101,7 +101,7 @@ describe Chef::RunList::RunListItem do item2 = Chef::RunList::RunListItem.new('recipe[lobsterragefist]') item1.should_not == item2 end - + it "is not equal to another run list item with the same name and type but different version" do item1 = Chef::RunList::RunListItem.new('recipe[lrf,0.1.0]') item2 = Chef::RunList::RunListItem.new('recipe[lrf,0.2.0]') diff --git a/spec/unit/scan_access_control_spec.rb b/spec/unit/scan_access_control_spec.rb index c83a552626..3cfecfaa35 100644 --- a/spec/unit/scan_access_control_spec.rb +++ b/spec/unit/scan_access_control_spec.rb @@ -69,7 +69,7 @@ describe Chef::ScanAccessControl do it "sets the group of the current resource to the current group as a String" do @current_resource.group.should == Etc.getgrgid(0).name end - + it "sets the owner of the current resource to the current owner as a String" do @current_resource.user.should == "root" end @@ -79,7 +79,7 @@ describe Chef::ScanAccessControl do it "sets the group of the current resource to the current group as a String" do @current_resource.group.should == 0 end - + it "sets the owner of the current resource to the current owner as a String" do @current_resource.user.should == 0 end diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb index e32bed697c..3f41c142ee 100644 --- a/spec/unit/search/query_spec.rb +++ b/spec/unit/search/query_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -19,7 +19,7 @@ require 'spec_helper' require 'chef/search/query' -describe Chef::Search::Query do +describe Chef::Search::Query do before(:each) do @rest = mock("Chef::REST") Chef::REST.stub!(:new).and_return(@rest) diff --git a/spec/unit/version/platform_spec.rb b/spec/unit/version/platform_spec.rb index 6245800f9d..8b5b3503dc 100644 --- a/spec/unit/version/platform_spec.rb +++ b/spec/unit/version/platform_spec.rb @@ -5,9 +5,9 @@ # 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. @@ -28,7 +28,7 @@ describe Chef::Version::Platform do it "should transform 1 to 1.0.0" do Chef::Version::Platform.new("1").to_s.should == "1.0.0" end - + describe "when creating valid Versions" do good_versions = %w(1 1.2 1.2.3 1000.80.50000 0.300.25 001.02.00003) good_versions.each do |v| diff --git a/spec/unit/version_class_spec.rb b/spec/unit/version_class_spec.rb index 285588b031..b0fcfbb3fb 100644 --- a/spec/unit/version_class_spec.rb +++ b/spec/unit/version_class_spec.rb @@ -6,9 +6,9 @@ # 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. @@ -28,12 +28,12 @@ describe Chef::Version do @v0.to_s.should == "0.0.0" @v123.to_s.should == "1.2.3" end - + it "should make a round trip with its string representation" do a = Chef::Version.new(@v123.to_s) a.should == @v123 end - + it "should transform 1.2 to 1.2.0" do Chef::Version.new("1.2").to_s.should == "1.2.0" end @@ -118,7 +118,7 @@ describe Chef::Version do end describe "comparison examples" do - [ + [ [ "0.0.0", :>, "0.0.0", false ], [ "0.0.0", :>=, "0.0.0", true ], [ "0.0.0", :==, "0.0.0", true ], diff --git a/spec/unit/version_constraint/platform_spec.rb b/spec/unit/version_constraint/platform_spec.rb index a7749102f0..a3599aeb96 100644 --- a/spec/unit/version_constraint/platform_spec.rb +++ b/spec/unit/version_constraint/platform_spec.rb @@ -5,9 +5,9 @@ # 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. |