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
Show 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')
...
@@ -17,10 +17,14 @@ 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
=
[]
serious_service_list
=
[]
services_text
=
os
.
getenv
(
'OCF_RESKEY_services'
,
None
)
serious_services_text
=
os
.
getenv
(
'OCF_RESKEY_serious_services'
,
None
)
if
services_text
:
if
serious_services_text
:
service_list
=
services_text
.
split
(
','
)
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
#kumofs_gateway,kumofs_manager,kumofs_server,mariadb,zeo,zope,haproxy
...
@@ -61,27 +65,25 @@ def checkAppStatus(target_status):
...
@@ -61,27 +65,25 @@ def checkAppStatus(target_status):
return
True
return
True
else
:
else
:
return
False
return
False
error_list
=
[]
service_data_list
=
[]
service_status_dict
=
{}
for
service
in
service_list
:
service_status_dict
[
service
]
=
[]
for
line
in
completed_process
.
stdout
.
split
(
b'
\
n
'
):
for
line
in
completed_process
.
stdout
.
split
(
b'
\
n
'
):
if
not
line
:
if
not
line
:
continue
continue
split_line
=
splitLine
(
line
)
split_line
=
splitLine
(
line
)
if
split_line
[
0
].
decode
(
'utf8'
)
==
'watchdog'
:
if
split_line
[
0
].
decode
(
'utf8'
)
==
'watchdog'
:
continue
continue
service_id
=
split_line
[
0
].
decode
(
'utf8'
)
service_name
=
split_line
[
0
].
split
(
b':'
)[
1
].
split
(
b'-'
)[
0
].
decode
(
'utf8'
)
service_name
=
split_line
[
0
].
split
(
b':'
)[
1
].
split
(
b'-'
)[
0
].
decode
(
'utf8'
)
current_status
=
split_line
[
1
].
decode
(
'utf8'
)
current_status
=
split_line
[
1
].
decode
(
'utf8'
)
if
service_name
in
service_status_dict
:
service_data_list
.
append
((
service_id
,
service_name
,
current_status
))
service_status_dict
[
service_name
].
append
(
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
:
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
return
True
def
isAppRunning
():
def
isAppRunning
():
...
@@ -157,11 +159,21 @@ Computer Partition ID, slappartX
...
@@ -157,11 +159,21 @@ Computer Partition ID, slappartX
<shortdesc>Partition ID</shortdesc>
<shortdesc>Partition ID</shortdesc>
<content type="integer"/>
<content type="integer"/>
</parameter>
</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>
<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>
</longdesc>
<shortdesc>
S
ervice names</shortdesc>
<shortdesc>
Auto-start s
ervice names</shortdesc>
<content type="string"/>
<content type="string"/>
</parameter>
</parameter>
</parameters>
</parameters>
...
@@ -169,7 +181,7 @@ Service names separated by comma
...
@@ -169,7 +181,7 @@ Service names separated by comma
<actions>
<actions>
<action name="start" timeout="60s" />
<action name="start" timeout="60s" />
<action name="stop" 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" />
<action name="meta-data" timeout="5s" />
</actions>
</actions>
</resource-agent>
</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