summaryrefslogtreecommitdiff
path: root/lib/chef/dsl
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/dsl
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/dsl')
-rw-r--r--lib/chef/dsl/declare_resource.rb2
-rw-r--r--lib/chef/dsl/platform_introspection.rb2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/dsl/declare_resource.rb b/lib/chef/dsl/declare_resource.rb
index f23ef466fb..7ae1551c04 100644
--- a/lib/chef/dsl/declare_resource.rb
+++ b/lib/chef/dsl/declare_resource.rb
@@ -41,6 +41,7 @@ class Chef
#
def with_run_context(rc)
raise ArgumentError, "with_run_context is useless without a block" unless block_given?
+
old_run_context = @run_context
@run_context =
case rc
@@ -202,6 +203,7 @@ class Chef
#
def find_resource!(type, name, run_context: self.run_context)
raise ArgumentError, "find_resource! does not take a block" if block_given?
+
run_context.resource_collection.find(type => name)
end
diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb
index e7f0c60f0d..dfd20b6329 100644
--- a/lib/chef/dsl/platform_introspection.rb
+++ b/lib/chef/dsl/platform_introspection.rb
@@ -70,6 +70,7 @@ class Chef
def match_versions(node)
platform, version = node[:platform].to_s, node[:platform_version].to_s
return nil unless @values.key?(platform)
+
node_version = Chef::Version::Platform.new(version)
key_matches = []
keys = @values[platform].keys
@@ -84,6 +85,7 @@ class Chef
end
end
return @values[platform][version] if key_matches.include?(version)
+
case key_matches.length
when 0
return nil