diff --git a/resources/default.rb b/resources/default.rb index 0ce2ccd..7bc072e 100644 --- a/resources/default.rb +++ b/resources/default.rb @@ -17,6 +17,7 @@ property :properties_variables, Hash, default: lazy { node['nexus3']['properties_variables'] } property :vmoptions_variables, Hash, default: lazy { node['nexus3']['vmoptions_variables'] } property :outbound_proxy, [Hash, NilClass], sensitive: true, default: lazy { node['nexus3']['outbound_proxy'] } +property :license, [String, NilClass], sensitive: true, default: lazy { node['nexus3']['license'] } property :plugins, Hash, default: lazy { node['nexus3']['plugins'] } property :logback_variables, Hash, default: lazy { node['nexus3']['logback_variables'] } @@ -69,6 +70,27 @@ port = new_resource.properties_variables['application-port'] blocker = "block until Nexus #{new_resource.service_name}@#{port} operational" + directory "license directory for #{new_resource.instance_name}" do + path(lazy { ::File.dirname(new_resource.properties_variables['nexus.licenseFile']) }) + recursive true + owner 'root' + group 'root' + mode '0755' + only_if { new_resource.license && new_resource.properties_variables['nexus.licenseFile'] } + end + + file "license for #{new_resource.instance_name}" do + action :create + owner 'root' + group new_resource.nexus3_group + mode '0640' + sensitive true + content(lazy { ::Base64.decode64(new_resource.license) }) + only_if { new_resource.license && new_resource.properties_variables['nexus.licenseFile'] } + notifies :restart, "nexus3_service[#{new_resource.service_name}]", :delayed + notifies :run, "ruby_block[#{blocker}]", :delayed + end + # Install configuration from templates template ::File.join(install_dir, 'bin', 'nexus.rc') do source 'nexus.rc.erb'