summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/package')
-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
25 files changed, 161 insertions, 161 deletions
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|