Project

General

Profile

« Previous | Next » 

Revision dff3c9b4

Added by Ian Ballou over 3 years ago

Fixes #31124 - Don't start pulp 3 if not enabled

View differences:

definitions/features/pulpcore.rb
label :pulpcore
confine do
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist?
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).exist? &&
ForemanMaintain::Utils::Service::Systemd.new('pulpcore-api', 0).enabled?
end
end
lib/foreman_maintain/utils/service/systemd.rb
def exist?
if @sys.systemd_installed?
systemd = @sys.execute("systemctl is-enabled #{@name} 2>&1 | tail -1").strip
systemd = service_enabled_status
systemd == 'enabled' || systemd == 'disabled'
else
File.exist?("/etc/init.d/#{@name}")
end
end
def enabled?
if @sys.systemd_installed?
service_enabled_status == 'enabled'
end
end
private
def execute(action, options = {})
@sys.execute_with_status(command(action, options))
end
def service_enabled_status
@sys.execute("systemctl is-enabled #{@name} 2>&1 | tail -1").strip
end
def skip_enablement_message(action, name)
# Enable and disable does not work well with globs since they treat them literally.
# We are skipping the pulpcore-workers@* for these actions until they are configured in

Also available in: Unified diff