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
c37434ae
Commit
c37434ae
authored
Jan 26, 2024
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change parameters. Add `serious_services` and `autostart_services`.
parent
95a2a43e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
20 deletions
+32
-20
slapos-theia
slapos-theia
+32
-20
No files found.
slapos-theia
View file @
c37434ae
...
...
@@ -17,10 +17,14 @@ part_id = os.getenv('OCF_RESKEY_part_id')
slappart
=
'slappart%s'
%
part_id
slappart_b
=
slappart
.
encode
(
'utf8'
)
slapuser
=
'slapuser%s'
%
part_id
service_list
=
[]
services_text
=
os
.
getenv
(
'OCF_RESKEY_services'
,
None
)
if
services_text
:
service_list
=
services_text
.
split
(
','
)
serious_service_list
=
[]
serious_services_text
=
os
.
getenv
(
'OCF_RESKEY_serious_services'
,
None
)
if
serious_services_text
:
serious_service_list
=
serious_services_text
.
split
(
','
)
autostart_service_list
=
[]
autostart_services_text
=
os
.
getenv
(
'OCF_RESKEY_autostart_services'
,
None
)
if
autostart_services_text
:
autostart_service_list
=
autostart_services_text
.
split
(
','
)
#kumofs_gateway,kumofs_manager,kumofs_server,mariadb,zeo,zope,haproxy
...
...
@@ -61,27 +65,25 @@ def checkAppStatus(target_status):
return
True
else
:
return
False
error_list
=
[]
service_status_dict
=
{}
for
service
in
service_list
:
service_status_dict
[
service
]
=
[]
service_data_list
=
[]
for
line
in
completed_process
.
stdout
.
split
(
b'
\
n
'
):
if
not
line
:
continue
split_line
=
splitLine
(
line
)
if
split_line
[
0
].
decode
(
'utf8'
)
==
'watchdog'
:
continue
service_id
=
split_line
[
0
].
decode
(
'utf8'
)
service_name
=
split_line
[
0
].
split
(
b':'
)[
1
].
split
(
b'-'
)[
0
].
decode
(
'utf8'
)
current_status
=
split_line
[
1
].
decode
(
'utf8'
)
if
service_name
in
service_status_dict
:
service_status_dict
[
service_name
].
append
(
current_status
)
service_data_list
.
append
((
service_id
,
service_name
,
current_status
))
for
service_id
,
service_name
,
current_status
in
service_data_list
:
if
service_name
in
serious_service_list
:
if
current_status
!=
target_status
:
error_list
.
append
(
line
)
if
error_list
:
return
False
for
service
in
service_status_dict
:
if
set
(
service_status_dict
[
service
])
!=
set
([
target_status
]):
return
False
return
False
if
target_status
==
'RUNNING'
and
autostart_service_list
:
for
service_id
,
service_name
,
current_status
in
service_data_list
:
if
current_status
==
'EXITED'
and
service_name
in
autostart_service_list
:
runSlapOSInTheia
(
'node'
,
'start'
,
service_id
)
return
True
def
isAppRunning
():
...
...
@@ -157,11 +159,21 @@ Computer Partition ID, slappartX
<shortdesc>Partition ID</shortdesc>
<content type="integer"/>
</parameter>
<parameter name="services" unique="0" required="1">
<parameter name="serious_services" unique="0" required="0">
<longdesc>
Serious service names separated by comma
If serious service fails, then this resource is considered as failed.
</longdesc>
<shortdesc>Serious service names</shortdesc>
<content type="string"/>
</parameter>
<parameter name="autostart_services" unique="0" required="0">
<longdesc>
Service names separated by comma
Auto-start service names separated by comma
If auto-start service becomes `EXITED`, then `slapos node start` is executed
automatically and it is not considered as failed.
</longdesc>
<shortdesc>
S
ervice names</shortdesc>
<shortdesc>
Auto-start s
ervice names</shortdesc>
<content type="string"/>
</parameter>
</parameters>
...
...
@@ -169,7 +181,7 @@ Service names separated by comma
<actions>
<action name="start" timeout="60s" />
<action name="stop" timeout="60s" />
<action name="monitor" depth="0" timeout="
2
0s" interval="60s" />
<action name="monitor" depth="0" timeout="
3
0s" interval="60s" />
<action name="meta-data" timeout="5s" />
</actions>
</resource-agent>
...
...
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