summaryrefslogtreecommitdiff
path: root/lib/chef/resource.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:09:07 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-07-02 15:09:07 -0700
commit7a1a6c8ef26c787e4b6dd1602f3d158b37e81720 (patch)
tree1e390cd535b38368d091cbb33e5d419408d5ce00 /lib/chef/resource.rb
parent77f8739a4741e2370e40ec39345a92a6ea393a1a (diff)
downloadchef-7a1a6c8ef26c787e4b6dd1602f3d158b37e81720.tar.gz
fix Layout/EmptyLineAfterGuardClause
i like this one, gives visual priority to returns or raises that are buried in the middle of things. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/resource.rb')
-rw-r--r--lib/chef/resource.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index 40dcbd1ed2..f1184094f1 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -516,6 +516,7 @@ class Chef
result[property.name] = send(property.name)
end
return result.values.first if identity_properties.size == 1
+
result
end
@@ -581,6 +582,7 @@ class Chef
begin
return if should_skip?(action)
+
provider_for_action(action).run_action
rescue StandardError => e
if ignore_failure
@@ -629,6 +631,7 @@ class Chef
def to_text
return "suppressed sensitive resource output" if sensitive
+
text = "# Declared in #{@source_line}\n\n"
text << "#{resource_name}(\"#{name}\") do\n"
@@ -699,6 +702,7 @@ class Chef
safe_ivars.each do |iv|
key = iv.to_s.sub(/^@/, "").to_sym
next if result.key?(key)
+
result[key] = instance_variable_get(iv)
end
result
@@ -811,6 +815,7 @@ class Chef
if result.size > 1
raise Chef::Exceptions::MultipleIdentityError, "identity_property cannot be called on an object with more than one identity property (#{result.map { |r| r.name }.join(", ")})."
end
+
result.first
end
@@ -831,6 +836,7 @@ class Chef
def self.identity_attr(name = nil)
property = identity_property(name)
return nil if !property
+
property.name
end
@@ -1104,6 +1110,7 @@ class Chef
if provider.whyrun_mode? && !provider.whyrun_supported?
raise "Cannot retrieve #{self.class.current_resource} in why-run mode: #{provider} does not support why-run"
end
+
provider.load_current_resource
provider.current_resource
end
@@ -1376,6 +1383,7 @@ class Chef
# the declared key we want to fall back on the old to_s key.
def declared_key
return to_s if declared_type.nil?
+
"#{declared_type}[#{@name}]"
end
@@ -1542,6 +1550,7 @@ class Chef
def self.resource_for_node(short_name, node)
klass = Chef::ResourceResolver.resolve(short_name, node: node)
raise Chef::Exceptions::NoSuchResourceType.new(short_name, node) if klass.nil?
+
klass
end