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
Lu Xu
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 @@
...
@@ -25,6 +25,7 @@
#
#
##############################################################################
##############################################################################
from
Products.ERP5Type.TransactionalVariable
import
getTransactionalVariable
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
setSecurityManager
,
newSecurityManager
from
Products.ERP5Security
import
SUPER_USER
from
Products.ERP5Security
import
SUPER_USER
...
@@ -283,6 +284,13 @@ def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
...
@@ -283,6 +284,13 @@ def Computer_checkComputeNodeMigrationConsistency(self, fixit=False):
return
error_list
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
):
def
Base_updateRelatedContentWithoutReindextion
(
self
,
previous_category_url
,
new_category_url
,
REQUEST
=
None
):
""" This method indeed reimplements the updateRelatedContent but it uses
""" 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 @@
...
@@ -6,12 +6,6 @@
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<item>
<key>
<string>
default_reference
</string>
</key>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSCloud
</string>
</value>
<value>
<string>
SlapOSCloud
</string>
</value>
...
@@ -55,28 +49,13 @@
...
@@ -55,28 +49,13 @@
<item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<key>
<string>
workflow_history
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
I
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<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>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
</pickle>
...
@@ -89,7 +68,7 @@
...
@@ -89,7 +68,7 @@
<item>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
Q
=
</string>
</persistent>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAA
M
=
</string>
</persistent>
</value>
</value>
</item>
</item>
</dictionary>
</dictionary>
...
@@ -98,7 +77,7 @@
...
@@ -98,7 +77,7 @@
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
<record
id=
"
4"
aka=
"AAAAAAAAAAQ
="
>
<record
id=
"
3"
aka=
"AAAAAAAAAAM
="
>
<pickle>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.Workflow"
/>
</pickle>
</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 @@
...
@@ -20,7 +20,6 @@
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
import
transaction
import
transaction
from
unittest
import
expectedFailure
from
time
import
sleep
from
time
import
sleep
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
...
@@ -441,7 +440,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
...
@@ -441,7 +440,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
@
expectedFailure
def
test_request_tree_change_same_transaction
(
self
):
def
test_request_tree_change_same_transaction
(
self
):
"""Checks tree change forced by request
"""Checks tree change forced by request
...
@@ -706,7 +704,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
...
@@ -706,7 +704,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
self
.
assertRaises
(
NotImplementedError
,
B_instance
.
requestInstance
,
**
request_kw
)
**
request_kw
)
@
expectedFailure
def
test_request_tree_change_same_transaction_shared
(
self
):
def
test_request_tree_change_same_transaction_shared
(
self
):
"""Checks tree change forced by request
"""Checks tree change forced by request
...
@@ -1160,7 +1157,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
...
@@ -1160,7 +1157,6 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflowTransfer(SlapOSTestCaseMixin):
self
.
assertTrue
(
serial
in
self
.
software_instance
.
getSslCertificate
())
self
.
assertTrue
(
serial
in
self
.
software_instance
.
getSslCertificate
())
self
.
assertTrue
(
certificate_login
.
getReference
()
in
\
self
.
assertTrue
(
certificate_login
.
getReference
()
in
\
self
.
software_instance
.
getSslCertificate
().
decode
(
'string_escape'
))
self
.
software_instance
.
getSslCertificate
().
decode
(
'string_escape'
))
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
generateCertificate
)
self
.
assertRaises
(
ValueError
,
self
.
software_instance
.
generateCertificate
)
def
test_revokeCertificate
(
self
):
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:
...
@@ -30,7 +30,7 @@ else:
# Prevent creating two instances with the same title
# Prevent creating two instances with the same title
instance_tree
.
serialize
()
instance_tree
.
serialize
()
tag
=
"%s_%s_inProgress"
%
(
instance_tree
.
getUid
(),
software_title
)
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
# 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
# As it is not possible to fetch informations, it is better to raise an error
raise
NotImplementedError
(
tag
)
raise
NotImplementedError
(
tag
)
...
@@ -137,6 +137,7 @@ if instance_found:
...
@@ -137,6 +137,7 @@ if instance_found:
}
}
request_software_instance_url
=
request_software_instance
.
getRelativeUrl
()
request_software_instance_url
=
request_software_instance
.
getRelativeUrl
()
context
.
REQUEST
.
set
(
'request_instance'
,
request_software_instance
)
context
.
REQUEST
.
set
(
'request_instance'
,
request_software_instance
)
context
.
Base_setTransactionalTag
(
tag
)
if
(
root_state
==
"started"
):
if
(
root_state
==
"started"
):
request_software_instance
.
requestStart
(
**
promise_kw
)
request_software_instance
.
requestStart
(
**
promise_kw
)
elif
(
root_state
==
"stopped"
):
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