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
Thomas Gambier
slapos.core
Commits
b0223fd4
Commit
b0223fd4
authored
Apr 08, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Use monitor scope instead allocation scope to generate tickets
parent
cd350882
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
24 deletions
+32
-24
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkComputerState.py
...l_skins/slapos_crm_monitoring/Alarm_checkComputerState.py
+8
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkHostingSubscriptionState.py
...pos_crm_monitoring/Alarm_checkHostingSubscriptionState.py
+10
-0
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkSoftwareInstallationState.py
...os_crm_monitoring/Alarm_checkSoftwareInstallationState.py
+7
-6
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_checkSoftwareInstanceState.py
...itoring/HostingSubscription_checkSoftwareInstanceState.py
+5
-7
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringComputerState.py
...onitoring/SupportRequest_updateMonitoringComputerState.py
+2
-4
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkComputerState.py
View file @
b0223fd4
portal
=
context
.
getPortalObject
()
public_category_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/public"
,
None
).
getUid
()
friend_category_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/friend"
,
None
).
getUid
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
if
None
not
in
[
friend_category_uid
,
public_category_uid
]
:
if
monitor_enabled_category
is
not
None
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Computer'
,
validation_state
=
'validated'
,
default_
allocation_scope_uid
=
[
public_category_uid
,
friend_category_uid
]
,
default_
monitor_scope_uid
=
monitor_enabled_category
.
getUid
()
,
method_id
=
'Computer_checkState'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkHostingSubscriptionState.py
View file @
b0223fd4
portal
=
context
.
getPortalObject
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop verification if there are too much tickets
return
monitor_disabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/disabled"
,
None
)
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
NegatedQuery
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Hosting Subscription'
,
validation_state
=
'validated'
,
default_monitor_scope_uid
=
NegatedQuery
(
Query
(
monitor_disabled_category
.
getUid
())),
method_id
=
'HostingSubscription_checkSoftwareInstanceState'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Alarm_checkSoftwareInstallationState.py
View file @
b0223fd4
portal
=
context
.
getPortalObject
()
public_category_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/public"
,
None
).
getUid
()
friend_category_uid
=
portal
.
restrictedTraverse
(
"portal_categories/allocation_scope/open/friend"
,
None
).
getUid
()
if
portal
.
ERP5Site_isSupportRequestCreationClosed
():
# Stop process alarm if there are too many tickets
return
monitor_enabled_category
=
portal
.
restrictedTraverse
(
"portal_categories/monitor_scope/enabled"
,
None
)
if
None
not
in
[
friend_category_uid
,
public_category_uid
]
:
if
monitor_enabled_category
is
not
None
:
portal
.
portal_catalog
.
searchAndActivate
(
portal_type
=
'Computer'
,
validation_state
=
'validated'
,
default_
allocation_scope_uid
=
[
public_category_uid
,
friend_category_uid
]
,
default_
monitor_scope_uid
=
monitor_enabled_category
.
getUid
()
,
method_id
=
'Computer_checkSoftwareInstallationState'
,
activate_kw
=
{
'tag'
:
tag
}
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/HostingSubscription_checkSoftwareInstanceState.py
View file @
b0223fd4
...
...
@@ -18,8 +18,10 @@ if (date_check_limit - hosting_subscription.Base_getCachedCreationDate()) < 0:
# Too early to check
return
software_instance_list
=
hosting_subscription
.
getSpecialiseRelatedValueList
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
])
software_instance_list
=
context
.
portal_catalog
(
portal_type
=
[
"Software Instance"
,
"Slave Instance"
],
specialise_uid
=
hosting_subscription
.
getUid
(),
**
{
"slapos_item.slap_state"
:
[
"start_requested"
]})
has_newest_allocated_instance
=
False
has_unallocated_instance
=
False
...
...
@@ -27,9 +29,6 @@ failing_instance = None
# Check if at least one software Instance is Allocated
for
instance
in
software_instance_list
:
if
instance
.
getSlapState
()
not
in
[
"start_requested"
,
"stop_requested"
]:
continue
if
(
date_check_limit
-
instance
.
Base_getCachedCreationDate
())
<
0
:
continue
...
...
@@ -37,8 +36,7 @@ for instance in software_instance_list:
if
computer_partition
is
not
None
:
has_newest_allocated_instance
=
True
if
instance
.
getPortalType
()
==
"Software Instance"
and
\
computer_partition
.
getParentValue
().
getAllocationScope
()
in
[
"open/friend"
,
"open/public"
]
and
\
instance
.
getSlapState
()
==
"start_requested"
and
\
computer_partition
.
getParentValue
().
getMonitorScope
()
==
"enabled"
and
\
instance
.
SoftwareInstance_hasReportedError
():
return
context
.
HostingSubscription_createSupportRequestEvent
(
instance
,
'slapos-crm-hosting-subscription-instance-state.notification'
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_updateMonitoringComputerState.py
View file @
b0223fd4
from
DateTime
import
DateTime
import
json
from
Products.ERP5Type.DateUtils
import
addToDate
portal
=
context
.
getPortalObject
()
if
context
.
getSimulationState
()
==
"invalidated"
:
return
computer
=
context
.
getAggregateValue
()
computer
=
context
.
getAggregateValue
(
portal_type
=
"Computer"
)
if
computer
is
not
None
and
computer
.
getPortalType
()
==
"Computer"
:
if
computer
is
not
None
:
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
...
...
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