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
18
Merge Requests
18
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
1cfb4ab9
Commit
1cfb4ab9
authored
Dec 01, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_cloud: Raise if you duplicate the request on same transaction
remove expected failures from tests.
parent
f55a00e8
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
29 deletions
+69
-29
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
...plateItem/portal_components/extension.erp5.SlapOSCloud.py
+8
-0
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.xml
...lateItem/portal_components/extension.erp5.SlapOSCloud.xml
+3
-24
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getTransactionalTag.xml
...em/portal_skins/slapos_cloud/Base_getTransactionalTag.xml
+28
-0
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_setTransactionalTag.xml
...em/portal_skins/slapos_cloud/Base_setTransactionalTag.xml
+28
-0
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
...test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
+0
-4
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
...ap_interface_workflow/script_RequesterInstance_request.py
+2
-1
No files found.
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.py
View file @
1cfb4ab9
...
...
@@ -25,6 +25,7 @@
#
##############################################################################
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
from
Products.ERP5Security
import
SUPER_USER
...
...
@@ -283,6 +284,13 @@ def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
return
error_list
def
Base_setTransactionalTag
(
self
,
tag
,
REQUEST
=
None
):
getTransactionalVariable
()[
str
(
tag
)]
=
str
(
tag
)
def
Base_getTransactionalTag
(
self
,
tag
,
REQUEST
=
None
):
if
REQUEST
is
not
None
:
raise
Unauthorized
return
getTransactionalVariable
().
get
(
tag
,
None
)
def
Base_updateRelatedContentWithoutReindextion
(
self
,
previous_category_url
,
new_category_url
,
REQUEST
=
None
):
""" This method indeed reimplements the updateRelatedContent but it uses
...
...
master/bt5/slapos_cloud/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSCloud.xml
View file @
1cfb4ab9
...
...
@@ -6,12 +6,6 @@
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
...
...
@@ -55,28 +49,13 @@
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
...
...
@@ -89,7 +68,7 @@
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</item>
</dictionary>
...
...
@@ -98,7 +77,7 @@
</dictionary>
</pickle>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_getTransactionalTag.xml
0 → 100644
View file @
1cfb4ab9
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Base_getTransactionalTag
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getTransactionalTag
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/Base_setTransactionalTag.xml
0 → 100644
View file @
1cfb4ab9
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Base_setTransactionalTag
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_setTransactionalTag
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudInstanceSlapInterfaceWorkflow.py
View file @
1cfb4ab9
...
...
@@ -20,7 +20,6 @@
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
transaction
from
unittest
import
expectedFailure
from
time
import
sleep
from
zExceptions
import
Unauthorized
...
...
@@ -441,7 +440,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
**
request_kw
)
@
expectedFailure
def
test_request_tree_change_same_transaction
(
self
):
"""Checks tree change forced by request
...
...
@@ -706,7 +704,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
**
request_kw
)
@
expectedFailure
def
test_request_tree_change_same_transaction_shared
(
self
):
"""Checks tree change forced by request
...
...
@@ -1160,7 +1157,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self
.
assertTrue
(
serial
in
self
.
software_instance
.
getSslCertificate
())
self
.
assertTrue
(
certificate_login
.
getReference
()
in
\
self
.
software_instance
.
getSslCertificate
().
decode
(
'string_escape'
))
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
generateCertificate
)
def
test_revokeCertificate
(
self
):
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
View file @
1cfb4ab9
...
...
@@ -30,7 +30,7 @@ else:
# Prevent creating two instances with the same title
instance_tree
.
serialize
()
tag
=
"%s_%s_inProgress"
%
(
instance_tree
.
getUid
(),
software_title
)
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
):
if
(
portal
.
portal_activities
.
countMessageWithTag
(
tag
)
>
0
)
or
context
.
Base_getTransactionalTag
(
tag
)
:
# The software instance is already under creation but can not be fetched from catalog
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
...
...
@@ -137,6 +137,7 @@ if instance_found:
}
request_software_instance_url
=
request_software_instance
.
getRelativeUrl
()
context
.
REQUEST
.
set
(
'request_instance'
,
request_software_instance
)
context
.
Base_setTransactionalTag
(
tag
)
if
(
root_state
==
"started"
):
request_software_instance
.
requestStart
(
**
promise_kw
)
elif
(
root_state
==
"stopped"
):
...
...
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