summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/batch.rb6
-rw-r--r--lib/chef/provider/cookbook_file.rb6
-rw-r--r--lib/chef/provider/cookbook_file/content.rb4
-rw-r--r--lib/chef/provider/cron.rb6
-rw-r--r--lib/chef/provider/cron/unix.rb10
-rw-r--r--lib/chef/provider/deploy/revision.rb6
-rw-r--r--lib/chef/provider/directory.rb12
-rw-r--r--lib/chef/provider/dsc_resource.rb16
-rw-r--r--lib/chef/provider/dsc_script.rb20
-rw-r--r--lib/chef/provider/env.rb6
-rw-r--r--lib/chef/provider/env/windows.rb4
-rw-r--r--lib/chef/provider/erl_call.rb8
-rw-r--r--lib/chef/provider/execute.rb6
-rw-r--r--lib/chef/provider/file.rb32
-rw-r--r--lib/chef/provider/file/content.rb4
-rw-r--r--lib/chef/provider/git.rb40
-rw-r--r--lib/chef/provider/group.rb8
-rw-r--r--lib/chef/provider/group/aix.rb6
-rw-r--r--lib/chef/provider/group/dscl.rb10
-rw-r--r--lib/chef/provider/group/gpasswd.rb2
-rw-r--r--lib/chef/provider/group/groupadd.rb2
-rw-r--r--lib/chef/provider/group/groupmod.rb2
-rw-r--r--lib/chef/provider/group/pw.rb2
-rw-r--r--lib/chef/provider/group/suse.rb6
-rw-r--r--lib/chef/provider/group/usermod.rb2
-rw-r--r--lib/chef/provider/group/windows.rb6
-rw-r--r--lib/chef/provider/http_request.rb4
-rw-r--r--lib/chef/provider/ifconfig.rb16
-rw-r--r--lib/chef/provider/ifconfig/aix.rb2
-rw-r--r--lib/chef/provider/ifconfig/debian.rb8
-rw-r--r--lib/chef/provider/ifconfig/redhat.rb2
-rw-r--r--lib/chef/provider/link.rb18
-rw-r--r--lib/chef/provider/lwrp_base.rb6
-rw-r--r--lib/chef/provider/mdadm.rb4
-rw-r--r--lib/chef/provider/mount.rb6
-rw-r--r--lib/chef/provider/mount/aix.rb2
-rw-r--r--lib/chef/provider/mount/mount.rb4
-rw-r--r--lib/chef/provider/mount/solaris.rb44
-rw-r--r--lib/chef/provider/mount/windows.rb6
-rw-r--r--lib/chef/provider/ohai.rb2
-rw-r--r--lib/chef/provider/osx_profile.rb32
-rw-r--r--lib/chef/provider/package.rb16
-rw-r--r--lib/chef/provider/package/aix.rb8
-rw-r--r--lib/chef/provider/package/apt.rb20
-rw-r--r--lib/chef/provider/package/chocolatey.rb12
-rw-r--r--lib/chef/provider/package/dpkg.rb4
-rw-r--r--lib/chef/provider/package/easy_install.rb12
-rw-r--r--lib/chef/provider/package/freebsd/base.rb6
-rw-r--r--lib/chef/provider/package/freebsd/pkg.rb10
-rw-r--r--lib/chef/provider/package/freebsd/pkgng.rb8
-rw-r--r--lib/chef/provider/package/freebsd/port.rb2
-rw-r--r--lib/chef/provider/package/homebrew.rb26
-rw-r--r--lib/chef/provider/package/ips.rb10
-rw-r--r--lib/chef/provider/package/openbsd.rb16
-rw-r--r--lib/chef/provider/package/pacman.rb8
-rw-r--r--lib/chef/provider/package/paludis.rb10
-rw-r--r--lib/chef/provider/package/portage.rb12
-rw-r--r--lib/chef/provider/package/rpm.rb8
-rw-r--r--lib/chef/provider/package/rubygems.rb48
-rw-r--r--lib/chef/provider/package/smartos.rb6
-rw-r--r--lib/chef/provider/package/solaris.rb10
-rw-r--r--lib/chef/provider/package/windows.rb22
-rw-r--r--lib/chef/provider/package/windows/exe.rb10
-rw-r--r--lib/chef/provider/package/windows/msi.rb4
-rw-r--r--lib/chef/provider/package/windows/registry_uninstall_entry.rb10
-rw-r--r--lib/chef/provider/package/yum.rb28
-rw-r--r--lib/chef/provider/package/zypper.rb12
-rw-r--r--lib/chef/provider/powershell_script.rb16
-rw-r--r--lib/chef/provider/reboot.rb4
-rw-r--r--lib/chef/provider/registry_key.rb18
-rw-r--r--lib/chef/provider/remote_directory.rb26
-rw-r--r--lib/chef/provider/remote_file.rb6
-rw-r--r--lib/chef/provider/remote_file/cache_control_data.rb12
-rw-r--r--lib/chef/provider/remote_file/content.rb8
-rw-r--r--lib/chef/provider/remote_file/ftp.rb20
-rw-r--r--lib/chef/provider/remote_file/http.rb12
-rw-r--r--lib/chef/provider/remote_file/local_file.rb6
-rw-r--r--lib/chef/provider/remote_file/network_file.rb6
-rw-r--r--lib/chef/provider/route.rb84
-rw-r--r--lib/chef/provider/script.rb6
-rw-r--r--lib/chef/provider/service.rb30
-rw-r--r--lib/chef/provider/service/aix.rb4
-rw-r--r--lib/chef/provider/service/aixinit.rb16
-rw-r--r--lib/chef/provider/service/arch.rb4
-rw-r--r--lib/chef/provider/service/debian.rb4
-rw-r--r--lib/chef/provider/service/freebsd.rb10
-rw-r--r--lib/chef/provider/service/gentoo.rb6
-rw-r--r--lib/chef/provider/service/init.rb6
-rw-r--r--lib/chef/provider/service/insserv.rb4
-rw-r--r--lib/chef/provider/service/invokercd.rb4
-rw-r--r--lib/chef/provider/service/macosx.rb28
-rw-r--r--lib/chef/provider/service/openbsd.rb24
-rw-r--r--lib/chef/provider/service/redhat.rb6
-rw-r--r--lib/chef/provider/service/simple.rb6
-rw-r--r--lib/chef/provider/service/solaris.rb12
-rw-r--r--lib/chef/provider/service/systemd.rb6
-rw-r--r--lib/chef/provider/service/upstart.rb12
-rw-r--r--lib/chef/provider/service/windows.rb32
-rw-r--r--lib/chef/provider/subversion.rb14
-rw-r--r--lib/chef/provider/template.rb8
-rw-r--r--lib/chef/provider/template/content.rb4
-rw-r--r--lib/chef/provider/user.rb10
-rw-r--r--lib/chef/provider/user/dscl.rb26
-rw-r--r--lib/chef/provider/user/pw.rb12
-rw-r--r--lib/chef/provider/user/solaris.rb10
-rw-r--r--lib/chef/provider/user/useradd.rb12
-rw-r--r--lib/chef/provider/user/windows.rb16
-rw-r--r--lib/chef/provider/windows_script.rb6
108 files changed, 641 insertions, 641 deletions
diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb
index 5f0134443d..63286f91f6 100644
--- a/lib/chef/provider/batch.rb
+++ b/lib/chef/provider/batch.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/windows_script'
+require "chef/provider/windows_script"
class Chef
class Provider
@@ -25,7 +25,7 @@ class Chef
provides :batch, os: "windows"
def initialize (new_resource, run_context)
- super(new_resource, run_context, '.bat')
+ super(new_resource, run_context, ".bat")
end
def command
@@ -37,7 +37,7 @@ class Chef
end
def flags
- @new_resource.flags.nil? ? '/c' : new_resource.flags + ' /c'
+ @new_resource.flags.nil? ? "/c" : new_resource.flags + " /c"
end
end
diff --git a/lib/chef/provider/cookbook_file.rb b/lib/chef/provider/cookbook_file.rb
index b501a9b41d..a537ca5fd5 100644
--- a/lib/chef/provider/cookbook_file.rb
+++ b/lib/chef/provider/cookbook_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/file'
-require 'chef/deprecation/provider/cookbook_file'
-require 'chef/deprecation/warnings'
+require "chef/provider/file"
+require "chef/deprecation/provider/cookbook_file"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/cookbook_file/content.rb b/lib/chef/provider/cookbook_file/content.rb
index 9f49ba885c..97290ff456 100644
--- a/lib/chef/provider/cookbook_file/content.rb
+++ b/lib/chef/provider/cookbook_file/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/file_content_management/content_base'
-require 'chef/file_content_management/tempfile'
+require "chef/file_content_management/content_base"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index 6d86e336ec..fbd6510121 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/cron/unix.rb b/lib/chef/provider/cron/unix.rb
index 01c61e4253..0c4235df45 100644
--- a/lib/chef/provider/cron/unix.rb
+++ b/lib/chef/provider/cron/unix.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'chef/provider/cron'
+require "chef/log"
+require "chef/provider"
+require "chef/provider/cron"
class Chef
class Provider
@@ -28,12 +28,12 @@ class Chef
class Unix < Chef::Provider::Cron
include Chef::Mixin::ShellOut
- provides :cron, os: 'solaris2'
+ provides :cron, os: "solaris2"
private
def read_crontab
- crontab = shell_out('/usr/bin/crontab -l', :user => @new_resource.user)
+ crontab = shell_out("/usr/bin/crontab -l", :user => @new_resource.user)
status = crontab.status.exitstatus
Chef::Log.debug crontab.format_for_exception if status > 0
diff --git a/lib/chef/provider/deploy/revision.rb b/lib/chef/provider/deploy/revision.rb
index 62aa0e87f6..c3b61a564e 100644
--- a/lib/chef/provider/deploy/revision.rb
+++ b/lib/chef/provider/deploy/revision.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/provider/deploy'
-require 'chef/json_compat'
+require "chef/provider"
+require "chef/provider/deploy"
+require "chef/json_compat"
class Chef
class Provider
diff --git a/lib/chef/provider/directory.rb b/lib/chef/provider/directory.rb
index 8892d3a73d..c9b8b3a844 100644
--- a/lib/chef/provider/directory.rb
+++ b/lib/chef/provider/directory.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/directory'
-require 'chef/provider'
-require 'chef/provider/file'
-require 'fileutils'
+require "chef/config"
+require "chef/log"
+require "chef/resource/directory"
+require "chef/provider"
+require "chef/provider/file"
+require "fileutils"
class Chef
class Provider
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index 3095ff63e0..b2946352fe 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/local_configuration_manager'
-require 'chef/mixin/powershell_type_coercions'
-require 'chef/util/dsc/resource_store'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/local_configuration_manager"
+require "chef/mixin/powershell_type_coercions"
+require "chef/util/dsc/resource_store"
class Chef
class Provider
@@ -61,7 +61,7 @@ class Chef
a.assertion { supports_refresh_mode_enabled? || dsc_refresh_mode_disabled? }
err = ["The LCM must have its RefreshMode set to Disabled for" \
" PowerShell versions before 5.0.10586.0."]
- a.failure_message Chef::Exceptions::ProviderNotFound, err.join(' ')
+ a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
a.whyrun err + ["Assuming a previous resource sets the RefreshMode."]
a.block_action!
end
@@ -109,10 +109,10 @@ class Chef
"Could not find #{dsc_resource_name}. Check to make "\
"sure that it shows up when running Get-DscResource"
when 1
- if found[0]['Module'].nil?
+ if found[0]["Module"].nil?
:none
else
- found[0]['Module']['Name']
+ found[0]["Module"]["Name"]
end
else
raise Chef::Exceptions::MultipleDscResourcesFound, found
@@ -136,7 +136,7 @@ class Chef
def set_resource
result = invoke_resource(:set)
- if return_dsc_resource_result(result, 'RebootRequired')
+ if return_dsc_resource_result(result, "RebootRequired")
create_reboot_resource
end
result.return_value
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index ea47ff22b3..3577c23e7b 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/configuration_generator'
-require 'chef/util/dsc/local_configuration_manager'
-require 'chef/util/path_helper'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/configuration_generator"
+require "chef/util/dsc/local_configuration_manager"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -65,12 +65,12 @@ class Chef
def define_resource_requirements
requirements.assert(:run) do |a|
err = [
- 'Could not find PowerShell DSC support on the system',
+ "Could not find PowerShell DSC support on the system",
powershell_info_str,
"Powershell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
]
a.assertion { supports_dsc? }
- a.failure_message Chef::Exceptions::ProviderNotFound, err.join(' ')
+ a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
a.whyrun err + ["Assuming a previous resource installs Powershell 4.0 or higher."]
a.block_action!
end
@@ -129,7 +129,7 @@ class Chef
else
# If code is also not provided, we mimic what the other script resources do (execute nothing)
Chef::Log.warn("Neither code or command were provided for dsc_resource[#{@dsc_resource.name}].") unless @dsc_resource.code
- generator.configuration_document_from_script_code(@dsc_resource.code || '', configuration_flags, @dsc_resource.imports, shellout_flags)
+ generator.configuration_document_from_script_code(@dsc_resource.code || "", configuration_flags, @dsc_resource.imports, shellout_flags)
end
end
@@ -138,7 +138,7 @@ class Chef
@dsc_resource.configuration_data_script
elsif @dsc_resource.configuration_data
configuration_data_path = "#{config_directory}/chef_dsc_config_data.psd1"
- ::File.open(configuration_data_path, 'wt') do | script |
+ ::File.open(configuration_data_path, "wt") do | script |
script.write(@dsc_resource.configuration_data)
end
configuration_data_path
@@ -164,7 +164,7 @@ class Chef
@dsc_resources_info.map do |resource|
if resource.changes_state?
# We ignore the last log message because it only contains the time it took, which looks weird
- cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, '').strip }
+ cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, "").strip }
"converge DSC resource #{resource.name} by #{cleaned_messages.find_all{ |c| c != ''}.join("\n")}"
else
# This is needed because a dsc script can have resources that are both converged and not
@@ -177,7 +177,7 @@ class Chef
if run_context && run_context.node[:languages] && run_context.node[:languages][:powershell]
install_info = "Powershell #{run_context.node[:languages][:powershell][:version]} was found on the system."
else
- install_info = 'Powershell was not found.'
+ install_info = "Powershell was not found."
end
end
end
diff --git a/lib/chef/provider/env.rb b/lib/chef/provider/env.rb
index 654ecf9d6a..e8ac88e8c4 100644
--- a/lib/chef/provider/env.rb
+++ b/lib/chef/provider/env.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'chef/resource/env'
+require "chef/provider"
+require "chef/mixin/command"
+require "chef/resource/env"
class Chef
class Provider
diff --git a/lib/chef/provider/env/windows.rb b/lib/chef/provider/env/windows.rb
index 56cebdb888..ec05420471 100644
--- a/lib/chef/provider/env/windows.rb
+++ b/lib/chef/provider/env/windows.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/mixin/windows_env_helper'
+require "chef/mixin/windows_env_helper"
class Chef
class Provider
@@ -36,7 +36,7 @@ class Chef
obj.variablevalue = @new_resource.value
obj.put_
value = @new_resource.value
- value = expand_path(value) if @new_resource.key_name.upcase == 'PATH'
+ value = expand_path(value) if @new_resource.key_name.upcase == "PATH"
ENV[@new_resource.key_name] = value
broadcast_env_change
end
diff --git a/lib/chef/provider/erl_call.rb b/lib/chef/provider/erl_call.rb
index f5855bcce6..dc3a8ea50e 100644
--- a/lib/chef/provider/erl_call.rb
+++ b/lib/chef/provider/erl_call.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
@@ -89,7 +89,7 @@ class Chef
end
# fail if the first 4 characters aren't "{ok,"
- unless stdout_output[0..3].include?('{ok,')
+ unless stdout_output[0..3].include?("{ok,")
raise Chef::Exceptions::ErlCall, stdout_output
end
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index 200beb02ad..b291786391 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'forwardable'
+require "chef/log"
+require "chef/provider"
+require "forwardable"
class Chef
class Provider
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index 85bc2d98be..a605682718 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -17,22 +17,22 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/file'
-require 'chef/provider'
-require 'etc'
-require 'fileutils'
-require 'chef/scan_access_control'
-require 'chef/mixin/checksum'
-require 'chef/mixin/file_class'
-require 'chef/mixin/enforce_ownership_and_permissions'
-require 'chef/util/backup'
-require 'chef/util/diff'
-require 'chef/util/selinux'
-require 'chef/deprecation/provider/file'
-require 'chef/deprecation/warnings'
-require 'chef/file_content_management/deploy'
+require "chef/config"
+require "chef/log"
+require "chef/resource/file"
+require "chef/provider"
+require "etc"
+require "fileutils"
+require "chef/scan_access_control"
+require "chef/mixin/checksum"
+require "chef/mixin/file_class"
+require "chef/mixin/enforce_ownership_and_permissions"
+require "chef/util/backup"
+require "chef/util/diff"
+require "chef/util/selinux"
+require "chef/deprecation/provider/file"
+require "chef/deprecation/warnings"
+require "chef/file_content_management/deploy"
# The Tao of File Providers:
# - the content provider must always return a tempfile that we can delete/mv
diff --git a/lib/chef/provider/file/content.rb b/lib/chef/provider/file/content.rb
index f82bc49db4..96dda1bcbc 100644
--- a/lib/chef/provider/file/content.rb
+++ b/lib/chef/provider/file/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/file_content_management/content_base'
-require 'chef/file_content_management/tempfile'
+require "chef/file_content_management/content_base"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 8418f22933..07008b98f6 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/exceptions'
-require 'chef/log'
-require 'chef/provider'
-require 'fileutils'
+require "chef/exceptions"
+require "chef/log"
+require "chef/provider"
+require "fileutils"
class Chef
class Provider
@@ -105,7 +105,7 @@ class Chef
end
def git_minor_version
- @git_minor_version ||= Gem::Version.new(shell_out!('git --version', run_options).stdout.split.last)
+ @git_minor_version ||= Gem::Version.new(shell_out!("git --version", run_options).stdout.split.last)
end
def existing_git_clone?
@@ -113,14 +113,14 @@ class Chef
end
def target_dir_non_existent_or_empty?
- !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..']
+ !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == [".",".."]
end
def find_current_revision
Chef::Log.debug("#{@new_resource} finding current git revision")
if ::File.exist?(::File.join(cwd, ".git"))
# 128 is returned when we're not in a git repo. this is fine
- result = shell_out!('git rev-parse HEAD', :cwd => cwd, :returns => [0,128]).stdout.strip
+ result = shell_out!("git rev-parse HEAD", :cwd => cwd, :returns => [0,128]).stdout.strip
end
sha_hash?(result) ? result : nil
end
@@ -141,9 +141,9 @@ class Chef
remote = @new_resource.remote
args = []
- args << "-o #{remote}" unless remote == 'origin'
+ args << "-o #{remote}" unless remote == "origin"
args << "--depth #{@new_resource.depth}" if @new_resource.depth
- args << "--no-single-branch" if @new_resource.depth and git_minor_version >= Gem::Version.new('1.7.10')
+ args << "--no-single-branch" if @new_resource.depth and git_minor_version >= Gem::Version.new("1.7.10")
Chef::Log.info "#{@new_resource} cloning repo #{@new_resource.repository} to #{@new_resource.destination}"
@@ -250,18 +250,18 @@ class Chef
# Using such a degenerate annotated tag would be very
# confusing. We avoid the issue by disallowing the use of
# annotated tags named 'HEAD'.
- if rev_search_pattern != 'HEAD'
- found = find_revision(refs, @new_resource.revision, '^{}')
+ if rev_search_pattern != "HEAD"
+ found = find_revision(refs, @new_resource.revision, "^{}")
else
- found = refs_search(refs, 'HEAD')
+ found = refs_search(refs, "HEAD")
end
found = find_revision(refs, @new_resource.revision) if found.empty?
found.size == 1 ? found.first[0] : nil
end
def find_revision(refs, revision, suffix="")
- found = refs_search(refs, rev_match_pattern('refs/tags/', revision) + suffix)
- found = refs_search(refs, rev_match_pattern('refs/heads/', revision) + suffix) if found.empty?
+ found = refs_search(refs, rev_match_pattern("refs/tags/", revision) + suffix)
+ found = refs_search(refs, rev_match_pattern("refs/heads/", revision) + suffix) if found.empty?
found = refs_search(refs, revision + suffix) if found.empty?
found
end
@@ -275,10 +275,10 @@ class Chef
end
def rev_search_pattern
- if ['', 'HEAD'].include? @new_resource.revision
- 'HEAD'
+ if ["", "HEAD"].include? @new_resource.revision
+ "HEAD"
else
- @new_resource.revision + '*'
+ @new_resource.revision + "*"
end
end
@@ -300,15 +300,15 @@ class Chef
# Certain versions of `git` misbehave if git configuration is
# inaccessible in $HOME. We need to ensure $HOME matches the
# user who is executing `git` not the user running Chef.
- env['HOME'] = begin
- require 'etc'
+ env["HOME"] = begin
+ require "etc"
Etc.getpwnam(@new_resource.user).dir
rescue ArgumentError # user not found
raise Chef::Exceptions::User, "Could not determine HOME for specified user '#{@new_resource.user}' for resource '#{@new_resource.name}'"
end
end
run_opts[:group] = @new_resource.group if @new_resource.group
- env['GIT_SSH'] = @new_resource.ssh_wrapper if @new_resource.ssh_wrapper
+ env["GIT_SSH"] = @new_resource.ssh_wrapper if @new_resource.ssh_wrapper
run_opts[:log_tag] = @new_resource.to_s
run_opts[:timeout] = @new_resource.timeout if @new_resource.timeout
env.merge!(@new_resource.environment) if @new_resource.environment
diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb
index a1cf92058d..2aa9889b17 100644
--- a/lib/chef/provider/group.rb
+++ b/lib/chef/provider/group.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/shell_out'
-require 'chef/mixin/command'
-require 'etc'
+require "chef/provider"
+require "chef/mixin/shell_out"
+require "chef/mixin/command"
+require "etc"
class Chef
class Provider
diff --git a/lib/chef/provider/group/aix.rb b/lib/chef/provider/group/aix.rb
index d0de538e58..1059208ed8 100644
--- a/lib/chef/provider/group/aix.rb
+++ b/lib/chef/provider/group/aix.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
-require 'chef/mixin/shell_out'
+require "chef/provider/group/groupadd"
+require "chef/mixin/shell_out"
class Chef
class Provider
class Group
class Aix < Chef::Provider::Group::Groupadd
- provides :group, platform: 'aix'
+ provides :group, platform: "aix"
def required_binaries
[ "/usr/bin/mkgroup",
diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb
index 9775ac8270..0b39571458 100644
--- a/lib/chef/provider/group/dscl.rb
+++ b/lib/chef/provider/group/dscl.rb
@@ -21,7 +21,7 @@ class Chef
class Group
class Dscl < Chef::Provider::Group
- provides :group, os: 'darwin'
+ provides :group, os: "darwin"
def dscl(*args)
host = "."
@@ -53,14 +53,14 @@ class Chef
if group_info
group_info.each_line do |line|
- key, val = line.split(': ')
+ key, val = line.split(": ")
val.strip! if val
case key.downcase
- when 'primarygroupid'
+ when "primarygroupid"
@new_resource.gid(val) unless @new_resource.gid
@current_resource.gid(val)
- when 'groupmembership'
- @current_resource.members(val.split(' '))
+ when "groupmembership"
+ @current_resource.members(val.split(" "))
end
end
end
diff --git a/lib/chef/provider/group/gpasswd.rb b/lib/chef/provider/group/gpasswd.rb
index 432c524acd..011a9d1e63 100644
--- a/lib/chef/provider/group/gpasswd.rb
+++ b/lib/chef/provider/group/gpasswd.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb
index b2ca8fd4fe..684df8455e 100644
--- a/lib/chef/provider/group/groupadd.rb
+++ b/lib/chef/provider/group/groupadd.rb
@@ -125,7 +125,7 @@ class Chef
end
def groupadd_options
- opts = ''
+ opts = ""
opts << " -r" if @new_resource.system
opts << " -o" if @new_resource.non_unique
opts
diff --git a/lib/chef/provider/group/groupmod.rb b/lib/chef/provider/group/groupmod.rb
index 82b68b8672..f9299546c8 100644
--- a/lib/chef/provider/group/groupmod.rb
+++ b/lib/chef/provider/group/groupmod.rb
@@ -21,7 +21,7 @@ class Chef
class Group
class Groupmod < Chef::Provider::Group
- provides :group, os: 'netbsd'
+ provides :group, os: "netbsd"
def load_current_resource
super
diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb
index 5b5c8136f1..e4c129ba9f 100644
--- a/lib/chef/provider/group/pw.rb
+++ b/lib/chef/provider/group/pw.rb
@@ -20,7 +20,7 @@ class Chef
class Provider
class Group
class Pw < Chef::Provider::Group
- provides :group, platform: 'freebsd'
+ provides :group, platform: "freebsd"
def load_current_resource
super
diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb
index b47ea33e80..42e525169f 100644
--- a/lib/chef/provider/group/suse.rb
+++ b/lib/chef/provider/group/suse.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
class Group
class Suse < Chef::Provider::Group::Groupadd
- provides :group, platform: 'opensuse', platform_version: '< 12.3'
- provides :group, platform: 'suse', platform_version: '< 12.0'
+ provides :group, platform: "opensuse", platform_version: "< 12.3"
+ provides :group, platform: "suse", platform_version: "< 12.0"
def load_current_resource
super
diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb
index e3d960280d..51b14234ba 100644
--- a/lib/chef/provider/group/usermod.rb
+++ b/lib/chef/provider/group/usermod.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/group/groupadd'
+require "chef/provider/group/groupadd"
class Chef
class Provider
diff --git a/lib/chef/provider/group/windows.rb b/lib/chef/provider/group/windows.rb
index 46d8afc7f6..a665757df4 100644
--- a/lib/chef/provider/group/windows.rb
+++ b/lib/chef/provider/group/windows.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/user'
+require "chef/provider/user"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_group'
+ require "chef/util/windows/net_group"
end
class Chef
@@ -26,7 +26,7 @@ class Chef
class Group
class Windows < Chef::Provider::Group
- provides :group, os: 'windows'
+ provides :group, os: "windows"
def initialize(new_resource,run_context)
super
diff --git a/lib/chef/provider/http_request.rb b/lib/chef/provider/http_request.rb
index dac62bc2f6..62dc0b0a46 100644
--- a/lib/chef/provider/http_request.rb
+++ b/lib/chef/provider/http_request.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/http/simple'
+require "tempfile"
+require "chef/http/simple"
class Chef
class Provider
diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb
index 9ec2533ac0..95f4b979f5 100644
--- a/lib/chef/provider/ifconfig.rb
+++ b/lib/chef/provider/ifconfig.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/mixin/shell_out'
-require 'chef/provider'
-require 'chef/resource/file'
-require 'chef/exceptions'
-require 'erb'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/mixin/shell_out"
+require "chef/provider"
+require "chef/resource/file"
+require "chef/exceptions"
+require "erb"
# Recipe example:
#
@@ -218,7 +218,7 @@ class Chef
end
def loopback_device
- 'lo'
+ "lo"
end
end
end
diff --git a/lib/chef/provider/ifconfig/aix.rb b/lib/chef/provider/ifconfig/aix.rb
index 25c3de3040..4ceb7866db 100644
--- a/lib/chef/provider/ifconfig/aix.rb
+++ b/lib/chef/provider/ifconfig/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
+require "chef/provider/ifconfig"
class Chef
class Provider
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index 1e6863c8b5..b7e4adc0a3 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -16,15 +16,15 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
-require 'chef/util/file_edit'
+require "chef/provider/ifconfig"
+require "chef/util/file_edit"
class Chef
class Provider
class Ifconfig
class Debian < Chef::Provider::Ifconfig
- provides :ifconfig, platform: %w(ubuntu), platform_version: '>= 11.10'
- provides :ifconfig, platform: %w(debian), platform_version: '>= 7.0'
+ provides :ifconfig, platform: %w(ubuntu), platform_version: ">= 11.10"
+ provides :ifconfig, platform: %w(debian), platform_version: ">= 7.0"
INTERFACES_FILE = "/etc/network/interfaces"
INTERFACES_DOT_D_DIR = "/etc/network/interfaces.d"
diff --git a/lib/chef/provider/ifconfig/redhat.rb b/lib/chef/provider/ifconfig/redhat.rb
index ee053d1e52..b0131f8f5a 100644
--- a/lib/chef/provider/ifconfig/redhat.rb
+++ b/lib/chef/provider/ifconfig/redhat.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/ifconfig'
+require "chef/provider/ifconfig"
class Chef
class Provider
diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb
index a5f9b0bb29..571610aeed 100644
--- a/lib/chef/provider/link.rb
+++ b/lib/chef/provider/link.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/mixin/file_class'
-require 'chef/resource/link'
-require 'chef/provider'
-require 'chef/scan_access_control'
-require 'chef/util/path_helper'
+require "chef/config"
+require "chef/log"
+require "chef/mixin/file_class"
+require "chef/resource/link"
+require "chef/provider"
+require "chef/scan_access_control"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -75,7 +75,7 @@ class Chef
a.assertion do
if @current_resource.to
@current_resource.link_type == @new_resource.link_type and
- (@current_resource.link_type == :symbolic or @current_resource.to != '')
+ (@current_resource.link_type == :symbolic or @current_resource.to != "")
else
true
end
@@ -86,7 +86,7 @@ class Chef
end
def canonicalize(path)
- Chef::Platform.windows? ? path.gsub('/', '\\') : path
+ Chef::Platform.windows? ? path.gsub("/", '\\') : path
end
def action_create
diff --git a/lib/chef/provider/lwrp_base.rb b/lib/chef/provider/lwrp_base.rb
index 126184a51a..4298a4aa98 100644
--- a/lib/chef/provider/lwrp_base.rb
+++ b/lib/chef/provider/lwrp_base.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/dsl/recipe'
-require 'chef/dsl/include_recipe'
+require "chef/provider"
+require "chef/dsl/recipe"
+require "chef/dsl/include_recipe"
class Chef
class Provider
diff --git a/lib/chef/provider/mdadm.rb b/lib/chef/provider/mdadm.rb
index 325f1b5977..b55e6abc1a 100644
--- a/lib/chef/provider/mdadm.rb
+++ b/lib/chef/provider/mdadm.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
+require "chef/log"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb
index dc0382c689..ede36417d1 100644
--- a/lib/chef/provider/mount.rb
+++ b/lib/chef/provider/mount.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/shell_out'
-require 'chef/provider'
+require "chef/log"
+require "chef/mixin/shell_out"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 41a2ae1176..577505ac69 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/mount'
+require "chef/provider/mount"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 9ffdf3a557..fe657659ad 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/mount'
-require 'chef/log'
+require "chef/provider/mount"
+require "chef/log"
class Chef
class Provider
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index 062696ac53..f61b9e673b 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -18,9 +18,9 @@
# limitations under the License.
#
-require 'chef/provider/mount'
-require 'chef/log'
-require 'forwardable'
+require "chef/provider/mount"
+require "chef/log"
+require "forwardable"
class Chef
class Provider
@@ -31,7 +31,7 @@ class Chef
extend Forwardable
- VFSTAB = '/etc/vfstab'.freeze
+ VFSTAB = "/etc/vfstab".freeze
def_delegator :@new_resource, :device, :device
def_delegator :@new_resource, :device_type, :device_type
@@ -58,7 +58,7 @@ class Chef
a.whyrun("Assuming device #{device} would have been created")
end
- unless fsck_device == '-'
+ unless fsck_device == "-"
requirements.assert(:mount, :remount) do |a|
a.assertion { ::File.exist?(fsck_device) }
a.failure_message(Chef::Exceptions::Mount, "Device #{fsck_device} does not exist")
@@ -75,7 +75,7 @@ class Chef
def mount_fs
actual_options = options || []
- actual_options.delete('noauto')
+ actual_options.delete("noauto")
command = "mount -F #{fstype}"
command << " -o #{actual_options.join(',')}" unless actual_options.empty?
command << " #{device} #{mount_point}"
@@ -89,8 +89,8 @@ class Chef
def remount_fs
# FIXME: Should remount always do the remount or only if the options change?
actual_options = options || []
- actual_options.delete('noauto')
- mount_options = actual_options.empty? ? '' : ",#{actual_options.join(',')}"
+ actual_options.delete("noauto")
+ mount_options = actual_options.empty? ? "" : ",#{actual_options.join(',')}"
shell_out!("mount -o remount#{mount_options} #{mount_point}")
end
@@ -117,7 +117,7 @@ class Chef
end
def etc_tempfile
- yield Tempfile.open('vfstab', '/etc')
+ yield Tempfile.open("vfstab", "/etc")
end
def mount_options_unchanged?
@@ -129,7 +129,7 @@ class Chef
current_options == new_options &&
current_resource.dump == dump &&
current_resource.pass == pass &&
- current_resource.options.include?('noauto') == !mount_at_boot?
+ current_resource.options.include?("noauto") == !mount_at_boot?
end
def update_current_resource_state
@@ -150,7 +150,7 @@ class Chef
# /dev/dsk/c1t0d0s0 on / type ufs read/write/setuid/devices/intr/largefiles/logging/xattr/onerror=panic/dev=700040 on Tue May 1 11:33:55 2012
def mounted?
mounted = false
- shell_out!('mount -v').stdout.each_line do |line|
+ shell_out!("mount -v").stdout.each_line do |line|
case line
when /^#{device_regex}\s+on\s+#{Regexp.escape(mount_point)}\s+/
Chef::Log.debug("Special device #{device} is mounted as #{mount_point}")
@@ -182,14 +182,14 @@ class Chef
options = Regexp.last_match[4]
# Store the 'mount at boot' column from vfstab as the 'noauto' option
# in current_resource.options (linux style)
- if Regexp.last_match[3] == 'no'
+ if Regexp.last_match[3] == "no"
if options.nil? || options.empty?
- options = 'noauto'
+ options = "noauto"
else
- options += ',noauto'
+ options += ",noauto"
end
end
- pass = (Regexp.last_match[2] == '-') ? 0 : Regexp.last_match[2].to_i
+ pass = (Regexp.last_match[2] == "-") ? 0 : Regexp.last_match[2].to_i
Chef::Log.debug("Found mount #{device} to #{mount_point} in #{VFSTAB}")
next
when /^[-\/\w]+\s+[-\/\w]+\s+#{Regexp.escape(mount_point)}\s+/
@@ -206,12 +206,12 @@ class Chef
end
def mount_at_boot?
- options.nil? || !options.include?('noauto')
+ options.nil? || !options.include?("noauto")
end
def vfstab_write(contents)
etc_tempfile do |f|
- f.write(contents.join(''))
+ f.write(contents.join(""))
f.close
# move, preserving modes of destination file
mover = Chef::FileContentManagement::Deploy.strategy(true)
@@ -222,12 +222,12 @@ class Chef
def vfstab_entry
actual_options = unless options.nil?
tempops = options.dup
- tempops.delete('noauto')
+ tempops.delete("noauto")
tempops
end
- autostr = mount_at_boot? ? 'yes' : 'no'
- passstr = pass == 0 ? '-' : pass
- optstr = (actual_options.nil? || actual_options.empty?) ? '-' : actual_options.join(',')
+ autostr = mount_at_boot? ? "yes" : "no"
+ passstr = pass == 0 ? "-" : pass
+ optstr = (actual_options.nil? || actual_options.empty?) ? "-" : actual_options.join(",")
"\n#{device}\t#{fsck_device}\t#{mount_point}\t#{fstype}\t#{passstr}\t#{autostr}\t#{optstr}\n"
end
@@ -254,7 +254,7 @@ class Chef
def options_remove_noauto(temp_options)
new_options = []
new_options += temp_options.nil? ? [] : temp_options
- new_options.delete('noauto')
+ new_options.delete("noauto")
new_options
end
diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb
index 87873474b3..0cf50d07bf 100644
--- a/lib/chef/provider/mount/windows.rb
+++ b/lib/chef/provider/mount/windows.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/mount'
+require "chef/provider/mount"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_use'
- require 'chef/util/windows/volume'
+ require "chef/util/windows/net_use"
+ require "chef/util/windows/volume"
end
class Chef
diff --git a/lib/chef/provider/ohai.rb b/lib/chef/provider/ohai.rb
index b7f4aa704b..6535805013 100644
--- a/lib/chef/provider/ohai.rb
+++ b/lib/chef/provider/ohai.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'ohai'
+require "ohai"
class Chef
class Provider
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb
index 4b3e512480..071b4b0462 100644
--- a/lib/chef/provider/osx_profile.rb
+++ b/lib/chef/provider/osx_profile.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
-require 'chef/resource'
-require 'chef/resource/file'
-require 'uuidtools'
+require "chef/log"
+require "chef/provider"
+require "chef/resource"
+require "chef/resource/file"
+require "uuidtools"
class Chef
class Provider
@@ -44,18 +44,18 @@ class Chef
)
@new_profile_hash = get_profile_hash(@new_resource.profile)
- @new_profile_hash['PayloadUUID'] =
+ @new_profile_hash["PayloadUUID"] =
config_uuid(@new_profile_hash) if @new_profile_hash
if @new_profile_hash
- @new_profile_identifier = @new_profile_hash['PayloadIdentifier']
+ @new_profile_identifier = @new_profile_hash["PayloadIdentifier"]
else
@new_profile_identifier = @new_resource.identifier ||
@new_resource.profile_name
end
- current_profile = all_profiles['_computerlevel'].find {
- |item| item['ProfileIdentifier'] ==
+ current_profile = all_profiles["_computerlevel"].find {
+ |item| item["ProfileIdentifier"] ==
@new_profile_identifier
}
@current_resource.profile(current_profile)
@@ -67,14 +67,14 @@ class Chef
if @new_profile_identifier
a.assertion {
!@new_profile_identifier.nil? and
- !@new_profile_identifier.end_with?('.mobileconfig') and
+ !@new_profile_identifier.end_with?(".mobileconfig") and
/^\w+(?:\.\w+)+$/.match(@new_profile_identifier)
}
a.failure_message RuntimeError, "when removing using the identifier attribute, it must match the profile identifier"
else
new_profile_name = @new_resource.profile_name
a.assertion {
- !new_profile_name.end_with?('.mobileconfig') and
+ !new_profile_name.end_with?(".mobileconfig") and
/^\w+(?:\.\w+)+$/.match(new_profile_name)
}
a.failure_message RuntimeError, "When removing by resource name, it must match the profile identifier "
@@ -84,13 +84,13 @@ class Chef
requirements.assert(:install) do |a|
if @new_profile_hash.is_a?(Hash)
a.assertion {
- @new_profile_hash.include?('PayloadIdentifier')
+ @new_profile_hash.include?("PayloadIdentifier")
}
a.failure_message RuntimeError, "The specified profile does not seem to be valid"
end
if @new_profile_hash.is_a?(String)
a.assertion {
- @new_profile_hash.end_with?('.mobileconfig')
+ @new_profile_hash.end_with?(".mobileconfig")
}
a.failure_message RuntimeError, "#{new_profile_hash}' is not a valid profile"
end
@@ -119,7 +119,7 @@ class Chef
def load_profile_hash(new_profile)
# file must exist in cookbook
- if new_profile.end_with?('.mobileconfig')
+ if new_profile.end_with?(".mobileconfig")
unless cookbook_file_available?(new_profile)
error_string = "#{self}: '#{new_profile}' not found in cookbook"
raise Chef::Exceptions::FileNotFound, error_string
@@ -243,8 +243,8 @@ class Chef
if @new_resource.action.include?(:remove)
true
else
- @current_resource.profile['ProfileUUID'] ==
- @new_profile_hash['PayloadUUID']
+ @current_resource.profile["ProfileUUID"] ==
+ @new_profile_hash["PayloadUUID"]
end
end
end
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 2238dc8654..ba256f6bea 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
-require 'chef/mixin/command'
-require 'chef/mixin/subclass_directive'
-require 'chef/log'
-require 'chef/file_cache'
-require 'chef/platform'
+require "chef/mixin/shell_out"
+require "chef/mixin/command"
+require "chef/mixin/subclass_directive"
+require "chef/log"
+require "chef/file_cache"
+require "chef/platform"
class Chef
class Provider
@@ -125,13 +125,13 @@ class Chef
multipackage_api_adapter(package_names_for_targets, versions_for_targets) do |name, version|
upgrade_package(name, version)
end
- log_allow_downgrade = allow_downgrade ? '(allow_downgrade)' : ''
+ log_allow_downgrade = allow_downgrade ? "(allow_downgrade)" : ""
Chef::Log.info("#{@new_resource} upgraded#{log_allow_downgrade} #{package_names_for_targets} to #{versions_for_targets}")
end
end
def upgrade_description
- log_allow_downgrade = allow_downgrade ? '(allow_downgrade)' : ''
+ log_allow_downgrade = allow_downgrade ? "(allow_downgrade)" : ""
description = []
target_version_array.each_with_index do |target_version, i|
next if target_version.nil?
diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb
index 80860adba0..29e2d1eb94 100644
--- a/lib/chef/provider/package/aix.rb
+++ b/lib/chef/provider/package/aix.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index e109c9966a..03cbff4d1c 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -48,7 +48,7 @@ class Chef
requirements.assert(:all_actions) do |a|
a.assertion { !@new_resource.source }
- a.failure_message(Chef::Exceptions::Package, 'apt package provider cannot handle source attribute. Use dpkg provider instead')
+ a.failure_message(Chef::Exceptions::Package, "apt package provider cannot handle source attribute. Use dpkg provider instead")
end
end
@@ -67,7 +67,7 @@ class Chef
case line
when /^\s{2}Installed: (.+)$/
installed_version = $1
- if installed_version == '(none)'
+ if installed_version == "(none)"
Chef::Log.debug("#{@new_resource} current version is nil")
installed_version = nil
else
@@ -76,7 +76,7 @@ class Chef
end
when /^\s{2}Candidate: (.+)$/
candidate_version = $1
- if candidate_version == '(none)'
+ if candidate_version == "(none)"
# This may not be an appropriate assumption, but it shouldn't break anything that already worked -- btm
is_virtual_package = true
showpkg = shell_out_with_timeout!("apt-cache showpkg #{pkg}").stdout
@@ -141,7 +141,7 @@ class Chef
version_array = [ version ].flatten
package_name = name_array.zip(version_array).map do |n, v|
is_virtual_package[n] ? n : "#{n}=#{v}"
- end.join(' ')
+ end.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(default_release_options)}#{expand_options(@new_resource.options)} install #{package_name}")
end
@@ -150,12 +150,12 @@ class Chef
end
def remove_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(@new_resource.options)} remove #{package_name}")
end
def purge_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
run_noninteractive("apt-get -q -y#{expand_options(@new_resource.options)} purge #{package_name}")
end
@@ -165,7 +165,7 @@ class Chef
end
def reconfig_package(name, version)
- package_name = [ name ].flatten.join(' ')
+ package_name = [ name ].flatten.join(" ")
Chef::Log.info("#{@new_resource} reconfiguring")
run_noninteractive("dpkg-reconfigure #{package_name}")
end
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index 45e2a2fc84..55ac304a79 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -15,9 +15,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/chocolatey_package'
-require 'chef/mixin/powershell_out'
+require "chef/provider/package"
+require "chef/resource/chocolatey_package"
+require "chef/mixin/powershell_out"
class Chef
class Provider
@@ -141,8 +141,8 @@ class Chef
powershell_out!(
"[System.Environment]::GetEnvironmentVariable('ChocolateyInstall', 'MACHINE')"
).stdout.chomp,
- 'bin',
- 'choco.exe',
+ "bin",
+ "choco.exe",
)
end
@@ -235,7 +235,7 @@ class Chef
def parse_list_output(*args)
hash = {}
choco_command(*args).stdout.each_line do |line|
- name, version = line.split('|')
+ name, version = line.split("|")
hash[name.downcase] = version.chomp
end
hash
diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb
index 0da675e883..bcf7cff4e4 100644
--- a/lib/chef/provider/package/dpkg.rb
+++ b/lib/chef/provider/package/dpkg.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/resource/package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/easy_install.rb b/lib/chef/provider/package/easy_install.rb
index 0b8e3952f7..91bb54999b 100644
--- a/lib/chef/provider/package/easy_install.rb
+++ b/lib/chef/provider/package/easy_install.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -51,12 +51,12 @@ class Chef
def easy_install_binary_path
path = @new_resource.easy_install_binary
- path ? path : 'easy_install'
+ path ? path : "easy_install"
end
def python_binary_path
path = @new_resource.python_binary
- path ? path : 'python'
+ path ? path : "python"
end
def module_name
@@ -77,7 +77,7 @@ class Chef
rescue
output = shell_out_with_timeout!("#{python_binary_path} -c \"import sys; print sys.path\"", :returns=>[0,1]).stdout
- output_array = output.gsub(/[\[\]]/,'').split(/\s*,\s*/)
+ output_array = output.gsub(/[\[\]]/,"").split(/\s*,\s*/)
package_path = ""
output_array.each do |entry|
diff --git a/lib/chef/provider/package/freebsd/base.rb b/lib/chef/provider/package/freebsd/base.rb
index 7c032b3787..4957812e99 100644
--- a/lib/chef/provider/package/freebsd/base.rb
+++ b/lib/chef/provider/package/freebsd/base.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/resource/package"
+require "chef/provider/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/freebsd/pkg.rb b/lib/chef/provider/package/freebsd/pkg.rb
index 33a8c2c108..2d13a0d2c1 100644
--- a/lib/chef/provider/package/freebsd/pkg.rb
+++ b/lib/chef/provider/package/freebsd/pkg.rb
@@ -19,8 +19,8 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
-require 'chef/util/path_helper'
+require "chef/provider/package/freebsd/base"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -34,14 +34,14 @@ class Chef
case @new_resource.source
when /^http/, /^ftp/
if @new_resource.source =~ /\/$/
- shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGESITE" => @new_resource.source, 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGESITE" => @new_resource.source, "LC_ALL" => nil }).status
else
- shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGEROOT" => @new_resource.source, 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg_add -r #{package_name}", :env => { "PACKAGEROOT" => @new_resource.source, "LC_ALL" => nil }).status
end
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
when /^\//
- shell_out_with_timeout!("pkg_add #{file_candidate_version_path}", :env => { "PKG_PATH" => @new_resource.source , 'LC_ALL'=>nil}).status
+ shell_out_with_timeout!("pkg_add #{file_candidate_version_path}", :env => { "PKG_PATH" => @new_resource.source , "LC_ALL"=>nil}).status
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
else
diff --git a/lib/chef/provider/package/freebsd/pkgng.rb b/lib/chef/provider/package/freebsd/pkgng.rb
index 2fdc9dda71..2d23620a66 100644
--- a/lib/chef/provider/package/freebsd/pkgng.rb
+++ b/lib/chef/provider/package/freebsd/pkgng.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
+require "chef/provider/package/freebsd/base"
class Chef
class Provider
@@ -28,17 +28,17 @@ class Chef
unless @current_resource.version
case @new_resource.source
when /^(http|ftp|\/)/
- shell_out_with_timeout!("pkg add#{expand_options(@new_resource.options)} #{@new_resource.source}", :env => { 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg add#{expand_options(@new_resource.options)} #{@new_resource.source}", :env => { "LC_ALL" => nil }).status
Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
else
- shell_out_with_timeout!("pkg install -y#{expand_options(@new_resource.options)} #{name}", :env => { 'LC_ALL' => nil }).status
+ shell_out_with_timeout!("pkg install -y#{expand_options(@new_resource.options)} #{name}", :env => { "LC_ALL" => nil }).status
end
end
end
def remove_package(name, version)
- options = @new_resource.options && @new_resource.options.sub(repo_regex, '')
+ options = @new_resource.options && @new_resource.options.sub(repo_regex, "")
options && !options.empty? || options = nil
shell_out_with_timeout!("pkg delete -y#{expand_options(options)} #{name}#{version ? '-' + version : ''}", :env => nil).status
end
diff --git a/lib/chef/provider/package/freebsd/port.rb b/lib/chef/provider/package/freebsd/port.rb
index 3fbd002214..89220e38b4 100644
--- a/lib/chef/provider/package/freebsd/port.rb
+++ b/lib/chef/provider/package/freebsd/port.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/package/freebsd/base'
+require "chef/provider/package/freebsd/base"
class Chef
class Provider
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index e5c45f0a62..661236a56c 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -18,8 +18,8 @@
# limitations under the License.
#
-require 'etc'
-require 'chef/mixin/homebrew_user'
+require "etc"
+require "chef/mixin/homebrew_user"
class Chef
class Provider
@@ -46,7 +46,7 @@ class Chef
def install_package(name, version)
unless current_resource.version == version
- brew('install', new_resource.options, name)
+ brew("install", new_resource.options, name)
end
end
@@ -56,19 +56,19 @@ class Chef
if current_version.nil? or current_version.empty?
install_package(name, version)
elsif current_version != version
- brew('upgrade', new_resource.options, name)
+ brew("upgrade", new_resource.options, name)
end
end
def remove_package(name, version)
if current_resource.version
- brew('uninstall', new_resource.options, name)
+ brew("uninstall", new_resource.options, name)
end
end
# Homebrew doesn't really have a notion of purging, do a "force remove"
def purge_package(name, version)
- new_resource.options((new_resource.options || '') << ' --force').strip
+ new_resource.options((new_resource.options || "") << " --force").strip
remove_package(name, version)
end
@@ -85,7 +85,7 @@ class Chef
#
# https://github.com/Homebrew/homebrew/wiki/Querying-Brew
def brew_info
- @brew_info ||= Chef::JSONCompat.from_json(brew('info', '--json=v1', new_resource.package_name)).first
+ @brew_info ||= Chef::JSONCompat.from_json(brew("info", "--json=v1", new_resource.package_name)).first
end
# Some packages (formula) are "keg only" and aren't linked,
@@ -95,14 +95,14 @@ class Chef
# that brew thinks is linked as the current version.
#
def current_installed_version
- if brew_info['keg_only']
- if brew_info['installed'].empty?
+ if brew_info["keg_only"]
+ if brew_info["installed"].empty?
nil
else
- brew_info['installed'].last['version']
+ brew_info["installed"].last["version"]
end
else
- brew_info['linked_keg']
+ brew_info["linked_keg"]
end
end
@@ -116,7 +116,7 @@ class Chef
#
# https://github.com/Homebrew/homebrew/wiki/Acceptable-Formulae#stable-versions
def candidate_version
- brew_info['versions']['stable']
+ brew_info["versions"]["stable"]
end
private
@@ -127,7 +127,7 @@ class Chef
Chef::Log.debug "Executing '#{command}' as user '#{homebrew_user.name}'"
# FIXME: this 1800 second default timeout should be deprecated
- output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { 'HOME' => homebrew_user.dir, 'RUBYOPT' => nil })
+ output = shell_out_with_timeout!(command, :timeout => 1800, :user => homebrew_uid, :environment => { "HOME" => homebrew_user.dir, "RUBYOPT" => nil })
output.stdout.chomp
end
diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb
index 96c2e711d4..84cb19486f 100644
--- a/lib/chef/provider/package/ips.rb
+++ b/lib/chef/provider/package/ips.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'open3'
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "open3"
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -70,7 +70,7 @@ class Chef
normal_command = "pkg#{expand_options(@new_resource.options)} install -q #{package_name}"
command =
if @new_resource.respond_to?(:accept_license) and @new_resource.accept_license
- normal_command.gsub('-q', '-q --accept')
+ normal_command.gsub("-q", "-q --accept")
else
normal_command
end
diff --git a/lib/chef/provider/package/openbsd.rb b/lib/chef/provider/package/openbsd.rb
index 00d9e5941d..539af1c409 100644
--- a/lib/chef/provider/package/openbsd.rb
+++ b/lib/chef/provider/package/openbsd.rb
@@ -20,10 +20,10 @@
# limitations under the License.
#
-require 'chef/resource/package'
-require 'chef/provider/package'
-require 'chef/mixin/get_source_from_package'
-require 'chef/exceptions'
+require "chef/resource/package"
+require "chef/provider/package"
+require "chef/mixin/get_source_from_package"
+require "chef/exceptions"
class Chef
class Provider
@@ -53,7 +53,7 @@ class Chef
# Below are incomplete/missing features for this package provider
requirements.assert(:all_actions) do |a|
a.assertion { !new_resource.source }
- a.failure_message(Chef::Exceptions::Package, 'The openbsd package provider does not support the source attribute')
+ a.failure_message(Chef::Exceptions::Package, "The openbsd package provider does not support the source attribute")
end
requirements.assert(:all_actions) do |a|
a.assertion do
@@ -63,7 +63,7 @@ class Chef
true
end
end
- a.failure_message(Chef::Exceptions::Package, 'The openbsd package provider does not support providing a version and flavor')
+ a.failure_message(Chef::Exceptions::Package, "The openbsd package provider does not support providing a version and flavor")
end
end
@@ -122,12 +122,12 @@ class Chef
end
def version_string(version)
- ver = ''
+ ver = ""
ver += "-#{version}" if version
end
def pkg_path
- ENV['PKG_PATH'] || "http://ftp.OpenBSD.org/pub/#{node.kernel.name}/#{node.kernel.release}/packages/#{node.kernel.machine}/"
+ ENV["PKG_PATH"] || "http://ftp.OpenBSD.org/pub/#{node.kernel.name}/#{node.kernel.release}/packages/#{node.kernel.machine}/"
end
end
diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb
index 275a0c7aa7..6bb2250da5 100644
--- a/lib/chef/provider/package/pacman.rb
+++ b/lib/chef/provider/package/pacman.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
class Chef
class Provider
@@ -59,7 +59,7 @@ class Chef
repos = pacman.scan(/\[(.+)\]/).flatten
end
- package_repos = repos.map {|r| Regexp.escape(r) }.join('|')
+ package_repos = repos.map {|r| Regexp.escape(r) }.join("|")
status = shell_out_with_timeout("pacman -Sl")
status.stdout.each_line do |line|
diff --git a/lib/chef/provider/package/paludis.rb b/lib/chef/provider/package/paludis.rb
index 90f02b80ad..c2b1069e1e 100644
--- a/lib/chef/provider/package/paludis.rb
+++ b/lib/chef/provider/package/paludis.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
+require "chef/provider/package"
+require "chef/resource/package"
class Chef
class Provider
@@ -33,15 +33,15 @@ class Chef
Chef::Log.debug("Checking package status for #{@new_resource.package_name}")
installed = false
- re = Regexp.new('(.*)[[:blank:]](.*)[[:blank:]](.*)$')
+ re = Regexp.new("(.*)[[:blank:]](.*)[[:blank:]](.*)$")
shell_out!("cave -L warning print-ids -M none -m \"#{@new_resource.package_name}\" -f \"%c/%p %v %r\n\"").stdout.each_line do |line|
res = re.match(line)
unless res.nil?
case res[3]
- when 'accounts', 'installed-accounts'
+ when "accounts", "installed-accounts"
next
- when 'installed'
+ when "installed"
installed = true
@current_resource.version(res[2])
else
diff --git a/lib/chef/provider/package/portage.rb b/lib/chef/provider/package/portage.rb
index a0d0b1a441..4a1559637a 100644
--- a/lib/chef/provider/package/portage.rb
+++ b/lib/chef/provider/package/portage.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/util/path_helper'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -48,7 +48,7 @@ class Chef
if versions.size > 1
atoms = versions.map {|v| v.first }.sort
- categories = atoms.map {|v| v.split('/')[0] }.uniq
+ categories = atoms.map {|v| v.split("/")[0] }.uniq
if !category && categories.size > 1
raise Chef::Exceptions::Package, "Multiple packages found for #{@new_resource.package_name}: #{atoms.join(" ")}. Specify a category."
end
@@ -66,7 +66,7 @@ class Chef
txt.each_line do |line|
if line =~ /\*\s+#{PACKAGE_NAME_PATTERN}/
- found_package_name = $&.gsub(/\*/, '').strip
+ found_package_name = $&.gsub(/\*/, "").strip
if package =~ /\// #the category is specified
if found_package_name == package
availables[found_package_name] = nil
diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb
index e3217fdf18..019d26d92e 100644
--- a/lib/chef/provider/package/rpm.rb
+++ b/lib/chef/provider/package/rpm.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 3272624f62..034f526060 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -17,25 +17,25 @@
# limitations under the License.
#
-require 'uri'
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "uri"
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
# Class methods on Gem are defined in rubygems
-require 'rubygems'
+require "rubygems"
# Ruby 1.9's gem_prelude can interact poorly with loading the full rubygems
# explicitly like this. Make sure rubygems/specification is always last in this
# list
-require 'rubygems/version'
-require 'rubygems/dependency'
-require 'rubygems/spec_fetcher'
-require 'rubygems/platform'
-require 'rubygems/package'
-require 'rubygems/dependency_installer'
-require 'rubygems/uninstaller'
-require 'rubygems/specification'
+require "rubygems/version"
+require "rubygems/dependency"
+require "rubygems/spec_fetcher"
+require "rubygems/platform"
+require "rubygems/package"
+require "rubygems/dependency_installer"
+require "rubygems/uninstaller"
+require "rubygems/specification"
class Chef
class Provider
@@ -86,7 +86,7 @@ class Chef
# === Returns
# [Gem::Specification] an array of Gem::Specification objects
def installed_versions(gem_dep)
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0')
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.0")
gem_specification.find_all_by_name(gem_dep.name, gem_dep.requirement)
else
gem_source_index.search(gem_dep)
@@ -288,7 +288,7 @@ class Chef
end
def gem_source_index
- @source_index ||= Gem::SourceIndex.from_gems_in(*gem_paths.map { |p| p + '/specifications' })
+ @source_index ||= Gem::SourceIndex.from_gems_in(*gem_paths.map { |p| p + "/specifications" })
end
def gem_specification
@@ -320,7 +320,7 @@ class Chef
else
gem_environment = shell_out!("#{@gem_binary_location} env").stdout
if jruby = gem_environment[JRUBY_PLATFORM]
- self.class.platform_cache[@gem_binary_location] = ['ruby', Gem::Platform.new(jruby)]
+ self.class.platform_cache[@gem_binary_location] = ["ruby", Gem::Platform.new(jruby)]
else
self.class.platform_cache[@gem_binary_location] = Gem.platforms
end
@@ -394,11 +394,11 @@ class Chef
end
def is_omnibus?
- if RbConfig::CONFIG['bindir'] =~ %r!/(opscode|chef|chefdk)/embedded/bin!
+ if RbConfig::CONFIG["bindir"] =~ %r!/(opscode|chef|chefdk)/embedded/bin!
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
# Omnibus installs to a static path because of linking on unix, find it.
true
- elsif RbConfig::CONFIG['bindir'].sub(/^[\w]:/, '') == "/opscode/chef/embedded/bin"
+ elsif RbConfig::CONFIG["bindir"].sub(/^[\w]:/, "") == "/opscode/chef/embedded/bin"
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
# windows, with the drive letter removed
true
@@ -410,7 +410,7 @@ class Chef
def find_gem_by_path
Chef::Log.debug("#{@new_resource} searching for 'gem' binary in path: #{ENV['PATH']}")
separator = ::File::ALT_SEPARATOR ? ::File::ALT_SEPARATOR : ::File::SEPARATOR
- path_to_first_gem = ENV['PATH'].split(::File::PATH_SEPARATOR).select { |path| ::File.exists?(path + separator + "gem") }.first
+ path_to_first_gem = ENV["PATH"].split(::File::PATH_SEPARATOR).select { |path| ::File.exists?(path + separator + "gem") }.first
raise Chef::Exceptions::FileNotFound, "Unable to find 'gem' binary in path: #{ENV['PATH']}" if path_to_first_gem.nil?
path_to_first_gem + separator + "gem"
end
@@ -456,7 +456,7 @@ class Chef
def all_installed_versions
@all_installed_versions ||= begin
- @gem_env.installed_versions(Gem::Dependency.new(gem_dependency.name, '>= 0'))
+ @gem_env.installed_versions(Gem::Dependency.new(gem_dependency.name, ">= 0"))
end
end
@@ -525,15 +525,15 @@ class Chef
end
def gem_binary_path
- @new_resource.gem_binary || 'gem'
+ @new_resource.gem_binary || "gem"
end
def install_via_gem_command(name, version)
if @new_resource.source =~ /\.gem$/i
name = @new_resource.source
elsif @new_resource.clear_sources
- src = ' --clear-sources'
- src << (@new_resource.source && " --source=#{@new_resource.source}" || '')
+ src = " --clear-sources"
+ src << (@new_resource.source && " --source=#{@new_resource.source}" || "")
else
src = @new_resource.source && " --source=#{@new_resource.source} --source=https://rubygems.org"
end
diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb
index d3d2fa54a1..98264ecd1e 100644
--- a/lib/chef/provider/package/smartos.rb
+++ b/lib/chef/provider/package/smartos.rb
@@ -19,9 +19,9 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb
index 55a34b44dd..8442e57dbb 100644
--- a/lib/chef/provider/package/solaris.rb
+++ b/lib/chef/provider/package/solaris.rb
@@ -15,10 +15,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'chef/mixin/get_source_from_package'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
@@ -28,7 +28,7 @@ class Chef
include Chef::Mixin::GetSourceFromPackage
provides :package, platform: "nexentacore"
- provides :package, platform: "solaris2", platform_version: '< 5.11'
+ provides :package, platform: "solaris2", platform_version: "< 5.11"
provides :solaris_package, os: "solaris2"
# def initialize(*args)
diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb
index f9ff50dcc6..87fadc27cf 100644
--- a/lib/chef/provider/package/windows.rb
+++ b/lib/chef/provider/package/windows.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'chef/mixin/uris'
-require 'chef/resource/windows_package'
-require 'chef/provider/package'
-require 'chef/util/path_helper'
-require 'chef/mixin/checksum'
+require "chef/mixin/uris"
+require "chef/resource/windows_package"
+require "chef/provider/package"
+require "chef/util/path_helper"
+require "chef/mixin/checksum"
class Chef
class Provider
@@ -32,7 +32,7 @@ class Chef
provides :package, os: "windows"
provides :windows_package, os: "windows"
- require 'chef/provider/package/windows/registry_uninstall_entry.rb'
+ require "chef/provider/package/windows/registry_uninstall_entry.rb"
def define_resource_requirements
requirements.assert(:install) do |a|
@@ -60,11 +60,11 @@ class Chef
case installer_type
when :msi
Chef::Log.debug("#{new_resource} is MSI")
- require 'chef/provider/package/windows/msi'
+ require "chef/provider/package/windows/msi"
Chef::Provider::Package::Windows::MSI.new(resource_for_provider, uninstall_registry_entries)
else
Chef::Log.debug("#{new_resource} is EXE with type '#{installer_type}'")
- require 'chef/provider/package/windows/exe'
+ require "chef/provider/package/windows/exe"
Chef::Provider::Package::Windows::Exe.new(resource_for_provider, installer_type, uninstall_registry_entries)
end
end
@@ -88,7 +88,7 @@ class Chef
:msi
else
# search the binary file for installer type
- ::Kernel.open(::File.expand_path(source_location), 'rb') do |io|
+ ::Kernel.open(::File.expand_path(source_location), "rb") do |io|
filesize = io.size
bufsize = 4096 # read 4K buffers
overlap = 16 # bytes to overlap between buffer reads
@@ -112,7 +112,7 @@ class Chef
end
# if file is named 'setup.exe' assume installshield
- if basename == 'setup.exe'
+ if basename == "setup.exe"
:installshield
else
raise Chef::Exceptions::CannotDetermineWindowsInstallerType, "Installer type for Windows Package '#{new_resource.name}' not specified and cannot be determined from file extension '#{file_extension}'"
@@ -151,7 +151,7 @@ class Chef
# @return [String] candidate_version
def candidate_version
- @candidate_version ||= (new_resource.version || 'latest')
+ @candidate_version ||= (new_resource.version || "latest")
end
# @return [Array] current_version(s) as an array
diff --git a/lib/chef/provider/package/windows/exe.rb b/lib/chef/provider/package/windows/exe.rb
index f21106f2ff..e510755281 100644
--- a/lib/chef/provider/package/windows/exe.rb
+++ b/lib/chef/provider/package/windows/exe.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'chef/mixin/shell_out'
+require "chef/mixin/shell_out"
class Chef
class Provider
@@ -101,13 +101,13 @@ class Chef
def unattended_flags
case installer_type
when :installshield
- '/s /sms'
+ "/s /sms"
when :nsis
- '/S /NCRC'
+ "/S /NCRC"
when :inno
- '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART'
+ "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
when :wise
- '/s'
+ "/s"
end
end
end
diff --git a/lib/chef/provider/package/windows/msi.rb b/lib/chef/provider/package/windows/msi.rb
index 15b00f46f0..106dc496b6 100644
--- a/lib/chef/provider/package/windows/msi.rb
+++ b/lib/chef/provider/package/windows/msi.rb
@@ -18,8 +18,8 @@
# TODO: Allow @new_resource.source to be a Product Code as a GUID for uninstall / network install
-require 'chef/win32/api/installer' if (RUBY_PLATFORM =~ /mswin|mingw32|windows/) && Chef::Platform.supports_msi?
-require 'chef/mixin/shell_out'
+require "chef/win32/api/installer" if (RUBY_PLATFORM =~ /mswin|mingw32|windows/) && Chef::Platform.supports_msi?
+require "chef/mixin/shell_out"
class Chef
class Provider
diff --git a/lib/chef/provider/package/windows/registry_uninstall_entry.rb b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
index 2c3f6ba093..145f799e05 100644
--- a/lib/chef/provider/package/windows/registry_uninstall_entry.rb
+++ b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'win32/registry' if (RUBY_PLATFORM =~ /mswin|mingw32|windows/)
+require "win32/registry" if (RUBY_PLATFORM =~ /mswin|mingw32|windows/)
class Chef
class Provider
@@ -39,7 +39,7 @@ class Chef
reg.each_key do |key, _wtime|
begin
entry = reg.open(key, desired)
- display_name = read_registry_property(entry, 'DisplayName')
+ display_name = read_registry_property(entry, "DisplayName")
if display_name == package_name
entries.push(RegistryUninstallEntry.new(hkey, key, entry))
end
@@ -67,9 +67,9 @@ class Chef
@hive = hive
@key = key
@data = registry_data
- @display_name = RegistryUninstallEntry.read_registry_property(registry_data, 'DisplayName')
- @display_version = RegistryUninstallEntry.read_registry_property(registry_data, 'DisplayVersion')
- @uninstall_string = RegistryUninstallEntry.read_registry_property(registry_data, 'UninstallString')
+ @display_name = RegistryUninstallEntry.read_registry_property(registry_data, "DisplayName")
+ @display_version = RegistryUninstallEntry.read_registry_property(registry_data, "DisplayVersion")
+ @uninstall_string = RegistryUninstallEntry.read_registry_property(registry_data, "UninstallString")
end
attr_reader :hive
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index 6258472a65..7b291d5f00 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/provider/package'
-require 'chef/mixin/which'
-require 'chef/resource/package'
-require 'singleton'
-require 'chef/mixin/get_source_from_package'
+require "chef/config"
+require "chef/provider/package"
+require "chef/mixin/which"
+require "chef/resource/package"
+require "singleton"
+require "chef/mixin/get_source_from_package"
class Chef
class Provider
@@ -712,7 +712,7 @@ class Chef
one_line = false
error = nil
- helper = ::File.join(::File.dirname(__FILE__), 'yum-dump.py')
+ helper = ::File.join(::File.dirname(__FILE__), "yum-dump.py")
status = nil
begin
@@ -797,12 +797,12 @@ class Chef
end
def extract_interpreter(file)
- ::File.open(file, 'r', &:readline)[2..-1].strip
+ ::File.open(file, "r", &:readline)[2..-1].strip
end
# dnf based systems have a yum shim that has /bin/bash as the interpreter. Don't use this.
def shabang_or_fallback(interpreter)
- if interpreter == '/bin/bash'
+ if interpreter == "/bin/bash"
Chef::Log.warn("Yum executable interpreter is /bin/bash. Falling back to default python.")
"/usr/bin/python"
else
@@ -811,7 +811,7 @@ class Chef
end
def shabang?(file)
- ::File.open(file, 'r') do |f|
+ ::File.open(file, "r") do |f|
f.read(2) == '#!'
end
rescue Errno::ENOENT
@@ -1245,7 +1245,7 @@ class Chef
as_array(name).zip(as_array(version)).each do |n, v|
idx = package_name_array.index(n)
a = arch_for_name(n)
- s = ''
+ s = ""
unless v == current_version_array[idx]
s = "#{n}-#{v}#{yum_arch(a)}"
repo = @yum.package_repository(n, v, a)
@@ -1253,7 +1253,7 @@ class Chef
pkg_string_bits << s
end
end
- pkg_string = pkg_string_bits.join(' ')
+ pkg_string = pkg_string_bits.join(" ")
Chef::Log.info("#{@new_resource} #{log_method} #{repos.join(' ')}")
yum_command("-d0 -e0 -y#{expand_options(@new_resource.options)} #{method} #{pkg_string}")
else
@@ -1305,12 +1305,12 @@ class Chef
remove_str = as_array(name).zip(as_array(version)).map do |n, v|
a = arch_for_name(n)
"#{[n, v].join('-')}#{yum_arch(a)}"
- end.join(' ')
+ end.join(" ")
else
remove_str = as_array(name).map do |n|
a = arch_for_name(n)
"#{n}#{yum_arch(a)}"
- end.join(' ')
+ end.join(" ")
end
yum_command("-d0 -e0 -y#{expand_options(@new_resource.options)} remove #{remove_str}")
diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb
index 72e8d56154..9b0aaf322a 100644
--- a/lib/chef/provider/package/zypper.rb
+++ b/lib/chef/provider/package/zypper.rb
@@ -19,10 +19,10 @@
# limitations under the License.
#
-require 'chef/provider/package'
-require 'chef/mixin/command'
-require 'chef/resource/package'
-require 'singleton'
+require "chef/provider/package"
+require "chef/mixin/command"
+require "chef/resource/package"
+require "singleton"
class Chef
class Provider
@@ -38,8 +38,8 @@ class Chef
is_installed=false
is_out_of_date=false
- version=''
- oud_version=''
+ version=""
+ oud_version=""
Chef::Log.debug("#{new_resource} checking zypper")
status = shell_out_with_timeout("zypper --non-interactive info #{new_resource.package_name}")
status.stdout.each_line do |line|
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index a5b0a5dc24..d3b586e75d 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/platform/query_helpers'
-require 'chef/provider/windows_script'
+require "chef/platform/query_helpers"
+require "chef/provider/windows_script"
class Chef
class Provider
@@ -26,7 +26,7 @@ class Chef
provides :powershell_script, os: "windows"
def initialize (new_resource, run_context)
- super(new_resource, run_context, '.ps1')
+ super(new_resource, run_context, ".ps1")
add_exit_status_wrapper
end
@@ -58,10 +58,10 @@ class Chef
end
def flags
- interpreter_flags = [*default_interpreter_flags].join(' ')
+ interpreter_flags = [*default_interpreter_flags].join(" ")
if ! (@new_resource.flags.nil?)
- interpreter_flags = [@new_resource.flags, interpreter_flags].join(' ')
+ interpreter_flags = [@new_resource.flags, interpreter_flags].join(" ")
end
interpreter_flags
@@ -78,8 +78,8 @@ class Chef
end
def validate_script_syntax!
- interpreter_arguments = default_interpreter_flags.join(' ')
- Tempfile.open(['chef_powershell_script-user-code', '.ps1']) do | user_script_file |
+ interpreter_arguments = default_interpreter_flags.join(" ")
+ Tempfile.open(["chef_powershell_script-user-code", ".ps1"]) do | user_script_file |
# Wrap the user's code in a PowerShell script block so that
# it isn't executed. However, syntactically invalid script
# in that block will still trigger a syntax error which is
@@ -122,7 +122,7 @@ EOH
# user input confirmation for files such as PowerShell modules
# downloaded from the Internet. However, 'Bypass' is not supported
# prior to PowerShell 3.0, so the fallback is 'Unrestricted'
- execution_policy = Chef::Platform.supports_powershell_execution_bypass?(run_context.node) ? 'Bypass' : 'Unrestricted'
+ execution_policy = Chef::Platform.supports_powershell_execution_bypass?(run_context.node) ? "Bypass" : "Unrestricted"
[
"-NoLogo",
diff --git a/lib/chef/provider/reboot.rb b/lib/chef/provider/reboot.rb
index ab3177ba65..3f64955d21 100644
--- a/lib/chef/provider/reboot.rb
+++ b/lib/chef/provider/reboot.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/provider'
+require "chef/log"
+require "chef/provider"
class Chef
class Provider
diff --git a/lib/chef/provider/registry_key.rb b/lib/chef/provider/registry_key.rb
index 948fa6c63f..c6a06e0974 100644
--- a/lib/chef/provider/registry_key.rb
+++ b/lib/chef/provider/registry_key.rb
@@ -17,15 +17,15 @@
# limitations under the License.
#
-require 'chef/config'
-require 'chef/log'
-require 'chef/resource/file'
-require 'chef/mixin/checksum'
-require 'chef/provider'
-require 'etc'
-require 'fileutils'
-require 'chef/scan_access_control'
-require 'chef/win32/registry'
+require "chef/config"
+require "chef/log"
+require "chef/resource/file"
+require "chef/mixin/checksum"
+require "chef/provider"
+require "etc"
+require "fileutils"
+require "chef/scan_access_control"
+require "chef/win32/registry"
class Chef
diff --git a/lib/chef/provider/remote_directory.rb b/lib/chef/provider/remote_directory.rb
index 3c1c50b963..02270201cb 100644
--- a/lib/chef/provider/remote_directory.rb
+++ b/lib/chef/provider/remote_directory.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'chef/provider/directory'
-require 'chef/resource/file'
-require 'chef/resource/directory'
-require 'chef/resource/cookbook_file'
-require 'chef/mixin/file_class'
-require 'chef/platform/query_helpers'
-require 'chef/util/path_helper'
-require 'chef/deprecation/warnings'
-require 'chef/deprecation/provider/remote_directory'
-
-require 'forwardable'
+require "chef/provider/directory"
+require "chef/resource/file"
+require "chef/resource/directory"
+require "chef/resource/cookbook_file"
+require "chef/mixin/file_class"
+require "chef/platform/query_helpers"
+require "chef/util/path_helper"
+require "chef/deprecation/warnings"
+require "chef/deprecation/provider/remote_directory"
+
+require "forwardable"
class Chef
class Provider
@@ -104,9 +104,9 @@ class Chef
#
def purge_unmanaged_files
if purge
- Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), '**', '*'), ::File::FNM_DOTMATCH).sort!.reverse!.each do |file|
+ Dir.glob(::File.join(Chef::Util::PathHelper.escape_glob(path), "**", "*"), ::File::FNM_DOTMATCH).sort!.reverse!.each do |file|
# skip '.' and '..'
- next if ['.','..'].include?(Pathname.new(file).basename().to_s)
+ next if [".",".."].include?(Pathname.new(file).basename().to_s)
# Clean the path. This is required because of the ::File.join
file = Chef::Util::PathHelper.cleanpath(file)
diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb
index c4643edc0b..6548300c5d 100644
--- a/lib/chef/provider/remote_file.rb
+++ b/lib/chef/provider/remote_file.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/provider/file'
-require 'chef/deprecation/provider/remote_file'
-require 'chef/deprecation/warnings'
+require "chef/provider/file"
+require "chef/deprecation/provider/remote_file"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/cache_control_data.rb b/lib/chef/provider/remote_file/cache_control_data.rb
index 3f39dac625..85b723ece4 100644
--- a/lib/chef/provider/remote_file/cache_control_data.rb
+++ b/lib/chef/provider/remote_file/cache_control_data.rb
@@ -19,11 +19,11 @@
# limitations under the License.
#
-require 'stringio'
-require 'chef/file_cache'
-require 'chef/json_compat'
-require 'chef/digester'
-require 'chef/exceptions'
+require "stringio"
+require "chef/file_cache"
+require "chef/json_compat"
+require "chef/digester"
+require "chef/exceptions"
class Chef
class Provider
@@ -172,7 +172,7 @@ class Chef
# Scrub and truncate in accordance with the goals of keeping the name
# human-readable but within the bounds of local file system
# path length limits
- uri.gsub(/\W/, '_')[0..63]
+ uri.gsub(/\W/, "_")[0..63]
end
def sanitized_cache_file_basename
diff --git a/lib/chef/provider/remote_file/content.rb b/lib/chef/provider/remote_file/content.rb
index e9d85b4087..02c0cff457 100644
--- a/lib/chef/provider/remote_file/content.rb
+++ b/lib/chef/provider/remote_file/content.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/file_content_management/content_base'
-require 'chef/mixin/uris'
+require "uri"
+require "tempfile"
+require "chef/file_content_management/content_base"
+require "chef/mixin/uris"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index 3f78286aa3..a81126f27f 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'net/ftp'
-require 'chef/provider/remote_file'
-require 'chef/file_content_management/tempfile'
+require "uri"
+require "tempfile"
+require "net/ftp"
+require "chef/provider/remote_file"
+require "chef/file_content_management/tempfile"
class Chef
class Provider
@@ -59,7 +59,7 @@ class Chef
if uri.userinfo
URI.unescape(uri.user)
else
- 'anonymous'
+ "anonymous"
end
end
@@ -94,11 +94,11 @@ class Chef
private
def with_proxy_env
- saved_socks_env = ENV['SOCKS_SERVER']
- ENV['SOCKS_SERVER'] = proxy_uri(@uri).to_s
+ saved_socks_env = ENV["SOCKS_SERVER"]
+ ENV["SOCKS_SERVER"] = proxy_uri(@uri).to_s
yield
ensure
- ENV['SOCKS_SERVER'] = saved_socks_env
+ ENV["SOCKS_SERVER"] = saved_socks_env
end
def with_connection
@@ -162,7 +162,7 @@ class Chef
end
def parse_path
- path = uri.path.sub(%r{\A/}, '%2F') # re-encode the beginning slash because uri library decodes it.
+ path = uri.path.sub(%r{\A/}, "%2F") # re-encode the beginning slash because uri library decodes it.
directories = path.split(%r{/}, -1)
directories.each {|d|
d.gsub!(/%([0-9A-Fa-f][0-9A-Fa-f])/) { [$1].pack("H2") }
diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb
index e1f1cb2da7..218d7ef223 100644
--- a/lib/chef/provider/remote_file/http.rb
+++ b/lib/chef/provider/remote_file/http.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/http/simple'
-require 'chef/digester'
-require 'chef/provider/remote_file'
-require 'chef/provider/remote_file/cache_control_data'
+require "chef/http/simple"
+require "chef/digester"
+require "chef/provider/remote_file"
+require "chef/provider/remote_file/cache_control_data"
class Chef
class Provider
@@ -87,11 +87,11 @@ class Chef
end
def last_modified_time_from(response)
- response['last_modified'] || response['date']
+ response["last_modified"] || response["date"]
end
def etag_from(response)
- response['etag']
+ response["etag"]
end
def http_client_opts
diff --git a/lib/chef/provider/remote_file/local_file.rb b/lib/chef/provider/remote_file/local_file.rb
index 026206b64e..2e99886a00 100644
--- a/lib/chef/provider/remote_file/local_file.rb
+++ b/lib/chef/provider/remote_file/local_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/provider/remote_file'
+require "uri"
+require "tempfile"
+require "chef/provider/remote_file"
class Chef
class Provider
diff --git a/lib/chef/provider/remote_file/network_file.rb b/lib/chef/provider/remote_file/network_file.rb
index 093a388d2a..7c066cb052 100644
--- a/lib/chef/provider/remote_file/network_file.rb
+++ b/lib/chef/provider/remote_file/network_file.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'uri'
-require 'tempfile'
-require 'chef/provider/remote_file'
+require "uri"
+require "tempfile"
+require "chef/provider/remote_file"
class Chef
class Provider
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 72a5029a94..4abfd806b9 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/mixin/command'
-require 'chef/provider'
-require 'ipaddr'
+require "chef/log"
+require "chef/mixin/command"
+require "chef/provider"
+require "ipaddr"
class Chef::Provider::Route < Chef::Provider
include Chef::Mixin::Command
@@ -28,52 +28,52 @@ class Chef::Provider::Route < Chef::Provider
attr_accessor :is_running
- MASK = {'0.0.0.0' => '0',
- '128.0.0.0' => '1',
- '192.0.0.0' => '2',
- '224.0.0.0' => '3',
- '240.0.0.0' => '4',
- '248.0.0.0' => '5',
- '252.0.0.0' => '6',
- '254.0.0.0' => '7',
- '255.0.0.0' => '8',
- '255.128.0.0' => '9',
- '255.192.0.0' => '10',
- '255.224.0.0' => '11',
- '255.240.0.0' => '12',
- '255.248.0.0' => '13',
- '255.252.0.0' => '14',
- '255.254.0.0' => '15',
- '255.255.0.0' => '16',
- '255.255.128.0' => '17',
- '255.255.192.0' => '18',
- '255.255.224.0' => '19',
- '255.255.240.0' => '20',
- '255.255.248.0' => '21',
- '255.255.252.0' => '22',
- '255.255.254.0' => '23',
- '255.255.255.0' => '24',
- '255.255.255.128' => '25',
- '255.255.255.192' => '26',
- '255.255.255.224' => '27',
- '255.255.255.240' => '28',
- '255.255.255.248' => '29',
- '255.255.255.252' => '30',
- '255.255.255.254' => '31',
- '255.255.255.255' => '32' }
+ MASK = {"0.0.0.0" => "0",
+ "128.0.0.0" => "1",
+ "192.0.0.0" => "2",
+ "224.0.0.0" => "3",
+ "240.0.0.0" => "4",
+ "248.0.0.0" => "5",
+ "252.0.0.0" => "6",
+ "254.0.0.0" => "7",
+ "255.0.0.0" => "8",
+ "255.128.0.0" => "9",
+ "255.192.0.0" => "10",
+ "255.224.0.0" => "11",
+ "255.240.0.0" => "12",
+ "255.248.0.0" => "13",
+ "255.252.0.0" => "14",
+ "255.254.0.0" => "15",
+ "255.255.0.0" => "16",
+ "255.255.128.0" => "17",
+ "255.255.192.0" => "18",
+ "255.255.224.0" => "19",
+ "255.255.240.0" => "20",
+ "255.255.248.0" => "21",
+ "255.255.252.0" => "22",
+ "255.255.254.0" => "23",
+ "255.255.255.0" => "24",
+ "255.255.255.128" => "25",
+ "255.255.255.192" => "26",
+ "255.255.255.224" => "27",
+ "255.255.255.240" => "28",
+ "255.255.255.248" => "29",
+ "255.255.255.252" => "30",
+ "255.255.255.254" => "31",
+ "255.255.255.255" => "32" }
def hex2ip(hex_data)
# Cleanup hex data
- hex_ip = hex_data.to_s.downcase.gsub(/[^0-9a-f]/, '')
+ hex_ip = hex_data.to_s.downcase.gsub(/[^0-9a-f]/, "")
# Check hex data format (IP is a 32bit integer, so should be 8 chars long)
return nil if hex_ip.length != hex_data.length || hex_ip.length != 8
# Extract octets from hex data
- octets = hex_ip.scan(/../).reverse.collect { |octet| [octet].pack('H2').unpack("C").first }
+ octets = hex_ip.scan(/../).reverse.collect { |octet| [octet].pack("H2").unpack("C").first }
# Validate IP
- ip = octets.join('.')
+ ip = octets.join(".")
begin
IPAddr.new(ip, Socket::AF_INET).to_s
rescue ArgumentError
@@ -197,7 +197,7 @@ class Chef::Provider::Route < Chef::Provider
end
def generate_command(action)
- common_route_items = ''
+ common_route_items = ""
common_route_items << "/#{MASK[@new_resource.netmask.to_s]}" if @new_resource.netmask
common_route_items << " via #{@new_resource.gateway} " if @new_resource.gateway
@@ -215,7 +215,7 @@ class Chef::Provider::Route < Chef::Provider
end
def config_file_contents(action, options={})
- content = ''
+ content = ""
case action
when :add
content << "#{options[:target]}"
diff --git a/lib/chef/provider/script.rb b/lib/chef/provider/script.rb
index 2f2001dbf9..d95962a15b 100644
--- a/lib/chef/provider/script.rb
+++ b/lib/chef/provider/script.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'tempfile'
-require 'chef/provider/execute'
-require 'forwardable'
+require "tempfile"
+require "chef/provider/execute"
+require "forwardable"
class Chef
class Provider
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb
index 311bb1082e..1c0738112a 100644
--- a/lib/chef/provider/service.rb
+++ b/lib/chef/provider/service.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/command'
-require 'chef/provider'
+require "chef/mixin/command"
+require "chef/provider"
class Chef
class Provider
@@ -192,19 +192,19 @@ class Chef
# Linux
#
- require 'chef/chef_class'
- require 'chef/provider/service/systemd'
- require 'chef/provider/service/insserv'
- require 'chef/provider/service/redhat'
- require 'chef/provider/service/arch'
- require 'chef/provider/service/gentoo'
- require 'chef/provider/service/upstart'
- require 'chef/provider/service/debian'
- require 'chef/provider/service/invokercd'
-
- Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: 'arch'
- Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: 'gentoo'
- Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: 'debian'
+ require "chef/chef_class"
+ require "chef/provider/service/systemd"
+ require "chef/provider/service/insserv"
+ require "chef/provider/service/redhat"
+ require "chef/provider/service/arch"
+ require "chef/provider/service/gentoo"
+ require "chef/provider/service/upstart"
+ require "chef/provider/service/debian"
+ require "chef/provider/service/invokercd"
+
+ Chef.set_provider_priority_array :service, [ Systemd, Arch ], platform_family: "arch"
+ Chef.set_provider_priority_array :service, [ Systemd, Gentoo ], platform_family: "gentoo"
+ Chef.set_provider_priority_array :service, [ Systemd, Upstart, Insserv, Debian, Invokercd ], platform_family: "debian"
Chef.set_provider_priority_array :service, [ Systemd, Insserv, Redhat ], platform_family: %w(rhel fedora suse)
end
end
diff --git a/lib/chef/provider/service/aix.rb b/lib/chef/provider/service/aix.rb
index 0c95ce2c8e..1968f8f3de 100644
--- a/lib/chef/provider/service/aix.rb
+++ b/lib/chef/provider/service/aix.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service'
+require "chef/provider/service"
class Chef
class Provider
@@ -98,7 +98,7 @@ class Chef
@current_resource.running false
else
service = shell_out!("lssrc -s #{@new_resource.service_name}").stdout
- if service.split(' ').last == 'active'
+ if service.split(" ").last == "active"
@current_resource.running true
else
@current_resource.running false
diff --git a/lib/chef/provider/service/aixinit.rb b/lib/chef/provider/service/aixinit.rb
index 19beac79f0..66d85984fa 100644
--- a/lib/chef/provider/service/aixinit.rb
+++ b/lib/chef/provider/service/aixinit.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
@@ -60,14 +60,14 @@ class Chef
Dir.glob(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).each { |f| ::File.delete(f)}
if @new_resource.priority.is_a? Integer
- create_symlink(2, 'S', @new_resource.priority)
+ create_symlink(2, "S", @new_resource.priority)
elsif @new_resource.priority.is_a? Hash
@new_resource.priority.each do |level,o|
- create_symlink(level,(o[0] == :start ? 'S' : 'K'),o[1])
+ create_symlink(level,(o[0] == :start ? "S" : "K"),o[1])
end
else
- create_symlink(2, 'S', '')
+ create_symlink(2, "S", "")
end
end
@@ -75,13 +75,13 @@ class Chef
Dir.glob(["/etc/rc.d/rc2.d/[SK][0-9][0-9]#{@new_resource.service_name}", "/etc/rc.d/rc2.d/[SK]#{@new_resource.service_name}"]).each { |f| ::File.delete(f) }
if @new_resource.priority.is_a? Integer
- create_symlink(2, 'K',100 - @new_resource.priority)
+ create_symlink(2, "K",100 - @new_resource.priority)
elsif @new_resource.priority.is_a? Hash
@new_resource.priority.each do |level,o|
- create_symlink(level, 'K', 100 - o[1]) if o[0] == :stop
+ create_symlink(level, "K", 100 - o[1]) if o[0] == :stop
end
else
- create_symlink(2, 'K', '')
+ create_symlink(2, "K", "")
end
end
@@ -98,7 +98,7 @@ class Chef
files.each do |file|
if (RC_D_SCRIPT_NAME =~ file)
- priority[2] = [($1 == "S" ? :start : :stop), ($2.empty? ? '' : $2.to_i)]
+ priority[2] = [($1 == "S" ? :start : :stop), ($2.empty? ? "" : $2.to_i)]
if $1 == "S"
is_enabled = true
end
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index e7fbcc820c..3e7b9fcaca 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
@@ -50,7 +50,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
def daemons
entries = []
if ::File.read("/etc/rc.conf").match(/DAEMONS=\((.*)\)/m)
- entries += $1.gsub(/\\?[\r\n]/, ' ').gsub(/# *[^ ]+/,' ').split(' ') if $1.length > 0
+ entries += $1.gsub(/\\?[\r\n]/, " ").gsub(/# *[^ ]+/," ").split(" ") if $1.length > 0
end
yield(entries) if block_given?
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 7d23e4ac77..9d80f5f924 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -16,13 +16,13 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
class Service
class Debian < Chef::Provider::Service::Init
- provides :service, platform_family: 'debian' do |node|
+ provides :service, platform_family: "debian" do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian)
end
diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb
index 78ca0be235..4aa9eb09f6 100644
--- a/lib/chef/provider/service/freebsd.rb
+++ b/lib/chef/provider/service/freebsd.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/init'
-require 'chef/mixin/command'
+require "chef/resource/service"
+require "chef/provider/service/init"
+require "chef/mixin/command"
class Chef
class Provider
@@ -119,11 +119,11 @@ class Chef
private
def read_rc_conf
- ::File.open("/etc/rc.conf", 'r') { |file| file.readlines }
+ ::File.open("/etc/rc.conf", "r") { |file| file.readlines }
end
def write_rc_conf(lines)
- ::File.open("/etc/rc.conf", 'w') do |file|
+ ::File.open("/etc/rc.conf", "w") do |file|
lines.each { |line| file.puts(line) }
end
end
diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb
index 903c55af7a..28fd43a709 100644
--- a/lib/chef/provider/service/gentoo.rb
+++ b/lib/chef/provider/service/gentoo.rb
@@ -17,9 +17,9 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
-require 'chef/mixin/command'
-require 'chef/util/path_helper'
+require "chef/provider/service/init"
+require "chef/mixin/command"
+require "chef/util/path_helper"
class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb
index 8fe5b0281f..90c0ec2b34 100644
--- a/lib/chef/provider/service/init.rb
+++ b/lib/chef/provider/service/init.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service/simple'
-require 'chef/mixin/command'
-require 'chef/platform/service_helpers'
+require "chef/provider/service/simple"
+require "chef/mixin/command"
+require "chef/platform/service_helpers"
class Chef
class Provider
diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb
index dd01f9ab87..87527599b0 100644
--- a/lib/chef/provider/service/insserv.rb
+++ b/lib/chef/provider/service/insserv.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
-require 'chef/util/path_helper'
+require "chef/provider/service/init"
+require "chef/util/path_helper"
class Chef
class Provider
diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb
index 2b045e0e60..a48e2ac815 100644
--- a/lib/chef/provider/service/invokercd.rb
+++ b/lib/chef/provider/service/invokercd.rb
@@ -16,14 +16,14 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
class Service
class Invokercd < Chef::Provider::Service::Init
- provides :service, platform_family: 'debian', override: true do |node|
+ provides :service, platform_family: "debian", override: true do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:invokercd)
end
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index 47c74f9425..b939f78b03 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -16,12 +16,12 @@
# limitations under the License.
#
-require 'etc'
-require 'rexml/document'
-require 'chef/resource/service'
-require 'chef/resource/macosx_service'
-require 'chef/provider/service/simple'
-require 'chef/util/path_helper'
+require "etc"
+require "rexml/document"
+require "chef/resource/service"
+require "chef/resource/macosx_service"
+require "chef/provider/service/simple"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -36,14 +36,14 @@ class Chef
/Library/LaunchDaemons
/System/Library/LaunchAgents
/System/Library/LaunchDaemons }
- Chef::Util::PathHelper.home('Library', 'LaunchAgents') { |p| locations << p }
+ Chef::Util::PathHelper.home("Library", "LaunchAgents") { |p| locations << p }
locations
end
PLIST_DIRS = gather_plist_dirs
def this_version_or_newer?(this_version)
- Gem::Version.new(node['platform_version']) >= Gem::Version.new(this_version)
+ Gem::Version.new(node["platform_version"]) >= Gem::Version.new(this_version)
end
def load_current_resource
@@ -53,17 +53,17 @@ class Chef
@plist = @new_resource.plist ? @new_resource.plist : find_service_plist
@service_label = find_service_label
# LauchAgents should be loaded as the console user.
- @console_user = @plist ? @plist.include?('LaunchAgents') : false
+ @console_user = @plist ? @plist.include?("LaunchAgents") : false
@session_type = @new_resource.session_type
if @console_user
@console_user = Etc.getlogin
Chef::Log.debug("#{new_resource} console_user: '#{@console_user}'")
cmd = "su "
- param = this_version_or_newer?('10.10') ? '' : '-l '
+ param = this_version_or_newer?("10.10") ? "" : "-l "
@base_user_cmd = cmd + param + "#{@console_user} -c"
# Default LauchAgent session should be Aqua
- @session_type = 'Aqua' if @session_type.nil?
+ @session_type = "Aqua" if @session_type.nil?
end
Chef::Log.debug("#{new_resource} Plist: '#{@plist}' service_label: '#{@service_label}'")
@@ -161,13 +161,13 @@ class Chef
end
def load_service
- session = @session_type ? "-S #{@session_type} " : ''
- cmd = 'launchctl load -w ' + session + @plist
+ session = @session_type ? "-S #{@session_type} " : ""
+ cmd = "launchctl load -w " + session + @plist
shell_out_as_user(cmd)
end
def unload_service
- cmd = 'launchctl unload -w ' + @plist
+ cmd = "launchctl unload -w " + @plist
shell_out_as_user(cmd)
end
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index 36c9e8141e..10d7b21953 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/mixin/command'
-require 'chef/mixin/shell_out'
-require 'chef/provider/service/init'
-require 'chef/resource/service'
+require "chef/mixin/command"
+require "chef/mixin/shell_out"
+require "chef/provider/service/init"
+require "chef/resource/service"
class Chef
class Provider
@@ -32,13 +32,13 @@ class Chef
attr_reader :init_command, :rc_conf, :rc_conf_local, :enabled_state_found
- RC_CONF_PATH = '/etc/rc.conf'
- RC_CONF_LOCAL_PATH = '/etc/rc.conf.local'
+ RC_CONF_PATH = "/etc/rc.conf"
+ RC_CONF_LOCAL_PATH = "/etc/rc.conf.local"
def initialize(new_resource, run_context)
super
- @rc_conf = ::File.read(RC_CONF_PATH) rescue ''
- @rc_conf_local = ::File.read(RC_CONF_LOCAL_PATH) rescue ''
+ @rc_conf = ::File.read(RC_CONF_PATH) rescue ""
+ @rc_conf_local = ::File.read(RC_CONF_LOCAL_PATH) rescue ""
@init_command = ::File.exist?(rcd_script_path) ? rcd_script_path : nil
new_resource.status_command("#{default_init_command} check")
end
@@ -82,7 +82,7 @@ class Chef
if !is_enabled?
if is_builtin?
if is_enabled_by_default?
- update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, '')
+ update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, "")
else
# add line with blank string, which means enable
update_rcl rc_conf_local + "\n" + "#{builtin_service_enable_variable_name}=\"\"\n"
@@ -90,7 +90,7 @@ class Chef
else
# add to pkg_scripts, most recent addition goes last
old_services_list = rc_conf_local.match(/^pkg_scripts="(.*)"/)
- old_services_list = old_services_list ? old_services_list[1].split(' ') : []
+ old_services_list = old_services_list ? old_services_list[1].split(" ") : []
new_services_list = old_services_list + [new_resource.service_name]
if rc_conf_local.match(/^pkg_scripts="(.*)"/)
new_rcl = rc_conf_local.sub(/^pkg_scripts="(.*)"/, "pkg_scripts=\"#{new_services_list.join(' ')}\"")
@@ -110,12 +110,12 @@ class Chef
update_rcl rc_conf_local + "\n" + "#{builtin_service_enable_variable_name}=\"NO\"\n"
else
# remove line to disable
- update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, '')
+ update_rcl rc_conf_local.sub(/^#{Regexp.escape(builtin_service_enable_variable_name)}=.*/, "")
end
else
# remove from pkg_scripts
old_list = rc_conf_local.match(/^pkg_scripts="(.*)"/)
- old_list = old_list ? old_list[1].split(' ') : []
+ old_list = old_list ? old_list[1].split(" ") : []
new_list = old_list - [new_resource.service_name]
update_rcl rc_conf_local.sub(/^pkg_scripts="(.*)"/, pkg_scripts="#{new_list.join(' ')}")
end
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 3ad11a7672..f93cd36348 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/service/init'
+require "chef/provider/service/init"
class Chef
class Provider
@@ -79,8 +79,8 @@ class Chef
unless run_levels.nil? or run_levels.empty?
all_levels_match = true
chkconfig.stdout.split(/\s+/)[1..-1].each do |level|
- index = level.split(':').first
- status = level.split(':').last
+ index = level.split(":").first
+ status = level.split(":").last
if level =~ CHKCONFIG_ON
@current_run_levels << index.to_i
all_levels_match = false unless run_levels.include?(index.to_i)
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index bb3d819b3d..a096c9dfc0 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service'
-require 'chef/resource/service'
-require 'chef/mixin/command'
+require "chef/provider/service"
+require "chef/resource/service"
+require "chef/mixin/command"
class Chef
class Provider
diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb
index 7040503c6b..c43a25258c 100644
--- a/lib/chef/provider/service/solaris.rb
+++ b/lib/chef/provider/service/solaris.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider/service'
-require 'chef/resource/service'
-require 'chef/mixin/command'
+require "chef/provider/service"
+require "chef/resource/service"
+require "chef/mixin/command"
class Chef
class Provider
@@ -96,11 +96,11 @@ class Chef
# check service state
@maintenance = false
- case status['state']
- when 'online'
+ case status["state"]
+ when "online"
@current_resource.enabled(true)
@current_resource.running(true)
- when 'maintenance'
+ when "maintenance"
@maintenance = true
end
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index d41f6248c2..bf4b324dce 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/simple'
-require 'chef/mixin/which'
+require "chef/resource/service"
+require "chef/provider/service/simple"
+require "chef/mixin/which"
class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 8d9adaa3b3..c0f7e020f6 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -16,17 +16,17 @@
# limitations under the License.
#
-require 'chef/resource/service'
-require 'chef/provider/service/simple'
-require 'chef/mixin/command'
-require 'chef/util/file_edit'
+require "chef/resource/service"
+require "chef/provider/service/simple"
+require "chef/mixin/command"
+require "chef/util/file_edit"
class Chef
class Provider
class Service
class Upstart < Chef::Provider::Service::Simple
- provides :service, platform_family: 'debian', override: true do |node|
+ provides :service, platform_family: "debian", override: true do |node|
Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart)
end
@@ -130,7 +130,7 @@ class Chef
# Get enabled/disabled state by reading job configuration file
if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
Chef::Log.debug("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
- ::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}",'r') do |file|
+ ::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}","r") do |file|
while line = file.gets
case line
when /^start on/
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index fcebeeb6c6..0ae3c5b09f 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -18,10 +18,10 @@
# limitations under the License.
#
-require 'chef/provider/service/simple'
+require "chef/provider/service/simple"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/win32/error'
- require 'win32/service'
+ require "chef/win32/error"
+ require "win32/service"
end
class Chef::Provider::Service::Windows < Chef::Provider::Service
@@ -32,22 +32,22 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
include Chef::ReservedNames::Win32::API::Error rescue LoadError
#Win32::Service.get_start_type
- AUTO_START = 'auto start'
- MANUAL = 'demand start'
- DISABLED = 'disabled'
+ AUTO_START = "auto start"
+ MANUAL = "demand start"
+ DISABLED = "disabled"
#Win32::Service.get_current_state
- RUNNING = 'running'
- STOPPED = 'stopped'
- CONTINUE_PENDING = 'continue pending'
- PAUSE_PENDING = 'pause pending'
- PAUSED = 'paused'
- START_PENDING = 'start pending'
- STOP_PENDING = 'stop pending'
+ RUNNING = "running"
+ STOPPED = "stopped"
+ CONTINUE_PENDING = "continue pending"
+ PAUSE_PENDING = "pause pending"
+ PAUSED = "paused"
+ START_PENDING = "start pending"
+ STOP_PENDING = "stop pending"
TIMEOUT = 60
- SERVICE_RIGHT = 'SeServiceLogonRight'
+ SERVICE_RIGHT = "SeServiceLogonRight"
def whyrun_supported?
false
@@ -252,11 +252,11 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
# remove characters that make for broken or wonky filenames.
def clean_username_for_path(username)
- username.gsub(/[\/\\. ]+/, '_')
+ username.gsub(/[\/\\. ]+/, "_")
end
def canonicalize_username(username)
- username.sub(/^\.?\\+/, '')
+ username.sub(/^\.?\\+/, "")
end
def current_state
diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb
index e3e3d5158a..2cc0da65a0 100644
--- a/lib/chef/provider/subversion.rb
+++ b/lib/chef/provider/subversion.rb
@@ -18,10 +18,10 @@
#TODO subversion and git should both extend from a base SCM provider.
-require 'chef/log'
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'fileutils'
+require "chef/log"
+require "chef/provider"
+require "chef/mixin/command"
+require "fileutils"
class Chef
class Provider
@@ -176,7 +176,7 @@ class Chef
end
attrs
end
- rev = (repo_attrs['Last Changed Rev'] || repo_attrs['Revision'])
+ rev = (repo_attrs["Last Changed Rev"] || repo_attrs["Revision"])
rev.strip! if rev
raise "Could not parse `svn info` data: #{svn_info}" if repo_attrs.empty?
Chef::Log.debug "#{@new_resource} resolved revision #{@new_resource.revision} to #{rev}"
@@ -201,12 +201,12 @@ class Chef
end
def target_dir_non_existent_or_empty?
- !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..']
+ !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == [".",".."]
end
def svn_binary
@new_resource.svn_binary ||
- (Chef::Platform.windows? ? 'svn.exe' : 'svn')
+ (Chef::Platform.windows? ? "svn.exe" : "svn")
end
def assert_target_directory_valid!
diff --git a/lib/chef/provider/template.rb b/lib/chef/provider/template.rb
index 1e759074b9..7cbfca025f 100644
--- a/lib/chef/provider/template.rb
+++ b/lib/chef/provider/template.rb
@@ -17,10 +17,10 @@
# limitations under the License.
#
-require 'chef/provider/template_finder'
-require 'chef/provider/file'
-require 'chef/deprecation/provider/template'
-require 'chef/deprecation/warnings'
+require "chef/provider/template_finder"
+require "chef/provider/file"
+require "chef/deprecation/provider/template"
+require "chef/deprecation/warnings"
class Chef
class Provider
diff --git a/lib/chef/provider/template/content.rb b/lib/chef/provider/template/content.rb
index 693b19a8c6..891861de8b 100644
--- a/lib/chef/provider/template/content.rb
+++ b/lib/chef/provider/template/content.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/mixin/template'
-require 'chef/file_content_management/content_base'
+require "chef/mixin/template"
+require "chef/file_content_management/content_base"
class Chef
class Provider
diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb
index 76aefbf1c8..b819401731 100644
--- a/lib/chef/provider/user.rb
+++ b/lib/chef/provider/user.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/provider'
-require 'chef/mixin/command'
-require 'etc'
+require "chef/provider"
+require "chef/mixin/command"
+require "etc"
class Chef
class Provider
@@ -71,9 +71,9 @@ class Chef
end
@current_resource.comment(user_info.gecos)
- if @new_resource.password && @current_resource.password == 'x'
+ if @new_resource.password && @current_resource.password == "x"
begin
- require 'shadow'
+ require "shadow"
rescue LoadError
@shadow_lib_ok = false
else
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index 78769ae758..563d56dce7 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -16,11 +16,11 @@
# limitations under the License.
#
-require 'mixlib/shellout'
-require 'chef/provider/user'
-require 'openssl'
-require 'plist'
-require 'chef/util/path_helper'
+require "mixlib/shellout"
+require "chef/provider/user"
+require "openssl"
+require "plist"
+require "chef/util/path_helper"
class Chef
class Provider
@@ -136,14 +136,14 @@ user password using shadow hash.")
if shadow_hash["SALTED-SHA512"]
# Convert the shadow value from Base64 encoding to hex before consuming them
@password_shadow_conversion_algorithm = "SALTED-SHA512"
- current_resource.password(shadow_hash["SALTED-SHA512"].string.unpack('H*').first)
+ current_resource.password(shadow_hash["SALTED-SHA512"].string.unpack("H*").first)
elsif shadow_hash["SALTED-SHA512-PBKDF2"]
@password_shadow_conversion_algorithm = "SALTED-SHA512-PBKDF2"
# Convert the entropy from Base64 encoding to hex before consuming them
- current_resource.password(shadow_hash["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack('H*').first)
+ current_resource.password(shadow_hash["SALTED-SHA512-PBKDF2"]["entropy"].string.unpack("H*").first)
current_resource.iterations(shadow_hash["SALTED-SHA512-PBKDF2"]["iterations"])
# Convert the salt from Base64 encoding to hex before consuming them
- current_resource.salt(shadow_hash["SALTED-SHA512-PBKDF2"]["salt"].string.unpack('H*').first)
+ current_resource.salt(shadow_hash["SALTED-SHA512-PBKDF2"]["salt"].string.unpack("H*").first)
else
raise(Chef::Exceptions::User,"Unknown shadow_hash format: #{shadow_hash.keys.join(' ')}")
end
@@ -213,7 +213,7 @@ user password using shadow hash.")
#
def dscl_set_uid
# XXX: mutates the new resource
- new_resource.uid(get_free_uid) if (new_resource.uid.nil? || new_resource.uid == '')
+ new_resource.uid(get_free_uid) if (new_resource.uid.nil? || new_resource.uid == "")
if uid_used?(new_resource.uid)
raise(Chef::Exceptions::RequestedUIDUnavailable, "uid #{new_resource.uid} is already in use")
@@ -396,7 +396,7 @@ user password using shadow hash.")
# Create a random 4 byte salt
salt = OpenSSL::Random.random_bytes(4)
encoded_password = OpenSSL::Digest::SHA512.hexdigest(salt + new_resource.password)
- hash_value = salt.unpack('H*').first + encoded_password
+ hash_value = salt.unpack("H*").first + encoded_password
end
shadow_info["SALTED-SHA512"] = StringIO.new
@@ -664,7 +664,7 @@ user password using shadow hash.")
result = shell_out("plutil -#{args.join(' ')}")
raise(Chef::Exceptions::PlistUtilCommandFailed,"plutil error: #{result.inspect}") unless result.exitstatus == 0
if result.stdout.encoding == Encoding::ASCII_8BIT
- result.stdout.encode("utf-8", "binary", :undef => :replace, :invalid => :replace, :replace => '?')
+ result.stdout.encode("utf-8", "binary", :undef => :replace, :invalid => :replace, :replace => "?")
else
result.stdout
end
@@ -675,7 +675,7 @@ user password using shadow hash.")
end
def convert_to_binary(string)
- string.unpack('a2'*(string.size/2)).collect { |i| i.hex.chr }.join
+ string.unpack("a2"*(string.size/2)).collect { |i| i.hex.chr }.join
end
def salted_sha512?(string)
@@ -702,7 +702,7 @@ user password using shadow hash.")
current_resource.iterations,
128,
OpenSSL::Digest::SHA512.new,
- ).unpack('H*').first == current_resource.password
+ ).unpack("H*").first == current_resource.password
end
end
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index e53d647f37..37890bdc1e 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/provider/user'
+require "chef/provider/user"
class Chef
class Provider
@@ -71,11 +71,11 @@ class Chef
opts = " #{@new_resource.username}"
field_list = {
- 'comment' => "-c",
- 'home' => "-d",
- 'gid' => "-g",
- 'uid' => "-u",
- 'shell' => "-s",
+ "comment" => "-c",
+ "home" => "-d",
+ "gid" => "-g",
+ "uid" => "-u",
+ "shell" => "-s",
}
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |field, option|
field_symbol = field.to_sym
diff --git a/lib/chef/provider/user/solaris.rb b/lib/chef/provider/user/solaris.rb
index c16db22ad4..d9108d4ca4 100644
--- a/lib/chef/provider/user/solaris.rb
+++ b/lib/chef/provider/user/solaris.rb
@@ -18,7 +18,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/provider/user/useradd'
+require "chef/provider/user/useradd"
class Chef
class Provider
@@ -45,14 +45,14 @@ class Chef
end
def check_lock
- shadow_line = shell_out!('getent', 'shadow', new_resource.username).stdout.strip rescue nil
+ shadow_line = shell_out!("getent", "shadow", new_resource.username).stdout.strip rescue nil
# if the command fails we return nil, this can happen if the user
# in question doesn't exist
return nil if shadow_line.nil?
# convert "dave:NP:16507::::::\n" to "NP"
- fields = shadow_line.split(':')
+ fields = shadow_line.split(":")
# '*LK*...' and 'LK' are both considered locked,
# so look for LK at the beginning of the shadow entry
@@ -63,11 +63,11 @@ class Chef
end
def lock_user
- shell_out!('passwd', '-l', new_resource.username)
+ shell_out!("passwd", "-l", new_resource.username)
end
def unlock_user
- shell_out!('passwd', '-u', new_resource.username)
+ shell_out!("passwd", "-u", new_resource.username)
end
private
diff --git a/lib/chef/provider/user/useradd.rb b/lib/chef/provider/user/useradd.rb
index a1b5b3459c..da6606bc14 100644
--- a/lib/chef/provider/user/useradd.rb
+++ b/lib/chef/provider/user/useradd.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'pathname'
-require 'chef/provider/user'
+require "pathname"
+require "chef/provider/user"
class Chef
class Provider
@@ -63,7 +63,7 @@ class Chef
raise Chef::Exceptions::User, "Cannot determine if #{@new_resource} is locked!" if passwd_s.stdout.empty?
- status_line = passwd_s.stdout.split(' ')
+ status_line = passwd_s.stdout.split(" ")
case status_line[1]
when /^P/
@locked = false
@@ -75,11 +75,11 @@ class Chef
unless passwd_s.exitstatus == 0
raise_lock_error = false
- if ['redhat', 'centos'].include?(node[:platform])
- passwd_version_check = shell_out!('rpm -q passwd')
+ if ["redhat", "centos"].include?(node[:platform])
+ passwd_version_check = shell_out!("rpm -q passwd")
passwd_version = passwd_version_check.stdout.chomp
- unless passwd_version == 'passwd-0.73-1'
+ unless passwd_version == "passwd-0.73-1"
raise_lock_error = true
end
else
diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb
index b0b2d7e956..0851c2272a 100644
--- a/lib/chef/provider/user/windows.rb
+++ b/lib/chef/provider/user/windows.rb
@@ -16,10 +16,10 @@
# limitations under the License.
#
-require 'chef/provider/user'
-require 'chef/exceptions'
+require "chef/provider/user"
+require "chef/exceptions"
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'chef/util/windows/net_user'
+ require "chef/util/windows/net_user"
end
class Chef
@@ -101,11 +101,11 @@ class Chef
opts = {:name => @new_resource.username}
field_list = {
- 'comment' => 'full_name',
- 'home' => 'home_dir',
- 'uid' => 'user_id',
- 'shell' => 'script_path',
- 'password' => 'password',
+ "comment" => "full_name",
+ "home" => "home_dir",
+ "uid" => "user_id",
+ "shell" => "script_path",
+ "password" => "password",
}
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |field, option|
diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb
index 62b49bd833..342158fa06 100644
--- a/lib/chef/provider/windows_script.rb
+++ b/lib/chef/provider/windows_script.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/provider/script'
-require 'chef/mixin/windows_architecture_helper'
+require "chef/provider/script"
+require "chef/mixin/windows_architecture_helper"
class Chef
class Provider
@@ -29,7 +29,7 @@ class Chef
include Chef::Mixin::WindowsArchitectureHelper
- def initialize( new_resource, run_context, script_extension='')
+ def initialize( new_resource, run_context, script_extension="")
super( new_resource, run_context )
@script_extension = script_extension