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
Titouan Soulard
slapos.core
Commits
92d00418
Commit
92d00418
authored
May 12, 2023
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: drop SubscriptionRequest_processConfirmed
parent
43e29047
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
213 deletions
+0
-213
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processConfirmed.py
...scription_request/SubscriptionRequest_processConfirmed.py
+0
-45
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processConfirmed.xml
...cription_request/SubscriptionRequest_processConfirmed.xml
+0
-62
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
...ortal_components/test.erp5.testSlapOSSubscriptionSkins.py
+0
-106
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processConfirmed.py
deleted
100644 → 0
View file @
43e29047
instance_tree
=
context
.
getAggregateValue
()
if
instance_tree
is
None
:
# Probably we should raise here
return
# Instance is already destroyed so move into stopped state diretly.
if
instance_tree
.
getValidationState
()
==
"archived"
:
comment
=
"Instance Tree is Destroyed and archived, Stop the Subscription Request"
context
.
start
(
comment
=
comment
)
context
.
stop
(
comment
=
comment
)
return
comment
request_kw
=
dict
(
software_release
=
instance_tree
.
getUrlString
(),
software_title
=
instance_tree
.
getTitle
(),
software_type
=
instance_tree
.
getSourceReference
(),
instance_xml
=
instance_tree
.
getTextContent
(),
sla_xml
=
instance_tree
.
getSlaXml
(),
shared
=
instance_tree
.
isRootSlave
(),
project_reference
=
instance_tree
.
getFollowUpReference
()
)
if
not
context
.
SubscriptionRequest_testPaymentBalance
():
# Payment isn't paid by the user, so we stop the instance and wait
if
instance_tree
.
getSlapState
()
==
"start_requested"
:
person
=
instance_tree
.
getDefaultDestinationSectionValue
()
person
.
requestSoftwareInstance
(
state
=
'stopped'
,
**
request_kw
)
return
"Skipped (Payment is pending)"
if
instance_tree
.
getSlapState
()
==
"stop_requested"
:
person
=
instance_tree
.
getDefaultDestinationSectionValue
()
person
.
requestSoftwareInstance
(
state
=
'started'
,
**
request_kw
)
# Return to because it is useless continue right the way.
return
"Skipped (Started instance)"
if
not
context
.
SubscriptionRequest_verifyInstanceIsAllocated
():
# Only continue if instance is ready
return
"Skipped (Instance is failing)"
if
context
.
SubscriptionRequest_notifyInstanceIsReady
():
context
.
start
(
comment
=
"Instance is ready"
)
return
"Instance is ready"
return
"Skipped (Instance isn't ready)"
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_processConfirmed.xml
deleted
100644 → 0
View file @
43e29047
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
SubscriptionRequest_processConfirmed
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionSkins.py
View file @
92d00418
...
@@ -1183,112 +1183,6 @@ class TestSubscriptionRequest_verifyInstanceIsAllocated(TestSubscriptionSkinsMix
...
@@ -1183,112 +1183,6 @@ class TestSubscriptionRequest_verifyInstanceIsAllocated(TestSubscriptionSkinsMix
self
.
assertEqual
(
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_verifyInstanceIsAllocated
(),
True
)
subscription_request
.
SubscriptionRequest_verifyInstanceIsAllocated
(),
True
)
class
TestSubscriptionRequest_processConfirmed
(
TestSubscriptionSkinsMixin
):
def
test_no_instance_tree
(
self
):
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
url_string
=
"https://%s/software.cfg"
%
self
.
new_id
,
sla_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="oi">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
text_content
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="xx">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
root_slave
=
False
,
source_reference
=
"test_for_test_123"
)
subscription_request
.
plan
()
subscription_request
.
order
()
subscription_request
.
confirm
()
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processConfirmed
(),
None
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"confirmed"
)
@
simulate
(
'SubscriptionRequest_testPaymentBalance'
,
''
,
'return False'
)
def
test_instance_tree_is_stopped_due_unpaid_invoice
(
self
):
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
url_string
=
"https://%s/software.cfg"
%
self
.
new_id
,
sla_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="oi">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
text_content
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="xx">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
root_slave
=
False
,
source_reference
=
"test_for_test_123"
)
subscription_request
.
plan
()
subscription_request
.
order
()
subscription_request
.
confirm
()
self
.
_makeTree
()
subscription_request
.
edit
(
aggregate_value
=
self
.
instance_tree
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processConfirmed
(),
'Skipped (Payment is pending)'
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"confirmed"
)
self
.
assertEqual
(
self
.
instance_tree
.
getSlapState
(),
"stop_requested"
)
@
simulate
(
'SubscriptionRequest_testPaymentBalance'
,
''
,
'return True'
)
def
test_instance_tree_is_started_due_paid_invoice
(
self
):
person
=
self
.
makePerson
()
subscription_request
=
self
.
newSubscriptionRequest
(
quantity
=
1
,
destination_section_value
=
person
,
url_string
=
"https://%s/software.cfg"
%
self
.
new_id
,
sla_xml
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="oi">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
text_content
=
"""<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="xx">couscous</parameter>
<parameter id="zz">yy</parameter>
</instance>"""
,
root_slave
=
False
,
source_reference
=
"test_for_test_123"
)
subscription_request
.
plan
()
subscription_request
.
order
()
subscription_request
.
confirm
()
self
.
_makeTree
()
subscription_request
.
edit
(
aggregate_value
=
self
.
instance_tree
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
self
.
instance_tree
,
'stop_requested'
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
SubscriptionRequest_processConfirmed
(),
'Skipped (Started instance)'
)
self
.
tic
()
self
.
assertEqual
(
subscription_request
.
getSimulationState
(),
"confirmed"
)
self
.
assertEqual
(
self
.
instance_tree
.
getSlapState
(),
"start_requested"
)
class
TestSlapOSSubscriptionRequestModule_getTicketFeedUrl
(
TestSubscriptionSkinsMixin
):
class
TestSlapOSSubscriptionRequestModule_getTicketFeedUrl
(
TestSubscriptionSkinsMixin
):
...
...
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