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
f4c5f37c
Commit
f4c5f37c
authored
Sep 16, 2013
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue_3417_systemd_stuff' into devel
parents
5b150100
72eaa057
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
library/system/service
+16
-6
No files found.
library/system/service
View file @
f4c5f37c
...
...
@@ -392,16 +392,26 @@ class LinuxService(Service):
if
not
location
.
get
(
'systemctl'
,
None
):
return
False
# default to .service if the unit type is not specified
if
name
.
find
(
'.'
)
>
0
:
unit_name
,
unit_type
=
name
.
rsplit
(
'.'
,
1
)
if
unit_type
not
in
(
"service"
,
"socket"
,
"device"
,
"mount"
,
"automount"
,
"swap"
,
"target"
,
"path"
,
"timer"
,
"snapshot"
):
name
=
"
%
s.service"
%
name
else
:
name
=
"
%
s.service"
%
name
rc
,
out
,
err
=
self
.
execute_command
(
"
%
s list-unit-files"
%
(
location
[
'systemctl'
]))
# adjust the service name to account for template service unit files
index
=
name
.
find
(
'@'
)
if
index
!=
-
1
:
self
.
name
=
name
=
name
[:
index
+
1
]
name
=
name
[:
index
+
1
]
look_for
=
"
%
s.service"
%
nam
e
self
.
__systemd_unit
=
Non
e
for
line
in
out
.
splitlines
():
if
line
.
startswith
(
look_for
):
if
line
.
startswith
(
name
):
self
.
__systemd_unit
=
name
return
True
return
False
...
...
@@ -540,7 +550,7 @@ class LinuxService(Service):
return
if
self
.
enable_cmd
.
endswith
(
"systemctl"
):
(
rc
,
out
,
err
)
=
self
.
execute_command
(
"
%
s show
%
s
.service"
%
(
self
.
enable_cmd
,
self
.
name
))
(
rc
,
out
,
err
)
=
self
.
execute_command
(
"
%
s show
%
s
"
%
(
self
.
enable_cmd
,
self
.
__systemd_unit
))
d
=
dict
(
line
.
split
(
'='
,
1
)
for
line
in
out
.
splitlines
())
if
"UnitFileState"
in
d
:
...
...
@@ -626,7 +636,7 @@ class LinuxService(Service):
if
self
.
enable_cmd
.
endswith
(
"rc-update"
):
args
=
(
self
.
enable_cmd
,
add_delete
,
self
.
name
+
" "
+
self
.
runlevel
)
elif
self
.
enable_cmd
.
endswith
(
"systemctl"
):
args
=
(
self
.
enable_cmd
,
enable_disable
,
self
.
name
+
".service"
)
args
=
(
self
.
enable_cmd
,
enable_disable
,
self
.
__systemd_unit
)
else
:
args
=
(
self
.
enable_cmd
,
self
.
name
,
on_off
)
...
...
@@ -650,7 +660,7 @@ class LinuxService(Service):
else
:
# systemd commands take the form <cmd> <action> <name>
svc_cmd
=
self
.
svc_cmd
arguments
=
"
%
s
%
s"
%
(
self
.
name
,
arguments
)
arguments
=
"
%
s
%
s"
%
(
self
.
__systemd_unit
,
arguments
)
elif
self
.
svc_initscript
:
# upstart
svc_cmd
=
"
%
s"
%
self
.
svc_initscript
...
...
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