summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application.rb2
-rw-r--r--lib/chef/application/agent.rb4
-rw-r--r--lib/chef/checksum/storage.rb4
-rw-r--r--lib/chef/checksum/storage/filesystem.rb4
-rw-r--r--lib/chef/config.rb2
-rw-r--r--lib/chef/cookbook/file_vendor.rb10
-rw-r--r--lib/chef/cookbook/syntax_check.rb6
-rw-r--r--lib/chef/daemon.rb28
-rw-r--r--lib/chef/dsl/include_recipe.rb4
-rw-r--r--lib/chef/event_dispatch/base.rb2
-rw-r--r--lib/chef/event_dispatch/dispatcher.rb2
-rw-r--r--lib/chef/formatters/doc.rb10
-rw-r--r--lib/chef/formatters/error_inspectors/api_error_formatting.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/compile_error_inspector.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/node_load_error_inspector.rb4
-rw-r--r--lib/chef/formatters/error_inspectors/resource_failure_inspector.rb4
-rw-r--r--lib/chef/handler/json_file.rb4
-rw-r--r--lib/chef/knife/client_create.rb2
-rw-r--r--lib/chef/knife/cookbook_download.rb4
-rw-r--r--lib/chef/knife/cookbook_metadata_from_file.rb4
-rw-r--r--lib/chef/knife/cookbook_show.rb6
-rw-r--r--lib/chef/knife/cookbook_site_install.rb4
-rw-r--r--lib/chef/knife/cookbook_site_list.rb4
-rw-r--r--lib/chef/knife/cookbook_site_search.rb6
-rw-r--r--lib/chef/knife/cookbook_site_show.rb10
-rw-r--r--lib/chef/knife/core/subcommand_loader.rb10
-rw-r--r--lib/chef/knife/data_bag_delete.rb6
-rw-r--r--lib/chef/knife/data_bag_edit.rb4
-rw-r--r--lib/chef/knife/data_bag_list.rb4
-rw-r--r--lib/chef/knife/data_bag_show.rb4
-rw-r--r--lib/chef/knife/environment_from_file.rb4
-rw-r--r--lib/chef/knife/index_rebuild.rb4
-rw-r--r--lib/chef/knife/ssh.rb4
-rw-r--r--lib/chef/mixin/checksum.rb4
-rw-r--r--lib/chef/mixin/command.rb28
-rw-r--r--lib/chef/mixin/convert_to_class_name.rb16
-rw-r--r--lib/chef/mixin/create_path.rb18
-rw-r--r--lib/chef/mixin/deep_merge.rb4
-rw-r--r--lib/chef/mixin/from_file.rb12
-rw-r--r--lib/chef/mixin/language_include_recipe.rb4
-rw-r--r--lib/chef/mixin/params_validate.rb42
-rw-r--r--lib/chef/mixin/why_run.rb30
-rw-r--r--lib/chef/mixin/windows_architecture_helper.rb10
-rw-r--r--lib/chef/mixin/xml_escape.rb20
-rw-r--r--lib/chef/monkey_patches/numeric.rb2
-rw-r--r--lib/chef/monkey_patches/regexp.rb8
-rw-r--r--lib/chef/monkey_patches/string.rb6
-rw-r--r--lib/chef/monkey_patches/tempfile.rb4
-rw-r--r--lib/chef/node/attribute.rb2
-rw-r--r--lib/chef/platform/provider_mapping.rb2
-rw-r--r--lib/chef/provider/batch.rb6
-rw-r--r--lib/chef/provider/cron.rb6
-rw-r--r--lib/chef/provider/cron/solaris.rb2
-rw-r--r--lib/chef/provider/cron/unix.rb2
-rw-r--r--lib/chef/provider/deploy/timestamped.rb8
-rw-r--r--lib/chef/provider/erl_call.rb2
-rw-r--r--lib/chef/provider/execute.rb4
-rw-r--r--lib/chef/provider/group.rb42
-rw-r--r--lib/chef/provider/group/dscl.rb18
-rw-r--r--lib/chef/provider/group/gpasswd.rb10
-rw-r--r--lib/chef/provider/group/groupadd.rb20
-rw-r--r--lib/chef/provider/group/pw.rb22
-rw-r--r--lib/chef/provider/group/suse.rb8
-rw-r--r--lib/chef/provider/group/usermod.rb14
-rw-r--r--lib/chef/provider/ifconfig.rb18
-rw-r--r--lib/chef/provider/log.rb6
-rw-r--r--lib/chef/provider/mdadm.rb6
-rw-r--r--lib/chef/provider/mount.rb24
-rw-r--r--lib/chef/provider/mount/aix.rb12
-rw-r--r--lib/chef/provider/mount/mount.rb20
-rw-r--r--lib/chef/provider/package.rb6
-rw-r--r--lib/chef/provider/package/aix.rb2
-rw-r--r--lib/chef/provider/package/dpkg.rb18
-rw-r--r--lib/chef/provider/package/ips.rb6
-rw-r--r--lib/chef/provider/package/macports.rb2
-rw-r--r--lib/chef/provider/package/pacman.rb16
-rw-r--r--lib/chef/provider/package/rpm.rb28
-rw-r--r--lib/chef/provider/package/rubygems.rb2
-rw-r--r--lib/chef/provider/package/smartos.rb2
-rw-r--r--lib/chef/provider/package/solaris.rb8
-rw-r--r--lib/chef/provider/package/yum-dump.py8
-rw-r--r--lib/chef/provider/package/yum.rb6
-rw-r--r--lib/chef/provider/powershell_script.rb14
-rw-r--r--lib/chef/provider/remote_file/http.rb2
-rw-r--r--lib/chef/provider/resource_update.rb18
-rw-r--r--lib/chef/provider/ruby_block.rb6
-rw-r--r--lib/chef/provider/script.rb2
-rw-r--r--lib/chef/provider/service.rb4
-rw-r--r--lib/chef/provider/service/debian.rb20
-rw-r--r--lib/chef/provider/service/freebsd.rb18
-rw-r--r--lib/chef/provider/service/gentoo.rb8
-rw-r--r--lib/chef/provider/service/init.rb2
-rw-r--r--lib/chef/provider/service/insserv.rb4
-rw-r--r--lib/chef/provider/service/invokercd.rb2
-rw-r--r--lib/chef/provider/service/redhat.rb4
-rw-r--r--lib/chef/provider/service/simple.rb12
-rw-r--r--lib/chef/provider/service/solaris.rb2
-rw-r--r--lib/chef/provider/service/systemd.rb6
-rw-r--r--lib/chef/provider/service/upstart.rb28
-rw-r--r--lib/chef/provider/subversion.rb10
-rw-r--r--lib/chef/provider/user.rb10
-rw-r--r--lib/chef/provider/user/dscl.rb56
-rw-r--r--lib/chef/provider/user/pw.rb22
-rw-r--r--lib/chef/provider/user/windows.rb14
-rw-r--r--lib/chef/provider/windows_script.rb14
-rw-r--r--lib/chef/resource/apt_package.rb6
-rw-r--r--lib/chef/resource/bash.rb6
-rw-r--r--lib/chef/resource/batch.rb8
-rw-r--r--lib/chef/resource/bff_package.rb8
-rw-r--r--lib/chef/resource/breakpoint.rb6
-rw-r--r--lib/chef/resource/cron.rb10
-rw-r--r--lib/chef/resource/csh.rb6
-rw-r--r--lib/chef/resource/deploy.rb6
-rw-r--r--lib/chef/resource/deploy_revision.rb12
-rw-r--r--lib/chef/resource/directory.rb4
-rw-r--r--lib/chef/resource/dpkg_package.rb8
-rw-r--r--lib/chef/resource/easy_install_package.rb2
-rw-r--r--lib/chef/resource/erl_call.rb2
-rw-r--r--lib/chef/resource/freebsd_package.rb8
-rw-r--r--lib/chef/resource/group.rb12
-rw-r--r--lib/chef/resource/http_request.rb12
-rw-r--r--lib/chef/resource/ifconfig.rb8
-rw-r--r--lib/chef/resource/ips_package.rb4
-rw-r--r--lib/chef/resource/log.rb22
-rw-r--r--lib/chef/resource/macports_package.rb4
-rw-r--r--lib/chef/resource/mount.rb23
-rw-r--r--lib/chef/resource/ohai.rb6
-rw-r--r--lib/chef/resource/pacman_package.rb8
-rw-r--r--lib/chef/resource/perl.rb6
-rw-r--r--lib/chef/resource/portage_package.rb8
-rw-r--r--lib/chef/resource/powershell_script.rb6
-rw-r--r--lib/chef/resource/python.rb6
-rw-r--r--lib/chef/resource/route.rb8
-rw-r--r--lib/chef/resource/rpm_package.rb4
-rw-r--r--lib/chef/resource/ruby.rb6
-rw-r--r--lib/chef/resource/ruby_block.rb6
-rw-r--r--lib/chef/resource/scm.rb4
-rw-r--r--lib/chef/resource/script.rb10
-rw-r--r--lib/chef/resource/service.rb10
-rw-r--r--lib/chef/resource/smartos_package.rb8
-rw-r--r--lib/chef/resource/subversion.rb6
-rw-r--r--lib/chef/resource/timestamped_deploy.rb8
-rw-r--r--lib/chef/resource/user.rb26
-rw-r--r--lib/chef/resource/windows_script.rb12
-rw-r--r--lib/chef/resource/yum_package.rb4
-rw-r--r--lib/chef/resource_collection.rb2
-rw-r--r--lib/chef/resource_collection/stepable_iterator.rb44
-rw-r--r--lib/chef/resource_definition.rb16
-rw-r--r--lib/chef/resource_definition_list.rb4
-rw-r--r--lib/chef/rest.rb2
-rw-r--r--lib/chef/run_context/cookbook_compiler.rb6
-rw-r--r--lib/chef/shell/shell_session.rb2
-rw-r--r--lib/chef/streaming_cookbook_uploader.rb52
-rw-r--r--lib/chef/tasks/chef_repo.rake32
-rw-r--r--lib/chef/util/diff.rb6
-rw-r--r--lib/chef/util/windows.rb4
-rw-r--r--lib/chef/util/windows/net_group.rb4
-rw-r--r--lib/chef/util/windows/net_use.rb4
-rw-r--r--lib/chef/util/windows/net_user.rb6
-rw-r--r--lib/chef/util/windows/volume.rb6
-rw-r--r--lib/chef/version.rb4
-rw-r--r--lib/chef/win32/handle.rb2
-rw-r--r--lib/chef/win32/security/ace.rb2
-rw-r--r--lib/chef/win32/security/sid.rb2
-rw-r--r--lib/chef/win32/version.rb6
166 files changed, 780 insertions, 781 deletions
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