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
18d9fc58
Commit
18d9fc58
authored
Feb 13, 2013
by
Hubert Feyrer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for NetBSD. Tested on NetBSD 6.0/i386.
parent
e2158b66
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
0 deletions
+59
-0
library/service
+59
-0
No files found.
library/service
View file @
18d9fc58
...
...
@@ -552,6 +552,65 @@ class OpenBsdService(Service):
return
self
.
execute_command
(
"
%
s
%
s"
%
(
self
.
svc_cmd
,
self
.
action
))
# ===========================================
# Subclass: NetBSD
class
NetBsdService
(
Service
):
"""
This is the NetBSD Service manipulation class - it uses the /etc/rc.conf
file for controlling services started at boot, check status and perform
direct service manipulation. Init scripts in /etc/rcd are used for
controlling services (start/stop) as well as for controlling the current
state.
"""
platform
=
'NetBSD'
distribution
=
None
def
get_service_tools
(
self
):
initpaths
=
[
'/etc/rc.d'
]
# better: $rc_directories - how to get in here? Run: sh -c '. /etc/rc.conf ; echo $rc_directories'
for
initdir
in
initpaths
:
initscript
=
"
%
s/
%
s"
%
(
initdir
,
self
.
name
)
if
os
.
path
.
isfile
(
initscript
):
self
.
svc_initscript
=
initscript
if
not
self
.
svc_initscript
:
self
.
module
.
fail_json
(
msg
=
'unable to find rc.d script'
)
def
service_enable
(
self
):
if
self
.
enable
:
self
.
rcconf_value
=
"YES"
else
:
self
.
rcconf_value
=
"NO"
rcfiles
=
[
'/etc/rc.conf'
]
# Overkill?
for
rcfile
in
rcfiles
:
if
os
.
path
.
isfile
(
rcfile
):
self
.
rcconf_file
=
rcfile
self
.
rcconf_key
=
"
%
s"
%
self
.
name
return
self
.
service_enable_rcconf
()
def
get_service_status
(
self
):
self
.
svc_cmd
=
"
%
s"
%
self
.
svc_initscript
rc
,
stdout
,
stderr
=
self
.
execute_command
(
"
%
s
%
s"
%
(
self
.
svc_cmd
,
'onestatus'
))
if
rc
==
1
:
self
.
running
=
False
elif
rc
==
0
:
self
.
running
=
True
def
service_control
(
self
):
if
self
.
action
is
"start"
:
self
.
action
=
"onestart"
if
self
.
action
is
"stop"
:
self
.
action
=
"onestop"
self
.
svc_cmd
=
"
%
s"
%
self
.
svc_initscript
return
self
.
execute_command
(
"
%
s
%
s"
%
(
self
.
svc_cmd
,
self
.
action
))
# ===========================================
# Main control flow
def
main
():
...
...
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