Skip to content
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
14 changes: 1 addition & 13 deletions shared/macros/10-bash.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -697,17 +697,14 @@ Macro to enable or disable a particular service.

bash_service_command("enable", "bluetooth")
bash_service_command("disable", "bluetooth.service")
bash_service_command("disable", "rsh.socket", xinetd="rsh")

:param service_state: Desired state of the service
:type service_state: str
:param service: The service to change
:type service: str
:param xinetd: Set the xinetd for the service. Defaults to empty string.
:type xinetd: str

#}}
{{%- macro bash_service_command(service_state, service, xinetd="") -%}}
{{%- macro bash_service_command(service_state, service) -%}}
{{#
# If systemctl is installed, use systemctl command; otherwise, use the
# service/chkconfig commands
Expand All @@ -731,15 +728,6 @@ if /usr/bin/systemctl --failed | grep -q "{{{ service }}}"; then
/usr/bin/systemctl reset-failed "{{{ service }}}"
fi
{{%- endif -%}}

{{%- if xinetd != "" -%}}
grep -qi disable "/etc/xinetd.d/$xinetd" && \
{{%- if service_state == "disable" -%}}
sed -i "s/disable.*/disable = no/gI" "/etc/xinetd.d/$xinetd"
{{%- else -%}}
sed -i "s/disable.*/disable = yes/gI" "/etc/xinetd.d/$xinetd"
{{%- endif -%}}
{{%- endif -%}}
{{%- endmacro -%}}


Expand Down
Loading