Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jenkins_slave_jnlp resource creation is not compatible with Ruby3.1 #813

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 7 additions & 29 deletions libraries/slave_jnlp.rb
Original file line number Diff line number Diff line change
@@ -85,40 +85,18 @@ def load_current_resource
action :create
end

declare_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.backup(false)
r.mode('0755')
r.atomic_update(false)
r.notifies :restart, "systemd_unit[#{new_resource.service_name}.service]" unless platform?('windows')
u = slave_jar_url
declare_resource(:remote_file, slave_jar) do
source(u)
backup(false)
mode('0755')
atomic_update(false)
notifies :restart, "systemd_unit[#{new_resource.service_name}.service]" unless platform?('windows')
end

# The Windows's specific child class manages it's own service
return if platform?('windows')

# disable runit services before starting new service
# TODO: remove in future version

%W(
/etc/init.d/#{new_resource.service_name}
/etc/service/#{new_resource.service_name}
).each do |f|
file f do
action :delete
notifies :stop, "service[#{new_resource.service_name}]", :before
end
end

# runit_service = if platform_family?('debian')
# 'runit'
# else
# 'runsvdir-start'
# end
# service runit_service do
# action [:stop, :disable]
# end

exec_string = "#{java} #{new_resource.jvm_options}"
exec_string << " -jar #{slave_jar}" if slave_jar
exec_string << " -secret #{jnlp_secret}" if jnlp_secret
Loading