Skip to content

Commit

Permalink
Support license installation via system property path
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-clerc committed Apr 10, 2024
1 parent 2d411bc commit 5edb3ad
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions resources/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'] }

Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 5edb3ad

Please sign in to comment.