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
6a4aed6e
Commit
6a4aed6e
authored
Dec 29, 2011
by
Antoine Catton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore Person_requestSoftwareInstance script from master.
parent
a828e2de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
116 deletions
+117
-116
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
...rface_workflow/scripts/Person_requestSoftwareInstance.xml
+116
-115
master/bt5/vifib_slap/bt/revision
master/bt5/vifib_slap/bt/revision
+1
-1
No files found.
master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml
View file @
6a4aed6e
...
@@ -75,146 +75,147 @@ if is_slave == True:\n
...
@@ -75,146 +75,147 @@ if is_slave == True:\n
else:\n
else:\n
software_instance_portal_type = "Software Instance"\n
software_instance_portal_type = "Software Instance"\n
\n
\n
tag = "%s_%s_inProgress" % (person.getUid(),\n
tag = "%s_%s_inProgress" % (person.getUid(),
\n
software_title)\n
software_title)\n
\n
\n
# Check if it already exists\n
# Check if it already exists\n
cleanup_resource = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
cleanup_resource = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
request_software_instance = None\n
request_software_instance = None\n
request_hosting_subscription = None\n
for si in portal.portal_catalog(\n
for hs in portal.portal_catalog(\n
portal_type=software_instance_portal_type,\n
portal_type=hosting_subscription_portal_type,\n
title=software_title,\n
title=software_title,\n
):\n
):\n
si_list = hs.portal_catalog(portal_type=software_instance_portal_type,\n
try:\n
title=software_title, root_uid=hs.getUid())\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
if len(si_list) == 0:\n
except ValueError:\n
request_hosting_subscription = hs\n
request_software_instance = si\n
for si in si_list:\n
break\n
try:\n
else:\n
cleanup_delivery_line = si.Item_getInstancePackingListLine(cleanup_resource)\n
if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
except ValueError:\n
request_software_instance = si\n
request_hosting_subscription = hs\n
break\n
break\n
else:\n
if cleanup_delivery_line.getSimulationState() != \'delivered\':\n
request_hosting_subscription = hs\n
break\n
\n
\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
if (request_software_instance is None):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
\n
if request_hosting_subscription is None:\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
hosting_subscription_reference = "HOSTSUBS-%s" % context.getPortalObject().portal_ids\\\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
.generateNewId(id_group=\'slap_hosting_subscription_reference\', id_generator=\'uid\')\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
if (portal.portal_activities.countMessageWithTag(tag) >
0):\n
# The software instance is already under creation but can not be fetched from catalog\n
# As it is not possible to fetch informations, it is better to raise an error\n
raise NotImplementedError(tag)\n
else:\n
\n
\n
subscription = portal.getDefaultModule(portal_type=hosting_subscription_portal_type).newContent(\n
setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
portal_type=hosting_subscription_portal_type,\n
software_instance = portal.getDefaultModule(portal_type=software_instance_portal_type).newContent(\n
reference=hosting_subscription_reference,\n
portal_type=software_instance_portal_type,\n
title=software_title,\n
source_reference=software_type,\n
activate_kw={\'tag\': tag},\n
title=software_title,\n
source_reference=software_type,\n
text_content=instance_xml,\n
text_content=instance_xml,\n
sla_xml=sla_xml,\n
sla_xml=sla_xml,\n
activate_kw={\'tag\': tag},\n
periodicity_hour_list=[0],\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n
periodicity_minute_list=[0],\n
)\n
periodicity_month_day=[1],\n
software_instance.portal_workflow.doActionFor(software_instance, \'validate_action\')\n
root_state=state,\n
subscription = portal.getDefaultModule(portal_type=hosting_subscription_portal_type).newContent(\n
root_software_release_url=software_release_url_string,\n
portal_type=hosting_subscription_portal_type,\n
root_slave=is_slave,\n
reference=hosting_subscription_reference,\n
)\n
title=software_title,\n
subscription.portal_workflow.doActionFor(subscription, \'validate_action\')\n
periodicity_hour_list=[0],\n
software_instance = subscription.HostingSubscription_requestRootSoftwareInstance(tag, person_request=True)\n
periodicity_minute_list=[0],\n
periodicity_month_day=[1],\n
activate_kw={\'tag\': tag},\n
)\n
subscription.portal_workflow.doActionFor(subscription, \'validate_action\')\n
if state == \'started\':\n
software_instance.startRequested()\n
elif state == \'stopped\':\n
software_instance.stopRequested()\n
\n
\n
software_release_document = context.portal_catalog.getResultValue(\n
software_release_document = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
portal_type=\'Software Release\',\n
url_string=software_release_url_string)\n
url_string=software_release_url_string)\n
\n
\n
sale_order = portal.getDefaultModule(portal_type=sale_order_portal_type).newContent(\n
sale_order = portal.getDefaultModule(portal_type=sale_order_portal_type).newContent(\n
portal_type=sale_order_portal_type,\n
portal_type=sale_order_portal_type,\n
destination_value=person,\n
destination_value=person,\n
destination_section_value=person,\n
destination_section_value=person,\n
destination_decision_value=person,\n
destination_decision_value=person,\n
start_date=DateTime(),\n
start_date=DateTime(),\n
received_date=DateTime(),\n
received_date=DateTime(),\n
# XXX Hardcoded values\n
# XXX Hardcoded values\n
source="organisation_module/vifib_internet",\n
source="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
quantity_unit="unit/piece",\n
quantity_unit="unit/piece",\n
price_currency="currency_module/EUR",\n
price_currency="currency_module/EUR",\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
)\n
)\n
sale_order_line = sale_order.newContent(\n
sale_order_line = sale_order.newContent(\n
portal_type=sale_order_line_portal_type,\n
portal_type=sale_order_line_portal_type,\n
resource=setup_service_relative_url,\n
resource=setup_service_relative_url,\n
quantity=1,\n
quantity=1,\n
price=0,\n
price=0,\n
aggregate_value_list=[software_instance, subscription, software_release_document],\n
aggregate_value_list=[software_instance, subscription, software_release_document],\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
)\n
)\n
portal.portal_workflow.doActionFor(sale_order, "order_action")\n
portal.portal_workflow.doActionFor(sale_order, "order_action")\n
\n
\n
# Update Open Order\n
# Update Open Order\n
# does this order have a client-specific Open Order\n
# does this order have a client-specific Open Order\n
open_order = portal.portal_catalog.getResultValue(\n
open_order = portal.portal_catalog.getResultValue(\n
default_destination_section_uid=person.getUid(),\n
default_destination_section_uid=person.getUid(),\n
portal_type="Open Sale Order",\n
portal_type="Open Sale Order",\n
validation_state="validated")\n
validation_state="validated")\n
if open_order is None:\n
if open_order is None:\n
person_slap_interface_state = person.getSlapState()\n
person_slap_interface_state = person.getSlapState()\n
if person_slap_interface_state == \'open_order_created\':\n
if person_slap_interface_state == \'open_order_created\':\n
open_order_url = context.portal_workflow.getInfoFor(\n
open_order_url = context.portal_workflow.getInfoFor(\n
ob=person, name=\'open_order_url\',\n
ob=person, name=\'open_order_url\',\n
wf_id=\'person_slap_interface_workflow\')\n
wf_id=\'person_slap_interface_workflow\')\n
open_order = portal.restrictedTraverse(open_order_url)\n
open_order = portal.restrictedTraverse(open_order_url)\n
pass\n
else:\n
else:\n
raise ValueError(\'Person has no open order created\')\n
raise ValueError(\'Person has no open order created\')\n
\n
\n
now = DateTime()\n
now = DateTime()\n
start_date = getClosestDate(target_date=now, precision=\'day\', before=1)\n
start_date = getClosestDate(target_date=now, precision=\'day\', before=1)\n
# 12 months of subscription by default\n
# 12 months of subscription by default\n
stop_date = addToDate(getClosestDate(target_date=now, precision=\'month\', before=1), year=1)\n
stop_date = addToDate(getClosestDate(target_date=now, precision=\'month\', before=1), year=1)\n
\n
\n
subscription_service_relative_url = portal.portal_preferences.getPreferredInstanceSubscriptionResource()\n
subscription_service_relative_url = portal.portal_preferences.getPreferredInstanceSubscriptionResource()\n
open_order.newContent(\n
open_order.newContent(\n
portal_type="Open Sale Order Line",\n
portal_type="Open Sale Order Line",\n
title=software_title,\n
title=software_title,\n
aggregate_value=subscription,\n
aggregate_value=subscription,\n
start_date=start_date,\n
start_date=start_date,\n
stop_date=stop_date,\n
stop_date=stop_date,\n
quantity=1,\n
quantity=1,\n
quantity_unit="unit/piece",\n
quantity_unit="unit/piece",\n
price=1,\n
price=1,\n
price_currency="currency_module/EUR",\n
price_currency="currency_module/EUR",\n
specialise=sale_order.getSpecialise(portal_type="Sale Trade Condition"),\n
specialise=sale_order.getSpecialise(portal_type="Sale Trade Condition"),\n
# XXX Hardcoded values\\n\n
# XXX Hardcoded values\\n\n
resource=subscription_service_relative_url,\n
resource=subscription_service_relative_url,\n
destination_value=person,\n
destination_value=person,\n
destination_section_value=person,\n
destination_section_value=person,\n
source="organisation_module/vifib_internet",\n
source="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
)\n
)\n
\n
\n
# Find Computer partition\n
# Find Computer partition\n
# XXX Link subscript to open order\n
# XXX Link subscript to open order\n
else:\n
else:\n
# Update existing software instance\n
# Update existing software instance\n
request_
hosting_subscription
.edit(\n
request_
software_instance
.edit(\n
text_content=instance_xml,\n
text_content=instance_xml,\n
source_reference=software_type,\n
source_reference=software_type,\n
sla_xml=sla_xml,\n
sla_xml=sla_xml,\n
root_state=state,\n
software_release_url=software_release_url_string,\n
root_slave=is_slave,\n
activate_kw={\'tag\': tag},\n
activate_kw={\'tag\': tag},\n
)\n
)\n
requested_software_instance = request_hosting_subscription\\\n
if state == \'started\':\n
.HostingSubscription_requestRootSoftwareInstance(tag)\n
request_software_instance.startRequested()\n
request_software_instance.activate(after_tag=tag).requestStartComputerPartition()\n
elif state == \'stopped\':\n
request_software_instance.stopRequested()\n
request_software_instance.activate(after_tag=tag).requestStopComputerPartition()\n
]]>
</string>
</value>
]]>
</string>
</value>
...
...
master/bt5/vifib_slap/bt/revision
View file @
6a4aed6e
492
493
\ No newline at end of file
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