Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
4be3b068
Commit
4be3b068
authored
Feb 24, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run chkconfig enable/disable only when needed. TODO, apply same logic to update-rc.d/systemd
parent
0380ba71
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
library/service
+16
-7
No files found.
library/service
View file @
4be3b068
...
@@ -444,6 +444,19 @@ class LinuxService(Service):
...
@@ -444,6 +444,19 @@ class LinuxService(Service):
if
self
.
enable_cmd
is
None
:
if
self
.
enable_cmd
is
None
:
self
.
module
.
fail_json
(
msg
=
'unable to find enable binary'
)
self
.
module
.
fail_json
(
msg
=
'unable to find enable binary'
)
# FIXME: we use chkconfig to decide whether to run the command here, but if we don't
# have chkconfig we need similar code for updates-rc.d and systemd.
if
self
.
enable_cmd
.
endswith
(
"chkconfig"
):
(
rc
,
out
,
err
)
=
self
.
execute_command
(
"
%
s --list
%
s"
%
(
self
.
enable_cmd
,
self
.
name
))
if
not
self
.
name
in
out
:
self
.
module
.
exit_json
(
msg
=
"unknown service name"
)
state
=
out
.
split
()[
-
1
]
if
self
.
enable
and
(
"3:on"
in
out
and
"5:on"
in
out
):
return
elif
not
self
.
enable
and
(
"3:off"
in
out
and
"5:off"
in
out
):
return
# we change argument depending on real binary used
# we change argument depending on real binary used
# update-rc.d wants enable/disable while
# update-rc.d wants enable/disable while
# chkconfig wants on/off
# chkconfig wants on/off
...
@@ -462,16 +475,12 @@ class LinuxService(Service):
...
@@ -462,16 +475,12 @@ class LinuxService(Service):
else
:
else
:
args
=
(
self
.
enable_cmd
,
self
.
name
,
on_off
)
args
=
(
self
.
enable_cmd
,
self
.
name
,
on_off
)
# FIXME: we need this function to detect whether to run the command
self
.
changed
=
True
# so we need something to get the service enablement state here.
changed
=
True
if
self
.
module
.
check_mode
and
changed
:
if
self
.
module
.
check_mode
and
changed
:
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
"editing service enablement"
)
self
.
module
.
exit_json
(
changed
=
True
)
if
self
.
enable
is
not
None
and
changed
:
return
self
.
execute_command
(
"
%
s
%
s
%
s"
%
args
)
return
self
.
execute_command
(
"
%
s
%
s
%
s"
%
args
)
def
service_control
(
self
):
def
service_control
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment