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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
ac424d91
Commit
ac424d91
authored
Dec 04, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: fixes and tests for SLA related tickets.
parent
035e7b8b
Pipeline
#38410
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
398 additions
and
200 deletions
+398
-200
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_getReportedErrorDict.py
...s_crm_monitoring/SoftwareInstance_getReportedErrorDict.py
+34
-33
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
...rtal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
+364
-167
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_getReportedErrorDict.py
View file @
ac424d91
...
...
@@ -50,8 +50,15 @@ if context.getPortalType() == 'Slave Instance' and compute_node.getPortalType()
sla_dict
=
context
.
getSlaXmlAsDict
()
instance_sla_error_list
=
[]
instance_project_reference
=
context
.
getFollowUpReference
()
project_reference
=
compute_node
.
getFollowUpReference
()
if
project_reference
!=
instance_project_reference
:
instance_sla_error_list
.
append
(
"Instance and Compute node project do not match on: %s (%s != %s)"
%
(
context
.
getTitle
(),
project_reference
,
instance_project_reference
))
if
sla_dict
:
instance_sla_error_list
=
[]
instance_title
=
context
.
getTitle
()
# Simple check of instance SLAs
if
"computer_guid"
in
sla_dict
:
...
...
@@ -60,21 +67,18 @@ if sla_dict:
instance_sla_error_list
.
append
(
'computer_guid do not match on: %s (%s != %s)'
%
(
instance_title
,
computer_guid
,
compute_node
.
getReference
()))
if
"instance_guid"
in
sla_dict
:
instance_guid
=
sla_dict
.
pop
(
"instance_guid"
)
if
context
.
getPortalType
()
!=
'Slave Instance'
:
instance_sla_error_list
.
append
(
'instance_guid is provided to a Software Instance: %s'
%
instance_title
)
if
"instance_guid"
in
sla_dict
:
instance_guid
=
sla_dict
.
pop
(
"instance_guid"
)
if
context
.
getPortalType
()
!=
'Slave Instance'
:
instance_sla_error_list
.
append
(
'instance_guid is provided to a Software Instance: %s'
%
instance_title
)
else
:
if
compute_node
.
getPortalType
()
==
"Remote Node"
:
instance_sla_error_list
.
append
(
'instance_guid provided on %s and it is allocated on a REMOTE NODE'
%
instance_title
)
else
:
if
compute_node
.
getPortalType
()
==
"Remote Node"
:
instance_sla_error_list
.
append
(
'instance_guid provided on %s and it is allocated on a REMOTE NODE'
%
instance_title
)
else
:
software_instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
if
software_instance
is
None
:
instance_sla_error_list
.
append
(
'instance_guid provided on %s but no Software Instance was found'
%
instance_title
)
else
:
if
software_instance
.
getReference
()
!=
instance_guid
:
instance_sla_error_list
.
append
(
'instance_guid do not match on: %s (%s != %s)'
%
(
instance_title
,
instance_guid
,
software_instance
.
getReference
()))
software_instance
=
compute_partition
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
if
software_instance
is
not
None
and
software_instance
.
getReference
()
!=
instance_guid
:
instance_sla_error_list
.
append
(
'instance_guid do not match on: %s (%s != %s)'
%
(
instance_title
,
instance_guid
,
software_instance
.
getReference
()))
if
'network_guid'
in
sla_dict
:
network_guid
=
sla_dict
.
pop
(
'network_guid'
)
...
...
@@ -83,31 +87,28 @@ if sla_dict:
instance_sla_error_list
.
append
(
'network_guid do not match on: %s (%s != %s)'
%
(
instance_title
,
network_guid
,
network_reference
))
project_reference
=
compute_node
.
getFollowUpReference
()
if
'project_guid'
in
sla_dict
:
project_guid
=
sla_dict
.
pop
(
"project_guid"
)
if
project_reference
!=
project_guid
:
instance_sla_error_list
.
append
(
'project_guid do not match on: %s (%s != %s)'
%
(
instance_title
,
project_guid
,
project_reference
))
instance_project_reference
=
context
.
getFollowUpReference
()
if
project_reference
!=
instance_project_reference
:
instance_sla_error_list
.
append
(
"Instance and Compute node project don't match on: %s (%s != %s)"
%
(
instance_title
,
project_reference
,
instance_project_reference
))
if
instance_sla_error_list
:
# Slave instance is allocated but the software instance was already destroyed
error_dict
[
'notification_message_reference'
]
=
'slapos-crm-instance-tree-has-invalid-sla.notification'
error_dict
=
updateErrorDictWithError
(
error_dict
)
error_text
=
""
for
_e
in
instance_sla_error_list
:
error_text
+=
" * %s
\
n
"
%
_e
if
instance_sla_error_list
:
# Slave instance is allocated but the software instance was already destroyed
error_dict
[
'notification_message_reference'
]
=
'slapos-crm-instance-tree-has-invalid-sla.notification'
error_dict
=
updateErrorDictWithError
(
error_dict
)
error_text
=
""
for
_e
in
instance_sla_error_list
:
error_text
+=
" * %s
\
n
"
%
_e
error_dict
[
'error_text'
]
=
error_text
error_dict
[
'ticket_description'
]
=
"%s has invalid Service Level Aggrement."
%
instance_title
error_dict
[
'message'
]
=
"%s Detected inconsistencies:
\
n
%s"
%
(
error_text
,
error_dict
[
'ticket_description'
])
return
error_dict
error_dict
[
'error_text'
]
=
error_text
error_dict
[
'ticket_description'
]
=
"""%s has invalid Service Level Aggrement.
Detected inconsistencies:
%s"""
%
(
instance_title
,
error_text
)
error_dict
[
'message'
]
=
error_dict
[
'ticket_description'
]
return
error_dict
# Skip to check if monitor disabled on the compute node.
# Remote node has no state.
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMMonitoringAlarm.py
View file @
ac424d91
This diff is collapsed.
Click to expand it.
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