Skip to content

Commit 997f506

Browse files
Fix is_service_installed? to search services also as init scripts
Signed-off-by: Francesco Giordano <giordafr@amazon.it>
1 parent 96a5207 commit 997f506

File tree

1 file changed

+3
-1
lines changed
  • cookbooks/aws-parallelcluster-config/libraries

1 file changed

+3
-1
lines changed

cookbooks/aws-parallelcluster-config/libraries/helpers.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#
1818
def is_service_installed?(service, platform_families = node['platform_family'])
1919
if platform_family?(platform_families)
20-
service_check = Mixlib::ShellOut.new("systemctl daemon-reload && systemctl list-unit-files --all | grep #{service}")
20+
# Add chkconfig for alinux2 and centos platform, because they do not generate systemd unit file automatically from init script
21+
# Ubuntu platform generate systemd unit file from init script automatically, if the service is not found by systemd the check will fail because chkconfig does not exist
22+
service_check = Mixlib::ShellOut.new("systemctl daemon-reload; systemctl list-unit-files --all | grep #{service} || chkconfig --list #{service}")
2123
service_check.run_command
2224
# convert return code in boolean
2325
service_check.exitstatus.to_i.zero?

0 commit comments

Comments
 (0)