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
21
Merge Requests
21
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
nexedi
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
Hide 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():
...
@@ -10,7 +10,6 @@ if portal.ERP5Site_isSupportRequestCreationClosed():
if
context
.
getMonitorScope
()
==
"disabled"
:
if
context
.
getMonitorScope
()
==
"disabled"
:
return
return
software_installation_list
=
portal
.
portal_catalog
(
software_installation_list
=
portal
.
portal_catalog
(
portal_type
=
'Software Installation'
,
portal_type
=
'Software Installation'
,
default_aggregate_uid
=
context
.
getUid
(),
default_aggregate_uid
=
context
.
getUid
(),
...
@@ -23,10 +22,7 @@ computer_reference = context.getReference()
...
@@ -23,10 +22,7 @@ computer_reference = context.getReference()
computer_title
=
context
.
getTitle
()
computer_title
=
context
.
getTitle
()
should_notify
=
True
should_notify
=
True
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
tolerance
=
DateTime
()
-
0.5
tolerance
=
DateTime
()
-
0.5
for
software_installation
in
software_installation_list
:
for
software_installation
in
software_installation_list
:
should_notify
=
False
should_notify
=
False
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/Computer_checkState.py
View file @
3244ebb0
...
@@ -21,10 +21,7 @@ description = ""
...
@@ -21,10 +21,7 @@ description = ""
should_notify
=
True
should_notify
=
True
last_contact
=
"No Contact Information"
last_contact
=
"No Contact Information"
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
try
:
try
:
d
=
memcached_dict
[
reference
]
d
=
memcached_dict
[
reference
]
d
=
json
.
loads
(
d
)
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:
...
@@ -7,10 +7,7 @@ if (now_date - computer.getCreationDate()) < maximum_days:
# This computer was created recently skip
# This computer was created recently skip
return
True
return
True
memcached_dict
=
portal
.
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
# Check if there is some information in memcached
# Check if there is some information in memcached
try
:
try
:
d
=
memcached_dict
[
computer
.
getReference
()]
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
from
DateTime
import
DateTime
import
json
import
json
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
try
:
try
:
d
=
memcached_dict
[
context
.
getReference
()]
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
except
KeyError
:
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/SoftwareInstance_hasReportedError.py
View file @
3244ebb0
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
json
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
:
if
context
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
is
not
None
:
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
try
:
try
:
d
=
memcached_dict
[
context
.
getReference
()]
d
=
memcached_dict
[
context
.
getReference
()]
except
KeyError
:
except
KeyError
:
...
@@ -15,12 +12,12 @@ if context.getAggregateValue(portal_type="Computer Partition") is not None:
...
@@ -15,12 +12,12 @@ if context.getAggregateValue(portal_type="Computer Partition") is not None:
d
=
json
.
loads
(
d
)
d
=
json
.
loads
(
d
)
result
=
d
[
'text'
]
result
=
d
[
'text'
]
last_contact
=
DateTime
(
d
.
get
(
'created_at'
))
# Optimise by checking memcache information first.
# Optimise by checking memcache information first.
if
result
.
startswith
(
'#error '
):
if
result
.
startswith
(
'#error '
):
return
result
return
result
#last_contact = DateTime(d.get('created_at'))
# XXX time limit of 48 hours for run at least once.
# XXX time limit of 48 hours for run at least once.
if
include_message
:
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:
...
@@ -17,10 +17,7 @@ if document is None:
return
True
return
True
aggregate_portal_type
=
document
.
getPortalType
()
aggregate_portal_type
=
document
.
getPortalType
()
memcached_dict
=
context
.
Base_getSlapToolMemcachedDict
()
memcached_dict
=
context
.
getPortalObject
().
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
if
aggregate_portal_type
==
"Computer"
:
if
aggregate_portal_type
==
"Computer"
:
try
:
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