Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
a
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yusei Tahara
a
Commits
95a2a43e
Commit
95a2a43e
authored
Jan 18, 2024
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix slapos-theia.
parent
f965e32c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
slapos-theia
slapos-theia
+17
-3
No files found.
slapos-theia
View file @
95a2a43e
...
@@ -11,11 +11,16 @@ OCF_NOT_RUNNING = 7
...
@@ -11,11 +11,16 @@ OCF_NOT_RUNNING = 7
action
=
sys
.
argv
[
1
]
action
=
sys
.
argv
[
1
]
instance_root
=
os
.
getenv
(
'OCF_RESKEY_instance_root'
)
or
''
instance_root_b
=
instance_root
.
encode
(
'utf8'
)
part_id
=
os
.
getenv
(
'OCF_RESKEY_part_id'
)
part_id
=
os
.
getenv
(
'OCF_RESKEY_part_id'
)
slappart
=
'slappart%s'
%
part_id
slappart
=
'slappart%s'
%
part_id
slappart_b
=
slappart
.
encode
(
'utf8'
)
slappart_b
=
slappart
.
encode
(
'utf8'
)
slapuser
=
'slapuser%s'
%
part_id
slapuser
=
'slapuser%s'
%
part_id
service_list
=
os
.
getenv
(
'OCF_RESKEY_services'
,
''
).
split
(
','
)
service_list
=
[]
services_text
=
os
.
getenv
(
'OCF_RESKEY_services'
,
None
)
if
services_text
:
service_list
=
services_text
.
split
(
','
)
#kumofs_gateway,kumofs_manager,kumofs_server,mariadb,zeo,zope,haproxy
#kumofs_gateway,kumofs_manager,kumofs_server,mariadb,zeo,zope,haproxy
...
@@ -46,12 +51,12 @@ def isTheiaStopped():
...
@@ -46,12 +51,12 @@ def isTheiaStopped():
def
runSlapOSInTheia
(
*
args
):
def
runSlapOSInTheia
(
*
args
):
return
runCommand
(
'sudo'
,
'-u'
,
slapuser
,
return
runCommand
(
'sudo'
,
'-u'
,
slapuser
,
'
/srv/slapgrid/%s/srv/runner/bin/slapos'
%
slappart
,
'
%s/%s/srv/runner/bin/slapos'
%
(
instance_root
,
slappart
)
,
*
args
)
*
args
)
def
checkAppStatus
(
target_status
):
def
checkAppStatus
(
target_status
):
completed_process
=
runSlapOSInTheia
(
'node'
)
completed_process
=
runSlapOSInTheia
(
'node'
)
if
completed_process
.
stdout
==
b'unix://
/srv/slapgrid/%s/srv/runner/instance/sv.sock no such file
\
n
'
%
slappart_b
:
if
completed_process
.
stdout
==
b'unix://
%s/%s/srv/runner/instance/sv.sock no such file
\
n
'
%
(
instance_root_b
,
slappart_b
)
:
if
target_status
==
'STOPPED'
:
if
target_status
==
'STOPPED'
:
return
True
return
True
else
:
else
:
...
@@ -87,6 +92,8 @@ def isAppStopped():
...
@@ -87,6 +92,8 @@ def isAppStopped():
def
monitor
():
def
monitor
():
result
=
OCF_ERR_GENERIC
result
=
OCF_ERR_GENERIC
if
not
os
.
path
.
exists
(
instance_root
):
result
=
OCF_NOT_RUNNING
try
:
try
:
if
isTheiaRunning
()
and
isAppRunning
():
if
isTheiaRunning
()
and
isAppRunning
():
result
=
OCF_SUCCESS
result
=
OCF_SUCCESS
...
@@ -136,6 +143,13 @@ This is the resource agent for SlapOS Theia.
...
@@ -136,6 +143,13 @@ This is the resource agent for SlapOS Theia.
<shortdesc lang="en">Manages SlapOS Theia instance</shortdesc>
<shortdesc lang="en">Manages SlapOS Theia instance</shortdesc>
<parameters>
<parameters>
<parameter name="instance_root" unique="0" required="1">
<longdesc>
Instance Root Directory Path
</longdesc>
<shortdesc>Instance Root</shortdesc>
<content type="string"/>
</parameter>
<parameter name="part_id" unique="1" required="1">
<parameter name="part_id" unique="1" required="1">
<longdesc>
<longdesc>
Computer Partition ID, slappartX
Computer Partition ID, slappartX
...
...
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