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
Roque
slapos.core
Commits
a27ea9c0
Commit
a27ea9c0
authored
Apr 16, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: 2to3 -j 20 --write --nobackups --no-diffs --fix=raise master
parent
3b4d4028
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
41 additions
and
41 deletions
+41
-41
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
...simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SalePackingList_postSlapOSGeneration.py
...slapos_simulation/SalePackingList_postSlapOSGeneration.py
+1
-1
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
...rtal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
+3
-3
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
...em/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
+2
-2
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputePartitionMixin.py
...rtal_components/mixin.erp5.SlapOSComputePartitionMixin.py
+2
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToGarbageCollect.py
...kins/slapos_cloud/SoftwareInstance_tryToGarbageCollect.py
+2
-2
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToStopCollect.py
...l_skins/slapos_cloud/SoftwareInstance_tryToStopCollect.py
+2
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_allocatePartition.py
...ce_workflow/script_RequestedInstance_allocatePartition.py
+1
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_rename.py
...lap_interface_workflow/script_RequestedInstance_rename.py
+1
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateConnectionInformation.py
...w/script_RequestedInstance_updateConnectionInformation.py
+1
-1
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateParameterInformation.py
...ow/script_RequestedInstance_updateParameterInformation.py
+8
-8
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
...ap_interface_workflow/script_RequesterInstance_request.py
+3
-3
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
...ap_interface_workflow/script_Person_requestComputeNode.py
+2
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestNetwork.py
...n_slap_interface_workflow/script_Person_requestNetwork.py
+2
-2
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
...terface_workflow/script_Person_requestSoftwareInstance.py
+6
-6
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestToken.py
...son_slap_interface_workflow/script_Person_requestToken.py
+1
-1
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/script_PayzenEvent_generateNavigationPage.py
...ace_workflow/script_PayzenEvent_generateNavigationPage.py
+2
-2
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/script_WechatEvent_generateNavigationPage.py
...ace_workflow/script_WechatEvent_generateNavigationPage.py
+1
-1
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
View file @
a27ea9c0
...
@@ -7,7 +7,7 @@ from DateTime import DateTime
...
@@ -7,7 +7,7 @@ from DateTime import DateTime
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
if
related_simulation_movement_path_list
is
None
:
if
related_simulation_movement_path_list
is
None
:
raise
RuntimeError
,
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
raise
RuntimeError
(
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
)
invoice
=
context
invoice
=
context
price_currency
=
invoice
.
getPriceCurrency
()
price_currency
=
invoice
.
getPriceCurrency
()
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SalePackingList_postSlapOSGeneration.py
View file @
a27ea9c0
if
related_simulation_movement_path_list
is
None
:
if
related_simulation_movement_path_list
is
None
:
raise
RuntimeError
,
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
raise
RuntimeError
(
'related_simulation_movement_path_list is missing. Update ERP5 Product.'
)
packing_list
=
context
packing_list
=
context
...
...
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
View file @
a27ea9c0
...
@@ -48,7 +48,7 @@ class SlapOSCatalogToolCacheMixin(object):
...
@@ -48,7 +48,7 @@ class SlapOSCatalogToolCacheMixin(object):
validation_state
=
"validated"
,
validation_state
=
"validated"
,
reference
=
reference
)
reference
=
reference
)
if
len
(
compute_node_list
)
!=
1
:
if
len
(
compute_node_list
)
!=
1
:
raise
NotFound
,
"No document found with parameters: %s"
%
reference
raise
NotFound
(
"No document found with parameters: %s"
%
reference
)
else
:
else
:
return
_assertACI
(
compute_node_list
[
0
].
getObject
()).
getRelativeUrl
()
return
_assertACI
(
compute_node_list
[
0
].
getObject
()).
getRelativeUrl
()
...
@@ -88,7 +88,7 @@ class SlapOSCatalogToolCacheMixin(object):
...
@@ -88,7 +88,7 @@ class SlapOSCatalogToolCacheMixin(object):
parent_uid
=
self
.
_getNonCachedComputeNodeUid
(
parent_uid
=
self
.
_getNonCachedComputeNodeUid
(
compute_node_reference
))
compute_node_reference
))
if
len
(
compute_partition_list
)
!=
1
:
if
len
(
compute_partition_list
)
!=
1
:
raise
NotFound
,
"No document found with parameters: %s %s"
%
\
raise
NotFound
(
"No document found with parameters: %s %s"
%
\
(
compute_node_reference
,
compute_partition_reference
)
(
compute_node_reference
,
compute_partition_reference
)
)
else
:
else
:
return
_assertACI
(
compute_partition_list
[
0
].
getObject
())
return
_assertACI
(
compute_partition_list
[
0
].
getObject
())
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
View file @
a27ea9c0
...
@@ -276,8 +276,8 @@ class SlapOSComputeNodeMixin(object):
...
@@ -276,8 +276,8 @@ class SlapOSComputeNodeMixin(object):
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
elif
software_instance_count
>
1
:
elif
software_instance_count
>
1
:
# XXX do not prevent the system to work if one partition is broken
# XXX do not prevent the system to work if one partition is broken
raise
NotImplementedError
,
"Too many instances linked to %s"
%
\
raise
NotImplementedError
(
"Too many instances linked to %s"
%
\
compute_partition_document
.
getRelativeUrl
()
compute_partition_document
.
getRelativeUrl
()
)
if
software_instance
is
not
None
:
if
software_instance
is
not
None
:
state
=
software_instance
.
getSlapState
()
state
=
software_instance
.
getSlapState
()
...
...
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputePartitionMixin.py
View file @
a27ea9c0
...
@@ -98,9 +98,9 @@ class SlapOSComputePartitionMixin(object):
...
@@ -98,9 +98,9 @@ class SlapOSComputePartitionMixin(object):
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
elif
software_instance_count
>
1
:
elif
software_instance_count
>
1
:
# XXX do not prevent the system to work if one partition is broken
# XXX do not prevent the system to work if one partition is broken
raise
NotImplementedError
,
"Too many instances %s linked to %s"
%
\
raise
NotImplementedError
(
"Too many instances %s linked to %s"
%
\
([
x
.
path
for
x
in
software_instance_list
],
([
x
.
path
for
x
in
software_instance_list
],
self
.
getRelativeUrl
())
self
.
getRelativeUrl
())
)
if
software_instance
is
not
None
:
if
software_instance
is
not
None
:
state
=
software_instance
.
getSlapState
()
state
=
software_instance
.
getSlapState
()
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToGarbageCollect.py
View file @
a27ea9c0
...
@@ -11,8 +11,8 @@ if (instance.getSlapState() != "destroy_requested"):
...
@@ -11,8 +11,8 @@ if (instance.getSlapState() != "destroy_requested"):
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
is_slave
=
True
else
:
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
raise
NotImplementedError
(
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
if
requester
is
None
:
if
requester
is
None
:
# This instance has no successor (link removed) and should be trashed
# This instance has no successor (link removed) and should be trashed
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToStopCollect.py
View file @
a27ea9c0
...
@@ -16,8 +16,8 @@ if (instance_tree.getSlapState() == "stop_requested"):
...
@@ -16,8 +16,8 @@ if (instance_tree.getSlapState() == "stop_requested"):
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
is_slave
=
True
else
:
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
raise
NotImplementedError
(
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
# Buildout may not propagate the stop request
# Buildout may not propagate the stop request
requester
=
instance
.
getSuccessorRelatedValue
()
requester
=
instance
.
getSuccessorRelatedValue
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_allocatePartition.py
View file @
a27ea9c0
...
@@ -9,7 +9,7 @@ kwargs = state_change.kwargs
...
@@ -9,7 +9,7 @@ kwargs = state_change.kwargs
try
:
try
:
compute_partition_url
=
kwargs
[
'compute_partition_url'
]
compute_partition_url
=
kwargs
[
'compute_partition_url'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"RequestedInstance_allocatePartition takes exactly 1 argument"
raise
TypeError
(
"RequestedInstance_allocatePartition takes exactly 1 argument"
)
assert
instance
.
getAggregateValue
()
is
None
assert
instance
.
getAggregateValue
()
is
None
compute_partition
=
portal
.
restrictedTraverse
(
compute_partition_url
)
compute_partition
=
portal
.
restrictedTraverse
(
compute_partition_url
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_rename.py
View file @
a27ea9c0
...
@@ -26,7 +26,7 @@ request_software_instance_list = portal.portal_catalog(
...
@@ -26,7 +26,7 @@ request_software_instance_list = portal.portal_catalog(
limit
=
1
,
limit
=
1
,
)
)
if
len
(
request_software_instance_list
)
==
1
:
if
len
(
request_software_instance_list
)
==
1
:
raise
ValueError
,
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
]
)
raise
ValueError
(
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
])
)
# Change the title
# Change the title
previous_title
=
instance
.
getTitle
()
previous_title
=
instance
.
getTitle
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateConnectionInformation.py
View file @
a27ea9c0
...
@@ -4,7 +4,7 @@ instance = state_change['object']
...
@@ -4,7 +4,7 @@ instance = state_change['object']
try
:
try
:
connection_xml
=
state_change
.
kwargs
[
'connection_xml'
]
connection_xml
=
state_change
.
kwargs
[
'connection_xml'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
raise
TypeError
(
"RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
)
edit_kw
=
{
edit_kw
=
{
'connection_xml'
:
connection_xml
,
'connection_xml'
:
connection_xml
,
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateParameterInformation.py
View file @
a27ea9c0
...
@@ -11,7 +11,7 @@ try:
...
@@ -11,7 +11,7 @@ try:
sla_xml
=
kwargs
[
"sla_xml"
]
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
is_slave
=
kwargs
[
"shared"
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateParameterInformation takes exactly 5 arguments"
raise
TypeError
(
"RequestedInstance_updateParameterInformation takes exactly 5 arguments"
)
edit_kw
=
{
edit_kw
=
{
'url_string'
:
software_release_url_string
,
'url_string'
:
software_release_url_string
,
...
@@ -22,21 +22,21 @@ edit_kw = {
...
@@ -22,21 +22,21 @@ edit_kw = {
# Check the slave management
# Check the slave management
if
is_slave
not
in
[
True
,
False
]:
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
raise
ValueError
(
"shared should be a boolean"
)
instance_portal_type
=
instance
.
getPortalType
()
instance_portal_type
=
instance
.
getPortalType
()
if
instance_portal_type
==
"Instance Tree"
:
if
instance_portal_type
==
"Instance Tree"
:
edit_kw
[
'root_slave'
]
=
is_slave
edit_kw
[
'root_slave'
]
=
is_slave
elif
instance_portal_type
==
"Software Instance"
:
elif
instance_portal_type
==
"Software Instance"
:
if
is_slave
:
if
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a slave instance (%s)"
%
\
raise
NotImplementedError
(
"Please destroy before doing a slave instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
(
instance
.
getRelativeUrl
(),
)
)
elif
instance_portal_type
==
"Slave Instance"
:
elif
instance_portal_type
==
"Slave Instance"
:
if
not
is_slave
:
if
not
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a software instance (%s)"
%
\
raise
NotImplementedError
(
"Please destroy before doing a software instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
(
instance
.
getRelativeUrl
(),
)
)
else
:
else
:
raise
NotImplementedError
,
"Not supported portal type %s (%s)"
%
\
raise
NotImplementedError
(
"Not supported portal type %s (%s)"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
instance
.
edit
(
**
edit_kw
)
instance
.
edit
(
**
edit_kw
)
# Prevent storing broken XML in text content (which prevent to update parameters after)
# Prevent storing broken XML in text content (which prevent to update parameters after)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequesterInstance_request.py
View file @
a27ea9c0
...
@@ -20,7 +20,7 @@ except KeyError:
...
@@ -20,7 +20,7 @@ except KeyError:
#raise TypeError, "RequesterInstance_request takes exactly 7 arguments"
#raise TypeError, "RequesterInstance_request takes exactly 7 arguments"
if
is_slave
not
in
[
True
,
False
]:
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
raise
ValueError
(
"shared should be a boolean"
)
# Instance tree is used as the root of the instance tree
# Instance tree is used as the root of the instance tree
if
requester_instance
.
getPortalType
()
==
"Instance Tree"
:
if
requester_instance
.
getPortalType
()
==
"Instance Tree"
:
...
@@ -80,7 +80,7 @@ if instance_count == 0:
...
@@ -80,7 +80,7 @@ if instance_count == 0:
elif
instance_count
==
1
:
elif
instance_count
==
1
:
request_software_instance
=
request_software_instance_list
[
0
].
getObject
()
request_software_instance
=
request_software_instance_list
[
0
].
getObject
()
else
:
else
:
raise
ValueError
,
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
]
)
raise
ValueError
(
"Too many instances '%s' found: %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_software_instance_list
])
)
if
(
request_software_instance
is
None
):
if
(
request_software_instance
is
None
):
if
(
root_state
==
"destroyed"
):
if
(
root_state
==
"destroyed"
):
...
@@ -161,7 +161,7 @@ if instance_found:
...
@@ -161,7 +161,7 @@ if instance_found:
request_software_instance
.
requestDestroy
(
**
promise_kw
)
request_software_instance
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
else
:
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
raise
ValueError
(
"state should be started, stopped or destroyed"
)
successor_list
=
requester_instance
.
getSuccessorList
()
successor_list
=
requester_instance
.
getSuccessorList
()
successor_uid_list
=
requester_instance
.
getSuccessorUidList
()
successor_uid_list
=
requester_instance
.
getSuccessorUidList
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
View file @
a27ea9c0
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
try
:
try
:
compute_node_title
=
kwargs
[
'compute_node_title'
]
compute_node_title
=
kwargs
[
'compute_node_title'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestComputeNode takes exactly 2 arguments. Missing compute_node_title."
raise
TypeError
(
"Person_requestComputeNode takes exactly 2 arguments. Missing compute_node_title."
)
try
:
try
:
project_reference
=
kwargs
[
'project_reference'
]
project_reference
=
kwargs
[
'project_reference'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestComputeNode takes exactly 2 arguments. Missing project_reference."
raise
TypeError
(
"Person_requestComputeNode takes exactly 2 arguments. Missing project_reference."
)
tag
=
"%s_%s_ComputeNodeInProgress"
%
(
person
.
getUid
(),
tag
=
"%s_%s_ComputeNodeInProgress"
%
(
person
.
getUid
(),
compute_node_title
)
compute_node_title
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestNetwork.py
View file @
a27ea9c0
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
try
:
try
:
computer_network_title
=
kwargs
[
'network_title'
]
computer_network_title
=
kwargs
[
'network_title'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestNetwork takes exactly 2 arguments. Missing network_title."
raise
TypeError
(
"Person_requestNetwork takes exactly 2 arguments. Missing network_title."
)
try
:
try
:
project_reference
=
kwargs
[
'project_reference'
]
project_reference
=
kwargs
[
'project_reference'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestNetwork takes exactly 2 arguments. Missing project_reference."
raise
TypeError
(
"Person_requestNetwork takes exactly 2 arguments. Missing project_reference."
)
tag
=
"%s_%s_NetworkInProgress"
%
(
person
.
getUid
(),
tag
=
"%s_%s_NetworkInProgress"
%
(
person
.
getUid
(),
computer_network_title
)
computer_network_title
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
View file @
a27ea9c0
...
@@ -15,10 +15,10 @@ try:
...
@@ -15,10 +15,10 @@ try:
root_state
=
kwargs
[
"state"
]
root_state
=
kwargs
[
"state"
]
project_reference
=
kwargs
[
'project_reference'
]
project_reference
=
kwargs
[
'project_reference'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestSoftwareInstance takes exactly 8 arguments"
raise
TypeError
(
"Person_requestSoftwareInstance takes exactly 8 arguments"
)
if
is_slave
not
in
[
True
,
False
]:
if
is_slave
not
in
[
True
,
False
]:
raise
ValueError
,
"shared should be a boolean"
raise
ValueError
(
"shared should be a boolean"
)
instance_tree_portal_type
=
"Instance Tree"
instance_tree_portal_type
=
"Instance Tree"
...
@@ -46,7 +46,7 @@ request_instance_tree_list = portal.portal_catalog(
...
@@ -46,7 +46,7 @@ request_instance_tree_list = portal.portal_catalog(
limit
=
2
,
limit
=
2
,
)
)
if
len
(
request_instance_tree_list
)
>
1
:
if
len
(
request_instance_tree_list
)
>
1
:
raise
NotImplementedError
,
"Too many instance tree %s found %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_instance_tree_list
]
)
raise
NotImplementedError
(
"Too many instance tree %s found %s"
%
(
software_title
,
[
x
.
path
for
x
in
request_instance_tree_list
])
)
elif
len
(
request_instance_tree_list
)
==
1
:
elif
len
(
request_instance_tree_list
)
==
1
:
request_instance_tree
=
request_instance_tree_list
[
0
].
getObject
()
request_instance_tree
=
request_instance_tree_list
[
0
].
getObject
()
assert
request_instance_tree
.
getFollowUp
()
==
project_list
[
0
].
getRelativeUrl
()
assert
request_instance_tree
.
getFollowUp
()
==
project_list
[
0
].
getRelativeUrl
()
...
@@ -54,7 +54,7 @@ elif len(request_instance_tree_list) == 1:
...
@@ -54,7 +54,7 @@ elif len(request_instance_tree_list) == 1:
(
request_instance_tree
.
getTitle
()
!=
software_title
)
or
\
(
request_instance_tree
.
getTitle
()
!=
software_title
)
or
\
(
request_instance_tree
.
getValidationState
()
!=
"validated"
)
or
\
(
request_instance_tree
.
getValidationState
()
!=
"validated"
)
or
\
(
request_instance_tree
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
(
request_instance_tree
.
getDestinationSection
()
!=
person
.
getRelativeUrl
()):
raise
NotImplementedError
,
"The system was not able to get the expected instance tree"
raise
NotImplementedError
(
"The system was not able to get the expected instance tree"
)
# Do not allow user to change the release/type/shared status
# Do not allow user to change the release/type/shared status
# This is not compatible with invoicing the service
# This is not compatible with invoicing the service
# Instance release change will be handled by allocation supply and upgrade decision
# Instance release change will be handled by allocation supply and upgrade decision
...
@@ -62,7 +62,7 @@ elif len(request_instance_tree_list) == 1:
...
@@ -62,7 +62,7 @@ elif len(request_instance_tree_list) == 1:
(
request_instance_tree
.
getSourceReference
()
!=
software_type
)
or
\
(
request_instance_tree
.
getSourceReference
()
!=
software_type
)
or
\
(
request_instance_tree
.
getRootSlave
()
!=
is_slave
))
and
\
(
request_instance_tree
.
getRootSlave
()
!=
is_slave
))
and
\
(
not
kwargs
.
get
(
"force_software_change"
,
False
)):
(
not
kwargs
.
get
(
"force_software_change"
,
False
)):
raise
NotImplementedError
,
"You can not change the release / type / shared states"
raise
NotImplementedError
(
"You can not change the release / type / shared states"
)
else
:
else
:
if
(
root_state
==
"destroyed"
):
if
(
root_state
==
"destroyed"
):
# No need to create destroyed subscription.
# No need to create destroyed subscription.
...
@@ -97,7 +97,7 @@ elif (root_state == "destroyed"):
...
@@ -97,7 +97,7 @@ elif (root_state == "destroyed"):
request_instance_tree
.
requestDestroy
(
**
promise_kw
)
request_instance_tree
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_instance_tree'
,
None
)
context
.
REQUEST
.
set
(
'request_instance_tree'
,
None
)
else
:
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
raise
ValueError
(
"state should be started, stopped or destroyed"
)
request_instance_tree
.
requestInstance
(
request_instance_tree
.
requestInstance
(
software_release
=
software_release_url_string
,
software_release
=
software_release_url_string
,
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestToken.py
View file @
a27ea9c0
...
@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
...
@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try
:
try
:
request_url
=
kwargs
[
'request_url'
]
request_url
=
kwargs
[
'request_url'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"Person_requestToken takes exactly 1 argument"
raise
TypeError
(
"Person_requestToken takes exactly 1 argument"
)
request_method
=
"POST"
request_method
=
"POST"
access_token
=
portal
.
access_token_module
.
newContent
(
access_token
=
portal
.
access_token_module
.
newContent
(
...
...
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/script_PayzenEvent_generateNavigationPage.py
View file @
a27ea9c0
...
@@ -14,7 +14,7 @@ try:
...
@@ -14,7 +14,7 @@ try:
vads_url_success
=
kwargs
[
'vads_url_success'
]
vads_url_success
=
kwargs
[
'vads_url_success'
]
vads_url_return
=
kwargs
[
'vads_url_return'
]
vads_url_return
=
kwargs
[
'vads_url_return'
]
except
KeyError
:
except
KeyError
:
raise
TypeError
,
"PayzenEvent_generateNavigationPage takes exactly 6 arguments"
raise
TypeError
(
"PayzenEvent_generateNavigationPage takes exactly 6 arguments"
)
payment_transaction
=
payzen_event
.
getDestinationValue
(
portal_type
=
"Payment Transaction"
)
payment_transaction
=
payzen_event
.
getDestinationValue
(
portal_type
=
"Payment Transaction"
)
now
=
DateTime
()
now
=
DateTime
()
...
@@ -22,7 +22,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
...
@@ -22,7 +22,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
transaction_date
,
transaction_number
=
payment_transaction
.
PaymentTransaction_generatePayzenId
()
transaction_date
,
transaction_number
=
payment_transaction
.
PaymentTransaction_generatePayzenId
()
if
transaction_number
is
None
:
if
transaction_number
is
None
:
raise
ValueError
,
"Transaction already registered"
raise
ValueError
(
"Transaction already registered"
)
transaction_id
=
transaction_date
.
Date
().
replace
(
"/"
,
""
)
+
"-"
+
transaction_number
transaction_id
=
transaction_date
.
Date
().
replace
(
"/"
,
""
)
+
"-"
+
transaction_number
...
...
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/script_WechatEvent_generateNavigationPage.py
View file @
a27ea9c0
...
@@ -7,7 +7,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
...
@@ -7,7 +7,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
_
,
transaction_id
=
payment_transaction
.
PaymentTransaction_generateWechatId
()
_
,
transaction_id
=
payment_transaction
.
PaymentTransaction_generateWechatId
()
if
transaction_id
is
None
:
if
transaction_id
is
None
:
raise
ValueError
,
"Transaction already registered"
raise
ValueError
(
"Transaction already registered"
)
wechat_dict
=
{
wechat_dict
=
{
'out_trade_no'
:
payment_transaction
.
getId
().
encode
(
'utf-8'
),
'out_trade_no'
:
payment_transaction
.
getId
().
encode
(
'utf-8'
),
...
...
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