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
e7816dd6
Commit
e7816dd6
authored
Jan 16, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Desactivate public computer if it didn't contact for more than 10 minutes.
parent
d053716e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
...ins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
+3
-0
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
...bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
+17
-1
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
No files found.
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Computer_checkAndUpdateCapacityScope.xml
View file @
e7816dd6
...
...
@@ -87,6 +87,9 @@ if can_allocate:\n
can_allocate = False\n
comment = \'Computer reported an error\'\n
# XXX TODO: compare creation date of #ok message\n
elif int(DateTime()) - int(DateTime(log_dict.get(\'created_at\'))) > 600:\n
can_allocate = False\n
comment = "Computer didn\'t contact for more than 10 minutes"\n
\n
if can_allocate:\n
# Check the computer capacity.\n
...
...
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
View file @
e7816dd6
...
...
@@ -8,6 +8,7 @@ import json
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
Products.ERP5Type.DateUtils
import
addToDate
from
App.Common
import
rfc1123_date
class
TestSlapOSCorePromiseSlapOSModuleIdGeneratorAlarm
(
testSlapOSMixin
):
def
test_Module_assertIdGenerator
(
self
):
...
...
@@ -1067,7 +1068,8 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
[
self
.
computer
.
getReference
()]
=
json
.
dumps
({
'text'
:
'#access ok'
'text'
:
'#access ok'
,
'created_at'
:
rfc1123_date
(
DateTime
())
})
transaction
.
commit
()
...
...
@@ -1075,6 +1077,20 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
self
.
computer
.
getCapacityScope
())
def
test_Computer_checkAndUpdateCapacityScope_with_old_access
(
self
):
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
plugin_path
=
'portal_memcached/default_memcached_plugin'
)
memcached_dict
[
self
.
computer
.
getReference
()]
=
json
.
dumps
({
'text'
:
'#access ok'
,
'created_at'
:
rfc1123_date
(
addToDate
(
DateTime
(),
to_add
=
{
'minute'
:
-
11
}))
})
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'close'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
"Computer didn't contact for more than 10 minutes"
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
def
test_Computer_checkAndUpdateCapacityScope_no_capacity_quantity
(
self
):
self
.
_makeTree
()
self
.
computer
.
edit
(
capacity_quantity
=
1
)
...
...
master/bt5/slapos_cloud/bt/revision
View file @
e7816dd6
268
\ No newline at end of file
269
\ No newline at end of file
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