Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
3b7416ea
Commit
3b7416ea
authored
Jan 24, 2025
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slap/slap.py: error, started, stopped, destroyed
parent
52fec046
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
23 deletions
+51
-23
slapos/slap/slap.py
slapos/slap/slap.py
+51
-23
No files found.
slapos/slap/slap.py
View file @
3b7416ea
...
...
@@ -190,13 +190,19 @@ class SoftwareRelease(SlapDocument):
return
self
.
_software_release
def
error
(
self
,
error_log
,
logger
=
None
):
# Does not follow interface
try
:
# Does not follow interface
self
.
_connection_helper
.
POST
(
'softwareReleaseError'
,
data
=
{
'url'
:
self
.
getURI
(),
'computer_id'
:
self
.
getComputerId
(),
'error_log'
:
error_log
})
except
Exception
:
self
.
_connection_helper
.
callJsonRpcAPI
(
'slapos.put.software_installation'
,
{
'url'
:
self
.
getURI
(),
'computer_id'
:
self
.
getComputerId
(),
'error_log'
:
error_log
}
)
except
(
RequestException
,
ConnectionError
):
# Do not block the caller if the connection
# to the slapos master fails
(
logger
or
fallback_logger
).
exception
(
''
)
def
available
(
self
):
...
...
@@ -533,30 +539,52 @@ class ComputerPartition(SlapRequester):
return
self
.
_requestComputerPartition
(
request_dict
)
def
destroyed
(
self
):
self
.
_connection_helper
.
POST
(
'destroyedComputerPartition'
,
data
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
(),
})
self
.
_connection_helper
.
callJsonRpcAPI
(
'slapos.put.software_instance'
,
{
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"destroyed"
,
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
()
}
)
def
started
(
self
):
self
.
_connection_helper
.
POST
(
'startedComputerPartition'
,
data
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
(),
})
self
.
_connection_helper
.
callJsonRpcAPI
(
'slapos.put.software_instance'
,
{
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"started"
,
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
()
}
)
def
stopped
(
self
):
self
.
_connection_helper
.
POST
(
'stoppedComputerPartition'
,
data
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
(),
})
self
.
_connection_helper
.
callJsonRpcAPI
(
'slapos.put.software_instance'
,
{
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"stopped"
,
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
()
}
)
def
error
(
self
,
error_log
,
logger
=
None
):
try
:
self
.
_connection_helper
.
POST
(
'softwareInstanceError'
,
data
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
(),
'error_log'
:
error_log
})
except
Exception
:
self
.
_connection_helper
.
callJsonRpcAPI
(
'slapos.put.software_instance'
,
{
"portal_type"
:
"Software Instance"
,
"status_message"
:
str
(
error_log
),
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
()
}
)
except
(
RequestException
,
ConnectionError
):
# Do not block the caller if the connection
# to the slapos master fails
(
logger
or
fallback_logger
).
exception
(
''
)
def
bang
(
self
,
message
):
...
...
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