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
Léo-Paul Géneau
slapos.core
Commits
0d1b6788
Commit
0d1b6788
authored
Feb 05, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: Ensure you are getting the right free trial user
parent
a4421a13
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
24 deletions
+38
-24
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processDestroy.py
...lapos_subscription_request/TrialRequest_processDestroy.py
+12
-5
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processNotify.py
...slapos_subscription_request/TrialRequest_processNotify.py
+8
-8
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processRequest.py
...lapos_subscription_request/TrialRequest_processRequest.py
+18
-11
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processDestroy.py
View file @
0d1b6788
from
DateTime
import
DateTime
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_catalog
.
getResultValue
(
erp5_login
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
portal_type
=
"ERP5 Login"
,
reference
=
"free_trial_user"
)
reference
=
"free_trial_user"
,
validation_state
=
"validated"
)
if
erp5_login
is
None
:
return
person
=
erp5_login
.
getParentValue
()
if
context
.
getStopDate
()
>=
DateTime
():
if
context
.
getStopDate
()
>=
DateTime
():
return
return
...
@@ -16,7 +21,7 @@ if context.getSpecialise() is None:
...
@@ -16,7 +21,7 @@ if context.getSpecialise() is None:
if
context
.
getValidationState
()
!=
"validated"
:
if
context
.
getValidationState
()
!=
"validated"
:
return
return
state
=
"destroyed"
state
=
'destroyed'
hosting_subscription
=
context
.
getSpecialiseValue
()
hosting_subscription
=
context
.
getSpecialiseValue
()
...
@@ -33,6 +38,8 @@ request_kw.update(
...
@@ -33,6 +38,8 @@ request_kw.update(
person
.
requestSoftwareInstance
(
**
request_kw
)
person
.
requestSoftwareInstance
(
**
request_kw
)
assert
hosting_subscription
.
getSlapState
()
==
"destroy_requested"
,
\
"Hosting Subscription not destroyed!!"
connection_dict
=
hosting_subscription
.
getPredecessorValue
().
getConnectionXmlAsDict
()
connection_dict
=
hosting_subscription
.
getPredecessorValue
().
getConnectionXmlAsDict
()
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processNotify.py
View file @
0d1b6788
from
DateTime
import
DateTime
from
Products.ERP5Type.DateUtils
import
addToDate
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
erp5_login
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
"free_trial_user"
,
validation_state
=
"validated"
)
person
=
portal
.
portal_catalog
.
getResultValue
(
if
erp5_login
is
None
:
portal_type
=
"Person"
,
reference
=
"free_trial_user"
)
if
person
is
None
:
return
"Free Trial Person not Found"
return
"Free Trial Person not Found"
person
=
erp5_login
.
getParentValue
()
connection_key_list
=
context
.
getSubjectList
()
connection_key_list
=
context
.
getSubjectList
()
instance
=
context
.
getAggregateValue
()
instance
=
context
.
getAggregateValue
()
...
@@ -21,7 +21,7 @@ if instance.getSlapState() != "destroy_requested":
...
@@ -21,7 +21,7 @@ if instance.getSlapState() != "destroy_requested":
if
len
([
x
for
x
,
y
in
connection_dict
.
items
()
if
x
in
connection_key_list
])
!=
len
(
connection_key_list
):
if
len
([
x
for
x
,
y
in
connection_dict
.
items
()
if
x
in
connection_key_list
])
!=
len
(
connection_key_list
):
return
"Not ready %s != %s"
%
([
x
for
x
,
y
in
connection_dict
.
items
()
if
x
in
connection_key_list
],
connection_key_list
)
return
"Not ready %s != %s"
%
([
x
for
x
,
y
in
connection_dict
.
items
()
if
x
in
connection_key_list
],
connection_key_list
)
for
x
,
y
in
connection_dict
.
items
():
for
x
,
y
in
connection_dict
.
items
():
if
x
in
connection_key_list
and
y
in
[
'None'
,
None
,
'http://'
,
''
]:
if
x
in
connection_key_list
and
y
in
[
'None'
,
None
,
'http://'
,
''
]:
return
"key %s has invalid value %s"
%
(
x
,
y
)
return
"key %s has invalid value %s"
%
(
x
,
y
)
...
...
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/TrialRequest_processRequest.py
View file @
0d1b6788
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_catalog
.
getResultValue
(
erp5_login
=
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"Person"
,
portal_type
=
"ERP5 Login"
,
reference
=
"free_trial_user"
)
reference
=
"free_trial_user"
,
validation_state
=
"validated"
)
if
person
is
None
:
if
erp5_login
is
None
:
return
return
person
=
erp5_login
.
getParentValue
()
if
context
.
getSpecialise
()
is
not
None
:
if
context
.
getSpecialise
()
is
not
None
:
return
return
if
context
.
getValidationState
()
==
"validated"
:
if
context
.
getValidationState
()
==
"validated"
:
return
return
if
context
.
getUrlString
()
is
None
:
# Nothing to request here
return
state
=
"started"
state
=
"started"
...
@@ -20,8 +27,8 @@ request_kw.update(
...
@@ -20,8 +27,8 @@ request_kw.update(
software_title
=
context
.
getTitle
()
+
" %s"
%
str
(
context
.
getUid
()),
software_title
=
context
.
getTitle
()
+
" %s"
%
str
(
context
.
getUid
()),
software_type
=
context
.
getSourceReference
(),
software_type
=
context
.
getSourceReference
(),
instance_xml
=
context
.
getTextContent
(),
instance_xml
=
context
.
getTextContent
(),
sla_xml
=
""
,
sla_xml
=
context
.
getSlaXml
(
""
)
,
shared
=
context
.
getRootSlave
(),
shared
=
context
.
getRootSlave
(
False
),
state
=
state
,
state
=
state
,
)
)
...
@@ -29,8 +36,8 @@ person.requestSoftwareInstance(**request_kw)
...
@@ -29,8 +36,8 @@ person.requestSoftwareInstance(**request_kw)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
requested_software_instance
=
context
.
REQUEST
.
get
(
'request_instance'
)
if
requested_software_instance
is
None
:
if
requested_software_instance
is
None
:
return
return
context
.
setAggregateValue
(
requested_software_instance
)
context
.
setAggregateValue
(
requested_software_instance
)
...
...
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