summaryrefslogtreecommitdiff
path: root/lib/chef/platform
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-02-05 15:00:00 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2016-02-05 15:00:00 -0800
commit686113531d23f30e9973d659c456ae33eb9cff1f (patch)
treef225de7251a8b49b8d183dd168bab0a0addbe23f /lib/chef/platform
parentd1cf34b059a16a81e0fc48de52ba29863bb41fe6 (diff)
downloadchef-686113531d23f30e9973d659c456ae33eb9cff1f.tar.gz
autofixing whitespace cops
4174 Style/SpaceInsideHashLiteralBraces 1860 Style/SpaceAroundOperators 1336 Style/SpaceInsideBlockBraces 1292 Style/AlignHash 997 Style/SpaceAfterComma 860 Style/SpaceAroundEqualsInParameterDefault 310 Style/EmptyLines 294 Style/IndentationConsistency 267 Style/TrailingWhitespace 238 Style/ExtraSpacing 212 Style/SpaceBeforeBlockBraces 166 Style/MultilineOperationIndentation 144 Style/TrailingBlankLines 120 Style/EmptyLineBetweenDefs 101 Style/IndentationWidth 82 Style/SpaceAroundBlockParameters 40 Style/EmptyLinesAroundMethodBody 29 Style/EmptyLinesAroundAccessModifier 1 Style/RescueEnsureAlignment
Diffstat (limited to 'lib/chef/platform')
-rw-r--r--lib/chef/platform/provider_mapping.rb42
-rw-r--r--lib/chef/platform/query_helpers.rb1
-rw-r--r--lib/chef/platform/rebooter.rb2
-rw-r--r--lib/chef/platform/service_helpers.rb2
4 files changed, 23 insertions, 24 deletions
diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb
index 478ed55385..39d415e590 100644
--- a/lib/chef/platform/provider_mapping.rb
+++ b/lib/chef/platform/provider_mapping.rb
@@ -45,7 +45,7 @@ class Chef
end
if platforms.has_key?(name_sym)
- platform_versions = platforms[name_sym].select {|k, v| k != :default }
+ platform_versions = platforms[name_sym].select { |k, v| k != :default }
if platforms[name_sym].has_key?(:default)
provider_map.merge!(platforms[name_sym][:default])
end
@@ -89,7 +89,7 @@ class Chef
return platform, version
end
- def provider_for_resource(resource, action=:nothing)
+ def provider_for_resource(resource, action = :nothing)
node = resource.run_context && resource.run_context.node
raise ArgumentError, "Cannot find the provider for a resource with no run context set" unless node
provider = find_provider_for_node(node, resource).new(resource, resource.run_context)
@@ -183,31 +183,31 @@ class Chef
private
- def explicit_provider(platform, version, resource_type)
- resource_type.kind_of?(Chef::Resource) ? resource_type.provider : nil
- end
+ def explicit_provider(platform, version, resource_type)
+ resource_type.kind_of?(Chef::Resource) ? resource_type.provider : nil
+ end
- def platform_provider(platform, version, resource_type)
- pmap = Chef::Platform.find(platform, version)
- rtkey = resource_type.kind_of?(Chef::Resource) ? resource_type.resource_name.to_sym : resource_type
- pmap.has_key?(rtkey) ? pmap[rtkey] : nil
- end
+ def platform_provider(platform, version, resource_type)
+ pmap = Chef::Platform.find(platform, version)
+ rtkey = resource_type.kind_of?(Chef::Resource) ? resource_type.resource_name.to_sym : resource_type
+ pmap.has_key?(rtkey) ? pmap[rtkey] : nil
+ end
- include Chef::Mixin::ConvertToClassName
+ include Chef::Mixin::ConvertToClassName
- def resource_matching_provider(platform, version, resource_type)
- if resource_type.kind_of?(Chef::Resource)
- class_name = resource_type.class.name ? resource_type.class.name.split("::").last :
- convert_to_class_name(resource_type.resource_name.to_s)
+ def resource_matching_provider(platform, version, resource_type)
+ if resource_type.kind_of?(Chef::Resource)
+ class_name = resource_type.class.name ? resource_type.class.name.split("::").last :
+ convert_to_class_name(resource_type.resource_name.to_s)
- if Chef::Provider.const_defined?(class_name)
- Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{convert_to_snake_case(class_name).to_sym.inspect}'.")
- Chef::Log.warn("This will no longer work in Chef 13: you must use 'provides' to use the resource's DSL.")
- return Chef::Provider.const_get(class_name)
- end
+ if Chef::Provider.const_defined?(class_name)
+ Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{convert_to_snake_case(class_name).to_sym.inspect}'.")
+ Chef::Log.warn("This will no longer work in Chef 13: you must use 'provides' to use the resource's DSL.")
+ return Chef::Provider.const_get(class_name)
end
- nil
end
+ nil
+ end
end
end
diff --git a/lib/chef/platform/query_helpers.rb b/lib/chef/platform/query_helpers.rb
index 7a92fd3300..7d522072a3 100644
--- a/lib/chef/platform/query_helpers.rb
+++ b/lib/chef/platform/query_helpers.rb
@@ -99,7 +99,6 @@ class Chef
metadata = cmdlet.run!.return_value
metadata["RefreshMode"] == "Disabled"
end
-
def supported_powershell_version?(node, version_string)
return false unless node[:languages] && node[:languages][:powershell]
diff --git a/lib/chef/platform/rebooter.rb b/lib/chef/platform/rebooter.rb
index 622f35a5db..c678b60dd1 100644
--- a/lib/chef/platform/rebooter.rb
+++ b/lib/chef/platform/rebooter.rb
@@ -32,7 +32,7 @@ class Chef
cmd = if Chef::Platform.windows?
# should this do /f as well? do we then need a minimum delay to let apps quit?
- "shutdown /r /t #{reboot_info[:delay_mins]*60} /c \"#{reboot_info[:reason]}\""
+ "shutdown /r /t #{reboot_info[:delay_mins] * 60} /c \"#{reboot_info[:reason]}\""
else
# probably Linux-only.
"shutdown -r +#{reboot_info[:delay_mins]} \"#{reboot_info[:reason]}\""
diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb
index 13d710eefe..87b87d4c72 100644
--- a/lib/chef/platform/service_helpers.rb
+++ b/lib/chef/platform/service_helpers.rb
@@ -99,7 +99,7 @@ class Chef
def systemd_is_init?
::File.exist?(Chef.path_to("/proc/1/comm")) &&
- ::File.open(Chef.path_to("/proc/1/comm")).gets.chomp == "systemd"
+ ::File.open(Chef.path_to("/proc/1/comm")).gets.chomp == "systemd"
end
def has_systemd_service_unit?(svc_name)