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
Nicolas Wavrant
slapos.core
Commits
3244ebb0
Commit
3244ebb0
authored
Sep 17, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: Use helper script rather them repeat the API from memcached
parent
0ee7f875
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
8 additions
and
27 deletions
+8
-27
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkSoftwareInstallationState.py
...crm_monitoring/Computer_checkSoftwareInstallationState.py
+1
-5
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkState.py
...portal_skins/slapos_crm_monitoring/Computer_checkState.py
+1
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_hasContactedRecently.py
...ns/slapos_crm_monitoring/Computer_hasContactedRecently.py
+1
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstallation_hasReportedError.py
...s_crm_monitoring/SoftwareInstallation_hasReportedError.py
+1
-4
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_hasReportedError.py
...lapos_crm_monitoring/SoftwareInstance_hasReportedError.py
+3
-6
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
...slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
+1
-4
No files found.
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkSoftwareInstallationState.py
View file @
3244ebb0
...
...
@@ -10,7 +10,6 @@ if portal.ERP5Site_isSupportRequestCreationClosed():
if
context
.
getMonitorScope
()
==
"disabled"
:
return
software_installation_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
context
.
getUid
(),
...
...
@@ -23,10 +22,7 @@ computer_reference = context.getReference()
computer_title
=
context
.
getTitle
()
should_notify
=
True
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
tolerance
=
DateTime
()
-
0.5
for
software_installation
in
software_installation_list
:
should_notify
=
False
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkState.py
View file @
3244ebb0
...
...
@@ -21,10 +21,7 @@ description = ""
should_notify
=
True
last_contact
=
"No Contact Information"
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
d
=
memcached_dict
[
reference
]
d
=
json
.
loads
(
d
)
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_hasContactedRecently.py
View file @
3244ebb0
...
...
@@ -7,10 +7,7 @@ if (now_date - computer.getCreationDate()) < maximum_days:
# This computer was created recently skip
return
True
memcached_dict
=
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
# Check if there is some information in memcached
try
:
d
=
memcached_dict
[
computer
.
getReference
()]
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstallation_hasReportedError.py
View file @
3244ebb0
from
DateTime
import
DateTime
import
json
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_hasReportedError.py
View file @
3244ebb0
from
DateTime
import
DateTime
import
json
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
if
context
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
is
not
None
:
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
...
...
@@ -15,12 +12,12 @@ if context.getAggregateValue(portal_type="Computer Partition") is not None:
d
=
json
.
loads
(
d
)
result
=
d
[
'text'
]
last_contact
=
DateTime
(
d
.
get
(
'created_at'
))
# Optimise by checking memcache information first.
if
result
.
startswith
(
'#error '
):
return
result
#last_contact = DateTime(d.get('created_at'))
# XXX time limit of 48 hours for run at least once.
if
include_message
:
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SupportRequest_recheckMonitoring.py
View file @
3244ebb0
...
...
@@ -17,10 +17,7 @@ if document is None:
return
True
aggregate_portal_type
=
document
.
getPortalType
()
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
if
aggregate_portal_type
==
"Computer"
:
try
:
...
...
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