From bc1e305d5e64191d28437c541b322e2c7d260983 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Fri, 17 Aug 2018 15:38:03 +0200 Subject: [PATCH] Add "checksum" option for slave-jar remote_file resource It is not a good practice to apply remote_file resource without checksum, add this option here to allow end users add valid one. --- libraries/slave_jnlp.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/slave_jnlp.rb b/libraries/slave_jnlp.rb index bb147785ce..c1dade60bd 100644 --- a/libraries/slave_jnlp.rb +++ b/libraries/slave_jnlp.rb @@ -126,6 +126,15 @@ def slave_jar_url @slave_jar_url ||= uri_join(endpoint, 'jnlpJars', 'slave.jar') end + # + # The checksum of the +slave.jar+. + # + # @return [String] + # + def slave_jar_checksum + @slave_jar_checksum ||= new_resource.checksum + end + # # The path to the +slave.jar+ on disk (which may or may not exist). # @@ -211,6 +220,7 @@ def slave_jar_resource build_resource(:remote_file, slave_jar).tap do |r| # We need to use .tap() to access methods in the provider's scope. r.source slave_jar_url + r.checksum slave_jar_checksum r.backup(false) r.mode('0755') r.atomic_update(false)