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
Carlos Ramos Carreño
slapos.core
Commits
7b5d49a0
Commit
7b5d49a0
authored
Apr 17, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Python3 Preparations (again)
See merge request
nexedi/slapos.core!620
parents
97a0dd7a
a27ea9c0
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
123 additions
and
123 deletions
+123
-123
master/bt5/slapos_abyss/SkinTemplateItem/portal_skins/slapos_abyss/DataArray_getArrayFileInfoList.py
...rtal_skins/slapos_abyss/DataArray_getArrayFileInfoList.py
+1
-1
master/bt5/slapos_abyss/TestTemplateItem/portal_components/test.erp5.testSlapOSAbyss.py
...mplateItem/portal_components/test.erp5.testSlapOSAbyss.py
+2
-2
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_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
..._components/test.erp5.testSlapOSERP5AccountingScenario.py
+23
-23
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
+4
-4
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputePartitionMixin.py
...rtal_components/mixin.erp5.SlapOSComputePartitionMixin.py
+4
-4
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
...s/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
+1
-1
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/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSkins.py
...eItem/portal_components/test.erp5.testSlapOSCloudSkins.py
+13
-13
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_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_hasContactedRecently.py
...slapos_crm_monitoring/ComputeNode_hasContactedRecently.py
+1
-1
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
.../portal_components/test.erp5.testSlapOSERP5CRMScenario.py
+18
-18
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/InstanceTree_getMonitorParameterDict.py
...os_hal_json_style/InstanceTree_getMonitorParameterDict.py
+3
-3
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Login_edit.py
...lateItem/portal_skins/slapos_hal_json_style/Login_edit.py
+1
-1
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_addVirtualMaster.py
...Item/portal_skins/slapos_panel/Person_addVirtualMaster.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_slap_tool/SkinTemplateItem/portal_skins/slapos_slap_tool/ComputeNode_updateFromDict.py
...rtal_skins/slapos_slap_tool/ComputeNode_updateFromDict.py
+2
-2
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSHalRestrictedCompatibilityJsonStyle.py
...est.erp5.testSlapOSHalRestrictedCompatibilityJsonStyle.py
+4
-4
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+2
-2
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
...os_subscription_request/Item_createSubscriptionRequest.py
+1
-1
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/script_WechatEvent_generateNavigationPage.py
...ace_workflow/script_WechatEvent_generateNavigationPage.py
+1
-1
master/product/SlapOS/__init__.py
master/product/SlapOS/__init__.py
+3
-3
master/product/SlapOS/tests/testSlapOSMixin.py
master/product/SlapOS/tests/testSlapOSMixin.py
+1
-1
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
...ct/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
+1
-1
No files found.
master/bt5/slapos_abyss/SkinTemplateItem/portal_skins/slapos_abyss/DataArray_getArrayFileInfoList.py
View file @
7b5d49a0
...
...
@@ -44,7 +44,7 @@ length = context.getArrayShape()[0]
# never access more than 1000 lines at once
list_lines
=
min
(
list_lines
,
limit
,
1000
)
if
context
.
REQUEST
.
has_key
(
"limit"
)
:
if
"limit"
in
context
.
REQUEST
:
list_start
=
limit
[
0
]
list_lines
=
limit
[
1
]
-
limit
[
0
]
...
...
master/bt5/slapos_abyss/TestTemplateItem/portal_components/test.erp5.testSlapOSAbyss.py
View file @
7b5d49a0
...
...
@@ -228,7 +228,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
self
.
tic
()
data_array
=
self
.
_getRelatedDataArrayList
(
database_debian11
)[
0
]
# /home/test3/metadata-collect-agent/scan-filesystem/cython/command-line.main.pyx, /home/test3/metadata-collect-agent/scan-filesystem/cython/test.main.pyx
self
.
assertEqual
s
(
len
(
data_array
.
getArray
()),
2
)
self
.
assertEqual
(
len
(
data_array
.
getArray
()),
2
)
database_debian11
.
edit
(
exclude_path_list
=
[
'/home/test3/metadata-collect-agent/scan-filesystem/cython'
])
self
.
tic
()
self
.
portal
.
portal_alarms
.
slapos_process_data_array
.
activeSense
()
...
...
@@ -247,7 +247,7 @@ class testSlapOSAbyss(SlapOSTestCaseMixin):
if
'file_system_image/process_state/converted'
in
new_array
.
getPublicationSectionList
():
break
self
.
assertIn
(
'file_system_image/process_state/converted'
,
new_array
.
getPublicationSectionList
())
self
.
assertEqual
s
(
len
(
new_array
.
getArray
()),
0
)
self
.
assertEqual
(
len
(
new_array
.
getArray
()),
0
)
def
test_data_processing_for_the_first_access
(
self
):
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SaleInvoiceTransaction_postSlapOSGeneration.py
View file @
7b5d49a0
...
...
@@ -7,7 +7,7 @@ from DateTime import DateTime
portal
=
context
.
getPortalObject
()
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
price_currency
=
invoice
.
getPriceCurrency
()
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SalePackingList_postSlapOSGeneration.py
View file @
7b5d49a0
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
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5AccountingScenario.py
View file @
7b5d49a0
...
...
@@ -40,8 +40,8 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
24.384
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
24.384
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
())
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"invalidated"
)
open_sale_order
=
self
.
portal
.
portal_catalog
.
getResultValue
(
...
...
@@ -80,12 +80,12 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
175.584
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
175.584
)
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
125.184
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
125.184
)
self
.
assertEqual
(
first_invoice
.
getSimulationState
(),
"stopped"
)
# Ensure no unexpected object has been created
# 4 accounting transactions
...
...
@@ -110,16 +110,16 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
)
)
payment_transaction
.
stop
()
self
.
assertEqual
s
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
74.78399999999999
)
self
.
assertEqual
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
74.78399999999999
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
100.8
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
100.8
)
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertTrue
(
first_invoice
.
SaleInvoiceTransaction_isLettered
())
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
...
...
@@ -136,15 +136,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
)
)
payment_transaction
.
stop
()
self
.
assertEqual
s
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
50.4
)
self
.
assertEqual
(
payment_transaction
.
AccountingTransaction_getTotalCredit
(),
50.4
)
self
.
tic
()
self
.
assertTrue
(
owner_person
.
Entity_hasOutstandingAmount
(
include_planned
=
True
))
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
amount_list
),
1
)
self
.
assertEqual
s
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertEqual
(
len
(
amount_list
),
1
)
self
.
assertEqual
(
amount_list
[
0
].
total_price
,
50.4
)
self
.
assertFalse
(
owner_person
.
Entity_hasOutstandingAmount
())
amount_list
=
owner_person
.
Entity_getOutstandingAmountList
()
self
.
assertEqual
s
(
len
(
amount_list
),
0
)
self
.
assertEqual
(
len
(
amount_list
),
0
)
# Ensure no unexpected object has been created
self
.
assertRelatedObjectCount
(
project
,
22
)
...
...
@@ -236,7 +236,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
logout
()
self
.
login
()
# Check that no activity has been triggered yet
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Compute Node'
,
follow_up__uid
=
project
.
getUid
()
)[
0
][
0
],
0
)
...
...
@@ -246,7 +246,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# 1 invoice for the compute node
# per user:
# 1 monthly invoice for products
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
1
+
len
(
person_list
))
...
...
@@ -271,7 +271,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
# Execute activities for all services
# To try detection bad activity tag dependencies
self
.
tic
()
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
1
+
len
(
person_list
))
...
...
@@ -283,7 +283,7 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
self
.
login
()
self
.
portal
.
portal_alarms
.
update_open_order_simulation
.
activeSense
()
self
.
tic
()
self
.
assertEqual
s
(
self
.
portal
.
portal_catalog
.
countResults
(
self
.
assertEqual
(
self
.
portal
.
portal_catalog
.
countResults
(
portal_type
=
'Sale Invoice Transaction'
,
source_project__uid
=
project
.
getUid
()
)[
0
][
0
],
(
1
+
len
(
person_list
))
*
3
)
...
...
@@ -327,15 +327,15 @@ class TestSlapOSAccountingScenario(TestSlapOSVirtualMasterScenarioMixin):
parent_uid
=
invoice
.
getUid
(),
resource__uid
=
self
.
portal
.
service_module
.
slapos_tax
.
getUid
()
)
self
.
assertEqual
s
(
tax_line
.
getPrice
(),
0
)
self
.
assertEqual
s
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
(
tax_line
.
getPrice
(),
0
)
self
.
assertEqual
(
invoice
.
getTotalPrice
(),
42
)
with
PinnedDateTime
(
self
,
creation_date
+
35
):
self
.
portal
.
portal_alarms
.
update_open_order_simulation
.
activeSense
()
self
.
tic
()
self
.
assertEqual
s
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
s
(
invoice
.
getSimulationState
(),
'stopped'
)
self
.
assertEqual
(
invoice
.
getTotalPrice
(),
42
)
self
.
assertEqual
(
invoice
.
getSimulationState
(),
'stopped'
)
# Ensure no unexpected object has been created
# 2 invoice lines
...
...
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSCatalogToolCacheMixin.py
View file @
7b5d49a0
...
...
@@ -48,7 +48,7 @@ class SlapOSCatalogToolCacheMixin(object):
validation_state
=
"validated"
,
reference
=
reference
)
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
:
return
_assertACI
(
compute_node_list
[
0
].
getObject
()).
getRelativeUrl
()
...
...
@@ -88,7 +88,7 @@ class SlapOSCatalogToolCacheMixin(object):
parent_uid
=
self
.
_getNonCachedComputeNodeUid
(
compute_node_reference
))
if
len
(
compute_partition_list
)
!=
1
:
raise
NotFound
,
"No document found with parameters: %s %s"
%
\
(
compute_node_reference
,
compute_partition_reference
)
raise
NotFound
(
"No document found with parameters: %s %s"
%
\
(
compute_node_reference
,
compute_partition_reference
)
)
else
:
return
_assertACI
(
compute_partition_list
[
0
].
getObject
())
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputeNodeMixin.py
View file @
7b5d49a0
...
...
@@ -276,8 +276,8 @@ class SlapOSComputeNodeMixin(object):
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
elif
software_instance_count
>
1
:
# XXX do not prevent the system to work if one partition is broken
raise
NotImplementedError
,
"Too many instances linked to %s"
%
\
compute_partition_document
.
getRelativeUrl
()
raise
NotImplementedError
(
"Too many instances linked to %s"
%
\
compute_partition_document
.
getRelativeUrl
()
)
if
software_instance
is
not
None
:
state
=
software_instance
.
getSlapState
()
...
...
@@ -306,10 +306,10 @@ class SlapOSComputeNodeMixin(object):
parameter_dict
.
pop
(
'filter_xml'
))
partition_dict
[
'_instance_guid'
]
=
parameter_dict
.
pop
(
'instance_guid'
)
for
slave_instance_dict
in
parameter_dict
.
get
(
"slave_instance_list"
,
[]):
if
slave_instance_dict
.
has_key
(
"connection_xml"
)
:
if
"connection_xml"
in
slave_instance_dict
:
slave_instance_dict
.
update
(
self
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"connection_xml"
)))
if
slave_instance_dict
.
has_key
(
"xml"
)
:
if
"xml"
in
slave_instance_dict
:
slave_instance_dict
.
update
(
self
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"xml"
)))
partition_dict
[
'_parameter_dict'
].
update
(
parameter_dict
)
...
...
master/bt5/slapos_cloud/MixinTemplateItem/portal_components/mixin.erp5.SlapOSComputePartitionMixin.py
View file @
7b5d49a0
...
...
@@ -98,9 +98,9 @@ class SlapOSComputePartitionMixin(object):
software_instance
=
_assertACI
(
software_instance_list
[
0
].
getObject
())
elif
software_instance_count
>
1
:
# 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
],
self
.
getRelativeUrl
())
self
.
getRelativeUrl
())
)
if
software_instance
is
not
None
:
state
=
software_instance
.
getSlapState
()
...
...
@@ -129,13 +129,13 @@ class SlapOSComputePartitionMixin(object):
parameter_dict
.
pop
(
'filter_xml'
))
partition_dict
[
'_instance_guid'
]
=
parameter_dict
.
pop
(
'instance_guid'
)
for
slave_instance_dict
in
parameter_dict
.
get
(
"slave_instance_list"
,
[]):
if
slave_instance_dict
.
has_key
(
"connection_xml"
)
:
if
"connection_xml"
in
slave_instance_dict
:
connection_dict
=
software_instance
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"connection_xml"
))
slave_instance_dict
.
update
(
connection_dict
)
slave_instance_dict
[
'connection-parameter-hash'
]
=
\
calculate_dict_hash
(
connection_dict
)
if
slave_instance_dict
.
has_key
(
"xml"
)
:
if
"xml"
in
slave_instance_dict
:
slave_instance_dict
.
update
(
software_instance
.
_instanceXmlToDict
(
slave_instance_dict
.
pop
(
"xml"
)))
partition_dict
[
'_parameter_dict'
].
update
(
parameter_dict
)
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToAllocatePartition.py
View file @
7b5d49a0
...
...
@@ -126,7 +126,7 @@ try:
instance_tree
.
activate
(
activity
=
"SQLQueue"
,
tag
=
tag
,
after_tag
=
"allocate_%s"
%
compute_partition_url
).
getId
()
except
ValueError
,
e
:
except
ValueError
as
e
:
# It was not possible to find free Compute Partition
markHistory
(
software_instance
,
'Allocation failed: no free Compute Partition %s'
%
e
)
else
:
...
...
master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareInstance_tryToGarbageCollect.py
View file @
7b5d49a0
...
...
@@ -11,8 +11,8 @@ if (instance.getSlapState() != "destroy_requested"):
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
raise
NotImplementedError
(
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
if
requester
is
None
:
# 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 @
7b5d49a0
...
...
@@ -16,8 +16,8 @@ if (instance_tree.getSlapState() == "stop_requested"):
elif
instance
.
getPortalType
()
==
'Slave Instance'
:
is_slave
=
True
else
:
raise
NotImplementedError
,
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
raise
NotImplementedError
(
"Unknown portal type %s of %s"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
# Buildout may not propagate the stop request
requester
=
instance
.
getSuccessorRelatedValue
()
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.testSlapOSCloudSkins.py
View file @
7b5d49a0
...
...
@@ -75,7 +75,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -101,11 +101,11 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp
=
self
.
getIndexationDate
(
document
)
edit_timestamp
=
alarm
.
getModificationDate
()
# check that the document was not reindexed
self
.
assertEqual
s
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
self
.
assertEqual
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
# check that alarm was called after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -129,9 +129,9 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
next_indexation_timestamp
=
self
.
getIndexationDate
(
document
)
# check that the document was not reindex
self
.
assertEqual
s
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
self
.
assertEqual
(
previous_indexation_timestamp
,
next_indexation_timestamp
)
# check that the alarm was not triggered
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
)
...
...
@@ -157,7 +157,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -182,7 +182,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
tic
()
# check that alarm was called ONCE
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -213,7 +213,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
# check that alarm was called ONCE after the object was reindexed
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -241,7 +241,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
with
TemporaryAlarmScript
(
alarm
,
'Alarm_allocateInstance'
):
self
.
tic
()
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
3
)
...
...
@@ -277,7 +277,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp1
<
edit_timestamp
)
self
.
assertTrue
(
next_indexation_timestamp2
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -314,7 +314,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp1
<
edit_timestamp
)
self
.
assertTrue
(
next_indexation_timestamp2
<
edit_timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count
+
1
)
...
...
@@ -349,7 +349,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp1
)
self
.
assertTrue
(
next_indexation_timestamp
<
edit_timestamp2
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm1
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count1
+
1
)
...
...
@@ -357,7 +357,7 @@ class TestBase_reindexAndSenseAlarm(SlapOSTestCaseMixinWithAbort):
'Visited by Alarm_allocateInstance'
,
alarm1
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
]
)
self
.
assertEqual
s
(
self
.
assertEqual
(
len
(
alarm2
.
workflow_history
[
'edit_workflow'
]),
workflow_history_count2
+
1
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_allocatePartition.py
View file @
7b5d49a0
...
...
@@ -9,7 +9,7 @@ kwargs = state_change.kwargs
try
:
compute_partition_url
=
kwargs
[
'compute_partition_url'
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_allocatePartition takes exactly 1 argument"
raise
TypeError
(
"RequestedInstance_allocatePartition takes exactly 1 argument"
)
assert
instance
.
getAggregateValue
()
is
None
compute_partition
=
portal
.
restrictedTraverse
(
compute_partition_url
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_rename.py
View file @
7b5d49a0
...
...
@@ -26,7 +26,7 @@ request_software_instance_list = portal.portal_catalog(
limit
=
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
previous_title
=
instance
.
getTitle
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateConnectionInformation.py
View file @
7b5d49a0
...
...
@@ -4,7 +4,7 @@ instance = state_change['object']
try
:
connection_xml
=
state_change
.
kwargs
[
'connection_xml'
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
raise
TypeError
(
"RequestedInstance_updateConnectionInformation takes exactly 1 arguments"
)
edit_kw
=
{
'connection_xml'
:
connection_xml
,
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/script_RequestedInstance_updateParameterInformation.py
View file @
7b5d49a0
...
...
@@ -11,7 +11,7 @@ try:
sla_xml
=
kwargs
[
"sla_xml"
]
is_slave
=
kwargs
[
"shared"
]
except
KeyError
:
raise
TypeError
,
"RequestedInstance_updateParameterInformation takes exactly 5 arguments"
raise
TypeError
(
"RequestedInstance_updateParameterInformation takes exactly 5 arguments"
)
edit_kw
=
{
'url_string'
:
software_release_url_string
,
...
...
@@ -22,21 +22,21 @@ edit_kw = {
# Check the slave management
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
()
if
instance_portal_type
==
"Instance Tree"
:
edit_kw
[
'root_slave'
]
=
is_slave
elif
instance_portal_type
==
"Software Instance"
:
if
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a slave instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
raise
NotImplementedError
(
"Please destroy before doing a slave instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
)
elif
instance_portal_type
==
"Slave Instance"
:
if
not
is_slave
:
raise
NotImplementedError
,
"Please destroy before doing a software instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
raise
NotImplementedError
(
"Please destroy before doing a software instance (%s)"
%
\
(
instance
.
getRelativeUrl
(),
)
)
else
:
raise
NotImplementedError
,
"Not supported portal type %s (%s)"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
raise
NotImplementedError
(
"Not supported portal type %s (%s)"
%
\
(
instance
.
getPortalType
(),
instance
.
getRelativeUrl
())
)
instance
.
edit
(
**
edit_kw
)
# 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 @
7b5d49a0
...
...
@@ -20,7 +20,7 @@ except KeyError:
#raise TypeError, "RequesterInstance_request takes exactly 7 arguments"
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
if
requester_instance
.
getPortalType
()
==
"Instance Tree"
:
...
...
@@ -80,7 +80,7 @@ if instance_count == 0:
elif
instance_count
==
1
:
request_software_instance
=
request_software_instance_list
[
0
].
getObject
()
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
(
root_state
==
"destroyed"
):
...
...
@@ -161,7 +161,7 @@ if instance_found:
request_software_instance
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_instance'
,
None
)
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_uid_list
=
requester_instance
.
getSuccessorUidList
()
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestComputeNode.py
View file @
7b5d49a0
...
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
try
:
compute_node_title
=
kwargs
[
'compute_node_title'
]
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
:
project_reference
=
kwargs
[
'project_reference'
]
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
(),
compute_node_title
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestNetwork.py
View file @
7b5d49a0
...
...
@@ -8,12 +8,12 @@ kwargs = state_change.kwargs
try
:
computer_network_title
=
kwargs
[
'network_title'
]
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
:
project_reference
=
kwargs
[
'project_reference'
]
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
(),
computer_network_title
)
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestSoftwareInstance.py
View file @
7b5d49a0
...
...
@@ -15,10 +15,10 @@ try:
root_state
=
kwargs
[
"state"
]
project_reference
=
kwargs
[
'project_reference'
]
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
]:
raise
ValueError
,
"shared should be a boolean"
raise
ValueError
(
"shared should be a boolean"
)
instance_tree_portal_type
=
"Instance Tree"
...
...
@@ -46,7 +46,7 @@ request_instance_tree_list = portal.portal_catalog(
limit
=
2
,
)
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
:
request_instance_tree
=
request_instance_tree_list
[
0
].
getObject
()
assert
request_instance_tree
.
getFollowUp
()
==
project_list
[
0
].
getRelativeUrl
()
...
...
@@ -54,7 +54,7 @@ elif len(request_instance_tree_list) == 1:
(
request_instance_tree
.
getTitle
()
!=
software_title
)
or
\
(
request_instance_tree
.
getValidationState
()
!=
"validated"
)
or
\
(
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
# This is not compatible with invoicing the service
# Instance release change will be handled by allocation supply and upgrade decision
...
...
@@ -62,7 +62,7 @@ elif len(request_instance_tree_list) == 1:
(
request_instance_tree
.
getSourceReference
()
!=
software_type
)
or
\
(
request_instance_tree
.
getRootSlave
()
!=
is_slave
))
and
\
(
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
:
if
(
root_state
==
"destroyed"
):
# No need to create destroyed subscription.
...
...
@@ -97,7 +97,7 @@ elif (root_state == "destroyed"):
request_instance_tree
.
requestDestroy
(
**
promise_kw
)
context
.
REQUEST
.
set
(
'request_instance_tree'
,
None
)
else
:
raise
ValueError
,
"state should be started, stopped or destroyed"
raise
ValueError
(
"state should be started, stopped or destroyed"
)
request_instance_tree
.
requestInstance
(
software_release
=
software_release_url_string
,
...
...
master/bt5/slapos_cloud/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/script_Person_requestToken.py
View file @
7b5d49a0
...
...
@@ -8,7 +8,7 @@ kwargs = state_change.kwargs
try
:
request_url
=
kwargs
[
'request_url'
]
except
KeyError
:
raise
TypeError
,
"Person_requestToken takes exactly 1 argument"
raise
TypeError
(
"Person_requestToken takes exactly 1 argument"
)
request_method
=
"POST"
access_token
=
portal
.
access_token_module
.
newContent
(
...
...
master/bt5/slapos_crm/SkinTemplateItem/portal_skins/slapos_crm_monitoring/ComputeNode_hasContactedRecently.py
View file @
7b5d49a0
...
...
@@ -10,7 +10,7 @@ message_dict = context.getAccessStatus()
if
message_dict
.
get
(
"no_data"
,
None
)
==
1
:
message_dict
=
{}
if
message_dict
.
has_key
(
'created_at'
)
:
if
'created_at'
in
message_dict
:
contact_date
=
DateTime
(
message_dict
.
get
(
'created_at'
).
encode
(
'utf-8'
))
return
(
now_date
-
contact_date
)
<
maximum_days
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5CRMScenario.py
View file @
7b5d49a0
...
...
@@ -101,7 +101,7 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
portal_type
=
'Regularisation Request'
,
destination__uid
=
owner_person
.
getUid
()
)
self
.
assertEqual
s
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
##################################################
# Trigger regularisation request escalation
...
...
@@ -124,21 +124,21 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
# Items must be deleted
# Open Order must be archived
# Invoice must be paid with Deposit
self
.
assertEqual
s
(
project
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
s
(
instance_tree
.
getValidationState
(),
'archived'
)
self
.
assertEqual
s
(
instance_tree
.
getSlapState
(),
'destroy_requested'
)
self
.
assertEqual
s
(
compute_node
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
(
project
.
getValidationState
(),
'invalidated'
)
self
.
assertEqual
(
instance_tree
.
getValidationState
(),
'archived'
)
self
.
assertEqual
(
instance_tree
.
getSlapState
(),
'destroy_requested'
)
self
.
assertEqual
(
compute_node
.
getValidationState
(),
'invalidated'
)
open_order_list
=
self
.
portal
.
portal_catalog
(
portal_type
=
'Open Sale Order'
,
destination_section__uid
=
owner_person
.
getUid
()
)
hosting_subscription_list
=
[]
self
.
assertEqual
s
(
len
(
open_order_list
),
3
)
self
.
assertEqual
(
len
(
open_order_list
),
3
)
for
open_order
in
open_order_list
:
self
.
assertEqual
s
(
open_order
.
getValidationState
(),
'archived'
)
self
.
assertNotEqual
s
(
open_order
.
getStopDate
(),
open_order
.
getStartDate
())
self
.
assertNotEqual
s
(
open_order
.
getStopDate
(),
None
)
self
.
assertEqual
s
(
open_order
.
getStopDate
(),
DateTime
(
'2020/07/17'
))
self
.
assertEqual
(
open_order
.
getValidationState
(),
'archived'
)
self
.
assertNotEqual
(
open_order
.
getStopDate
(),
open_order
.
getStartDate
())
self
.
assertNotEqual
(
open_order
.
getStopDate
(),
None
)
self
.
assertEqual
(
open_order
.
getStopDate
(),
DateTime
(
'2020/07/17'
))
for
line
in
open_order
.
contentValues
():
for
cell
in
line
.
contentValues
():
...
...
@@ -149,12 +149,12 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
if
tmp
is
not
None
:
hosting_subscription_list
.
append
(
tmp
)
self
.
assertEqual
s
(
len
(
hosting_subscription_list
),
3
)
self
.
assertEqual
(
len
(
hosting_subscription_list
),
3
)
for
hosting_subscription
in
hosting_subscription_list
:
self
.
assertEqual
s
(
hosting_subscription
.
getValidationState
(),
'archived'
)
self
.
assertEqual
(
hosting_subscription
.
getValidationState
(),
'archived'
)
self
.
assertEqual
s
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
s
(
regularisation_request
.
getResourceId
(),
self
.
assertEqual
(
regularisation_request
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
regularisation_request
.
getResourceId
(),
'slapos_crm_delete_acknowledgement'
)
# No planned invoice is expected
...
...
@@ -162,15 +162,15 @@ class TestSlapOSCRMScenario(TestSlapOSVirtualMasterScenarioMixin):
outstanding_amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
ledger_uid
=
ledger_uid
)
self
.
assertEqual
s
(
len
(
outstanding_amount_list
),
1
)
self
.
assertEqual
s
(
outstanding_amount_list
[
0
].
total_price
,
132
)
self
.
assertEqual
(
len
(
outstanding_amount_list
),
1
)
self
.
assertEqual
(
outstanding_amount_list
[
0
].
total_price
,
132
)
planned_outstanding_amount_list
=
owner_person
.
Entity_getOutstandingAmountList
(
ledger_uid
=
ledger_uid
,
include_planned
=
True
)
self
.
assertEqual
s
(
len
(
planned_outstanding_amount_list
),
1
)
self
.
assertEqual
s
(
outstanding_amount_list
[
0
].
total_price
,
self
.
assertEqual
(
len
(
planned_outstanding_amount_list
),
1
)
self
.
assertEqual
(
outstanding_amount_list
[
0
].
total_price
,
planned_outstanding_amount_list
[
0
].
total_price
)
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/InstanceTree_getMonitorParameterDict.py
View file @
7b5d49a0
...
...
@@ -29,9 +29,9 @@ parameter_dict = instance.getConnectionXmlAsDict()
url_string
=
parameter_dict
.
get
(
'monitor-setup-url'
,
''
)
if
url_string
:
if
parameter_dict
.
has_key
(
'monitor-user'
)
and
\
parameter_dict
.
has_key
(
'monitor-password'
)
and
\
parameter_dict
.
has_key
(
'monitor-base-url'
)
:
if
'monitor-user'
in
parameter_dict
and
\
'monitor-password'
in
parameter_dict
and
\
'monitor-base-url'
in
parameter_dict
:
username
=
parameter_dict
.
get
(
'monitor-user'
)
password
=
parameter_dict
.
get
(
'monitor-password'
)
url
=
parameter_dict
.
get
(
'monitor-base-url'
)
+
'/public/feeds'
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Login_edit.py
View file @
7b5d49a0
...
...
@@ -26,7 +26,7 @@ current_username = context.getPortalObject().portal_membership.getAuthenticatedM
if
current_username
==
original_login
:
# We should logout immediately
if
context
.
REQUEST
.
has_key
(
'portal_skin'
)
:
if
'portal_skin'
in
context
.
REQUEST
:
context
.
portal_skins
.
clearSkinCookie
()
context
.
REQUEST
.
RESPONSE
.
expireCookie
(
'__ac'
,
path
=
'/'
)
context
.
REQUEST
.
RESPONSE
.
expireCookie
(
'__ac_google_hash'
,
path
=
'/'
)
...
...
master/bt5/slapos_panel/SkinTemplateItem/portal_skins/slapos_panel/Person_addVirtualMaster.py
View file @
7b5d49a0
...
...
@@ -17,7 +17,7 @@ currency_value = portal.restrictedTraverse(price_currency)
# create the subscription request, which will lead to the Open Order
try
:
subscription_request
=
resource
.
Resource_createSubscriptionRequest
(
customer
,
[],
project
,
currency_value
=
currency_value
)
except
AssertionError
,
e
:
except
AssertionError
as
e
:
if
batch
:
raise
return
context
.
Base_redirect
(
...
...
master/bt5/slapos_payzen/WorkflowTemplateItem/portal_workflow/payzen_interface_workflow/script_PayzenEvent_generateNavigationPage.py
View file @
7b5d49a0
...
...
@@ -14,7 +14,7 @@ try:
vads_url_success
=
kwargs
[
'vads_url_success'
]
vads_url_return
=
kwargs
[
'vads_url_return'
]
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"
)
now
=
DateTime
()
...
...
@@ -22,7 +22,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
transaction_date
,
transaction_number
=
payment_transaction
.
PaymentTransaction_generatePayzenId
()
if
transaction_number
is
None
:
raise
ValueError
,
"Transaction already registered"
raise
ValueError
(
"Transaction already registered"
)
transaction_id
=
transaction_date
.
Date
().
replace
(
"/"
,
""
)
+
"-"
+
transaction_number
...
...
master/bt5/slapos_slap_tool/SkinTemplateItem/portal_skins/slapos_slap_tool/ComputeNode_updateFromDict.py
View file @
7b5d49a0
...
...
@@ -14,7 +14,7 @@ def compareAndUpdateAddressList(document, address_list, additional_dict=None):
to_add_ip_dict_list
.
remove
(
current_dict
)
else
:
# XXX - Only delete if Network interface are supposed to be the same
if
additional_dict
.
has_key
(
'network_interface'
)
:
if
'network_interface'
in
additional_dict
:
if
address
.
getNetworkInterface
(
''
)
and
additional_dict
[
'network_interface'
]
!=
address
.
getNetworkInterface
():
continue
to_delete_ip_id_list
.
append
(
address
.
getId
())
...
...
@@ -94,7 +94,7 @@ for send_partition in compute_node_dict['partition_list']:
compareAndUpdateAddressList
(
partition
,
send_partition
[
'address_list'
],
{
'network_interface'
:
network_interface
})
tap_addr_list
=
[]
additional_dict
=
{
'network_interface'
:
'route_'
+
network_interface
}
if
send_partition
[
'tap'
].
has_key
(
'ipv4_addr'
)
and
send_partition
[
'tap'
][
'ipv4_addr'
]:
if
'ipv4_addr'
in
send_partition
[
'tap'
]
and
send_partition
[
'tap'
][
'ipv4_addr'
]:
tap_addr_list
.
append
({
'addr'
:
send_partition
[
'tap'
][
'ipv4_addr'
],
'netmask'
:
send_partition
[
'tap'
][
'ipv4_netmask'
]
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSHalRestrictedCompatibilityJsonStyle.py
View file @
7b5d49a0
...
...
@@ -14,8 +14,8 @@ class TestSlapOSHalRestrictedCompatibility(ERP5HALJSONStyleSkinsMixin):
fake_request
=
do_fake_request
(
"GET"
)
self
.
logout
()
self
.
getHatoasWebSite
().
ERP5Document_getHateoas
(
REQUEST
=
fake_request
,
mode
=
"search"
)
self
.
assertEqual
s
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEqual
s
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
self
.
assertEqual
(
fake_request
.
RESPONSE
.
status
,
401
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
getHeader
(
'WWW-Authenticate'
),
'X-Delegate uri="%s/connection/login_form{?came_from}"'
%
self
.
getHatoasWebSite
().
absolute_url
()
)
...
...
@@ -32,8 +32,8 @@ class TestSlapOSHalRestrictedCompatibility(ERP5HALJSONStyleSkinsMixin):
query
=
'portal_type: "Hosting Subscription"'
)
self
.
assertEqual
s
(
fake_request
.
RESPONSE
.
status
,
200
)
self
.
assertEqual
s
(
fake_request
.
RESPONSE
.
getHeader
(
'Content-Type'
),
self
.
assertEqual
(
fake_request
.
RESPONSE
.
status
,
200
)
self
.
assertEqual
(
fake_request
.
RESPONSE
.
getHeader
(
'Content-Type'
),
"application/hal+json"
)
result_dict
=
json
.
loads
(
result
)
...
...
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
7b5d49a0
...
...
@@ -92,11 +92,11 @@ def convertToREST(function):
"""
try
:
retval
=
function
(
self
,
*
args
,
**
kwd
)
except
(
ValueError
,
AttributeError
)
,
log
:
except
(
ValueError
,
AttributeError
)
as
log
:
LOG
(
'SlapTool'
,
INFO
,
'Converting ValueError to NotFound, real error:'
,
error
=
True
)
raise
NotFound
(
log
)
except
SoftwareInstanceNotReady
,
log
:
except
SoftwareInstanceNotReady
as
log
:
self
.
REQUEST
.
response
.
setStatus
(
408
)
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'private'
)
return
self
.
REQUEST
.
response
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/Item_createSubscriptionRequest.py
View file @
7b5d49a0
...
...
@@ -58,7 +58,7 @@ if destination_decision_value is None:
try
:
subscription_request
=
service
.
Resource_createSubscriptionRequest
(
destination_decision_value
,
resource_vcl
,
project_value
,
currency_value
=
currency_value
,
default_price
=
default_price
)
except
AssertionError
,
error
:
except
AssertionError
as
error
:
storeWorkflowComment
(
item
,
str
(
error
))
return
subscription_request
.
setAggregateValue
(
item
)
...
...
master/bt5/slapos_wechat/WorkflowTemplateItem/portal_workflow/wechat_interface_workflow/script_WechatEvent_generateNavigationPage.py
View file @
7b5d49a0
...
...
@@ -7,7 +7,7 @@ payment_transaction.AccountingTransaction_updateStartDate(now)
_
,
transaction_id
=
payment_transaction
.
PaymentTransaction_generateWechatId
()
if
transaction_id
is
None
:
raise
ValueError
,
"Transaction already registered"
raise
ValueError
(
"Transaction already registered"
)
wechat_dict
=
{
'out_trade_no'
:
payment_transaction
.
getId
().
encode
(
'utf-8'
),
...
...
master/product/SlapOS/__init__.py
View file @
7b5d49a0
...
...
@@ -28,7 +28,7 @@
from
Products.ERP5Type.Utils
import
initializeProduct
,
updateGlobals
from
AccessControl.Permissions
import
manage_users
as
ManageUsers
import
sys
import
Permissions
from
.
import
Permissions
this_module
=
sys
.
modules
[
__name__
]
document_classes
=
updateGlobals
(
this_module
,
globals
(),
permissions_module
=
Permissions
)
...
...
@@ -38,10 +38,10 @@ content_constructors = ()
portal_tools
=
()
from
Products.PluggableAuthService.PluggableAuthService
import
registerMultiPlugin
import
SlapOSShadowAuthenticationPlugin
from
.
import
SlapOSShadowAuthenticationPlugin
def
initialize
(
context
):
import
Document
from
.
import
Document
initializeProduct
(
context
,
this_module
,
globals
(),
document_module
=
Document
,
document_classes
=
document_classes
,
object_classes
=
object_classes
,
portal_tools
=
portal_tools
,
content_constructors
=
content_constructors
,
...
...
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
7b5d49a0
...
...
@@ -138,7 +138,7 @@ class testSlapOSMixin(ERP5TypeTestCase):
def
isLiveTest
(
self
):
#return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()]
# XXX - What is the better way to know if we are in live test mode ?
return
not
os
.
environ
.
has_key
(
'TEST_CA_PATH'
)
return
'TEST_CA_PATH'
not
in
os
.
environ
def
beforeTearDown
(
self
):
if
self
.
abort_transaction
:
...
...
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
View file @
7b5d49a0
...
...
@@ -26,7 +26,7 @@
#
##############################################################################
from
testSlapOSMixin
import
testSlapOSMixin
from
.
testSlapOSMixin
import
testSlapOSMixin
import
unittest
class
TestUpgradeInstanceWithOldDataFs
(
testSlapOSMixin
):
...
...
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