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
0
Merge Requests
0
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
Léo-Paul Géneau
slapos.core
Commits
0f2c82f5
Commit
0f2c82f5
authored
Aug 31, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_cloud&crm: Check before call workflow API
See merge request
nexedi/slapos.core!413
parents
16752b7f
3c192583
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
210 additions
and
34 deletions
+210
-34
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSupportRequestInProgress.py
...al_skins/slapos_cloud/Base_getSupportRequestInProgress.py
+9
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSupportRequestInProgress.xml
...l_skins/slapos_cloud/Base_getSupportRequestInProgress.xml
+62
-0
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_notify.py
...ow/person_slap_interface_workflow/script_Person_notify.py
+3
-5
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkAndUpdateAllocationScope.py
...m_monitoring/ComputeNode_checkAndUpdateAllocationScope.py
+13
-5
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkSoftwareInstallationState.py
..._monitoring/ComputeNode_checkSoftwareInstallationState.py
+17
-6
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
...tal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
+16
-5
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/InstanceTree_createSupportRequestEvent.py
..._crm_monitoring/InstanceTree_createSupportRequestEvent.py
+17
-6
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_getLastEvent.py
...kins/slapos_crm_monitoring/SupportRequest_getLastEvent.py
+6
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_getLastEvent.xml
...ins/slapos_crm_monitoring/SupportRequest_getLastEvent.xml
+62
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringDestroyRequestedState.py
...g/SupportRequest_updateMonitoringDestroyRequestedState.py
+4
-2
master/bt5/slapos_crm/WorkflowTemplateItem/portal_workflow/ticket_slap_interface_workflow/script_Ticket_notify.py
...ow/ticket_slap_interface_workflow/script_Ticket_notify.py
+1
-5
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSupportRequestInProgress.py
0 → 100644
View file @
0f2c82f5
portal
=
context
.
getPortalObject
()
aggregate_value
=
portal
.
restrictedTraverse
(
aggregate
)
return
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Support Request'
,
title
=
title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
],
default_aggregate_uid
=
aggregate_value
.
getUid
(),
)
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getSupportRequestInProgress.xml
0 → 100644
View file @
0f2c82f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title, aggregate
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getSupportRequestInProgress
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_notify.py
View file @
0f2c82f5
...
...
@@ -15,11 +15,9 @@ except KeyError:
aggregate_value
=
portal
.
restrictedTraverse
(
aggregate
)
support_request_in_progress
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Support Request'
,
title
=
support_request_title
,
simulation_state
=
[
"validated"
,
"submitted"
,
"suspended"
],
default_aggregate_uid
=
aggregate_value
.
getUid
(),
support_request_in_progress
=
person
.
Base_getSupportRequestInProgress
(
title
=
support_request_title
,
aggregate
=
aggregate
)
if
support_request_in_progress
is
not
None
:
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkAndUpdateAllocationScope.py
View file @
0f2c82f5
...
...
@@ -29,12 +29,18 @@ request_title = 'Allocation scope of %s changed to %s' % (compute_node_reference
request_description
=
'Allocation scope has been changed to '
\
'%s for %s'
%
(
target_allocation_scope
,
compute_node_reference
)
person
.
notify
(
support_request_title
=
request_title
,
support_request
=
person
.
Base_getSupportRequestInProgress
(
title
=
request_title
,
aggregate
=
context
.
getRelativeUrl
()
)
if
support_request
is
None
:
person
.
notify
(
support_request_title
=
request_title
,
support_request_description
=
request_description
,
aggregate
=
context
.
getRelativeUrl
())
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
if
support_request
is
not
None
:
if
support_request
.
getSimulationState
()
!=
"validated"
:
...
...
@@ -54,8 +60,10 @@ if support_request is not None:
message
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
support_request
.
notify
(
message_title
=
request_title
,
message
=
message
)
event
=
support_request
.
REQUEST
.
get
(
"ticket_notified_item"
)
event
=
support_request
.
SupportRequest_getLastEvent
(
request_title
)
if
event
is
None
:
support_request
.
notify
(
message_title
=
request_title
,
message
=
message
)
event
=
support_request
.
REQUEST
.
get
(
"ticket_notified_item"
)
if
event
is
not
None
:
# event added, suspend ticket
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkSoftwareInstallationState.py
View file @
0f2c82f5
...
...
@@ -49,15 +49,23 @@ for software_installation in software_installation_list:
(
software_installation
.
getUrlString
(),
compute_node_title
,
software_installation
.
getCreationDate
())
if
should_notify
:
person
.
notify
(
support_request_title
=
ticket_title
,
support_request
=
person
.
Base_getSupportRequestInProgress
(
title
=
ticket_title
,
aggregate
=
software_installation
.
getRelativeUrl
())
if
support_request
is
None
:
person
.
notify
(
support_request_title
=
ticket_title
,
support_request_description
=
description
,
aggregate
=
software_installation
.
getRelativeUrl
())
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
return
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
return
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
if
support_request
is
None
:
return
# Send Notification message
notification_reference
=
'slapos-crm-compute_node_software_installation_state.notification'
...
...
@@ -74,7 +82,10 @@ for software_installation in software_installation_list:
message
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
event
=
support_request
.
SupportRequest_getLastEvent
(
ticket_title
)
if
event
is
None
:
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
support_request_list
.
append
(
support_request
)
return
support_request_list
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_checkState.py
View file @
0f2c82f5
...
...
@@ -31,15 +31,24 @@ else:
# Nothing to notify.
return
person
.
notify
(
support_request_title
=
ticket_title
,
support_request
=
person
.
Base_getSupportRequestInProgress
(
title
=
ticket_title
,
aggregate
=
context
.
getRelativeUrl
())
if
support_request
is
None
:
person
.
notify
(
support_request_title
=
ticket_title
,
support_request_description
=
description
,
aggregate
=
context
.
getRelativeUrl
())
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
return
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
if
support_request
is
None
:
return
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
# Send Notification message
notification_message
=
portal
.
portal_notifications
.
getDocumentValue
(
...
...
@@ -54,6 +63,8 @@ else:
message
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
event
=
support_request
.
SupportRequest_getLastEvent
(
ticket_title
)
if
event
is
None
:
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
return
support_request
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/InstanceTree_createSupportRequestEvent.py
View file @
0f2c82f5
...
...
@@ -16,15 +16,23 @@ if error_message:
else
:
error_message
=
"No message!"
person
.
notify
(
support_request_title
=
ticket_title
,
support_request
=
person
.
Base_getSupportRequestInProgress
(
title
=
ticket_title
,
aggregate
=
context
.
getRelativeUrl
())
if
support_request
is
None
:
person
.
notify
(
support_request_title
=
ticket_title
,
support_request_description
=
description
,
aggregate
=
context
.
getRelativeUrl
())
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
return
support_request_relative_url
=
context
.
REQUEST
.
get
(
"support_request_relative_url"
)
if
support_request_relative_url
is
None
:
return
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
support_request
=
portal
.
restrictedTraverse
(
support_request_relative_url
)
if
support_request
is
None
:
return
if
support_request
.
getSimulationState
()
not
in
[
"validated"
,
"suspended"
]:
support_request
.
validate
()
...
...
@@ -41,5 +49,8 @@ if notification_message is not None:
message
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
event
=
support_request
.
SupportRequest_getLastEvent
(
ticket_title
)
if
event
is
None
:
support_request
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
return
context
.
REQUEST
.
get
(
"ticket_notified_item"
)
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_getLastEvent.py
0 → 100644
View file @
0f2c82f5
portal
=
context
.
getPortalObject
()
return
portal
.
portal_catalog
.
getResultValue
(
title
=
title
,
follow_up_uid
=
context
.
getUid
(),
portal_type
=
portal
.
getPortalEventTypeList
(),
sort_on
=
[(
'delivery.start_date'
,
'DESC'
)])
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_getLastEvent.xml
0 → 100644
View file @
0f2c82f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
title
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SupportRequest_getLastEvent
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringDestroyRequestedState.py
View file @
0f2c82f5
...
...
@@ -24,8 +24,10 @@ if document is not None and document.getSlapState() == "destroy_requested":
message
=
notification_message
.
asText
(
substitution_method_parameter_dict
=
{
'mapping_dict'
:
mapping_dict
})
context
.
notify
(
message_title
=
"Instance Tree was destroyed was destroyed by the user"
,
message
=
message
)
ticket_title
=
"Instance Tree was destroyed was destroyed by the user"
event
=
context
.
SupportRequest_getLastEvent
(
ticket_title
)
if
event
is
None
:
context
.
notify
(
message_title
=
ticket_title
,
message
=
message
)
context
.
invalidate
()
return
context
.
REQUEST
.
get
(
"ticket_notified_item"
)
master/bt5/slapos_crm/WorkflowTemplateItem/portal_workflow/ticket_slap_interface_workflow/script_Ticket_notify.py
View file @
0f2c82f5
...
...
@@ -16,11 +16,7 @@ except KeyError:
resource
=
portal
.
service_module
.
slapos_crm_information
.
getRelativeUrl
()
# create Web message if needed for this ticket
last_event
=
ticket
.
portal_catalog
.
getResultValue
(
title
=
message_title
,
follow_up_uid
=
ticket
.
getUid
(),
sort_on
=
[(
'delivery.start_date'
,
'DESC'
)],
)
last_event
=
ticket
.
SupportRequest_getLastEvent
(
message_title
)
if
last_event
:
# User has already been notified for this problem.
ticket
.
REQUEST
.
set
(
"ticket_notified_item"
,
last_event
)
...
...
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