Feature #21717
closedExtend "Service Action - SSH Default" job template to be able to enable and disable services
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1515671
Description of problem:
The standard job template "Service Action - SSH Default" does not support enabling or disabling services.
Version-Release number of selected component (if applicable): 6.2.12
How reproducible:
Always
Steps to Reproduce:
1. Run job template "Service Action - SSH Default"
2. Notice that there are no option to enable or disable a service
Actual results:
You have to use "Run Command - SSH Default" with "chkconfig <service name> on/off" or "systemctl <service name> enable/disable" depending on the target host.
Expected results:
There should be options in "Service Action - SSH Default" to enable/disable services and the template should handle if it is executed on a system that is using systemd or not.
Implementation suggestion:
Change the template to this:
<% if @host.operatingsystem.family == "Redhat" && @host.operatingsystem.major.to_i > 6 ->
systemctl <= input("action") > <= input("service") >
< elsif input("action") == "enable" ->
chkconfig <= input("service") > on
< elsif input("action") == "disable" ->
chkconfig <= input("service") > off
< else ->
service <= input("service") > <= input("action") >
< end -%>
And in the Job tab under Template input, add "enable" and "disable" to the list of Options so that the list consist of the following options:
restart
start
stop
status
enable
disable