Commit 5cd5fd9a authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slapos_jio_api_style: Move to JIO API Revision depending on jio web section

parent 6d66eff8
# Hardcoded
limit = 1000
web_section = context.getWebSectionValue()
web_section = web_section.getRelativeUrl() if web_section else context.REQUEST.get("web_section_relative_url", None)
search_kw = {
"portal_type": "Compute Node",
"validation_state": "validated",
"select_list": ("title", "reference", "portal_type", "jio_api_revision.revision"),
"jio_api_revision.web_section": web_section,
"sort_on": ("jio_api_revision.revision", "ASC"),
"limit": limit,
}
......
......@@ -4,6 +4,9 @@ portal = context.getPortalObject()
# Hardcoded
limit = 1000
web_section = context.getWebSectionValue()
web_section = web_section.getRelativeUrl() if web_section else context.REQUEST.get("web_section_relative_url", None)
reverse_slap_state_dict = {
"stopped": "stop_requested",
"started": "start_requested",
......@@ -20,6 +23,7 @@ if portal_type == "Software Instance":
search_kw = {
"portal_type": "Software Instance",
"validation_state": "validated",
"jio_api_revision.web_section": web_section,
"select_list": ("title", "reference", "portal_type", "slap_state", "aggregate_reference", "url_string", "jio_api_revision.revision"),
"sort_on": ("jio_api_revision.revision", "ASC"),
"limit": limit
......@@ -55,6 +59,7 @@ elif portal_type == "Shared Instance":
search_kw = {
"portal_type": "Slave Instance",
"validation_state": "validated",
"jio_api_revision.web_section": web_section,
"select_list": ("title", "reference", "portal_type", "slap_state", "aggregate_reference", "jio_api_revision.revision"),
"sort_on": ("jio_api_revision.revision", "ASC"),
"limit": limit
......
# Hardcoded
limit = 1000
web_section = context.getWebSectionValue()
web_section = web_section.getRelativeUrl() if web_section else context.REQUEST.get("web_section_relative_url", None)
search_kw = {
"portal_type": "Software Installation",
"validation_state": "validated",
"jio_api_revision.web_section": web_section,
"select_list": ("aggregate_reference", "url_string", "slap_state", "portal_type", "slap_date", "jio_api_revision.revision"),
"sort_on": ("jio_api_revision.revision", "ASC"),
"limit": limit,
......
select
catalog.uid,
catalog.relative_url
catalog.relative_url,
catalog.portal_type
from
catalog
left outer join
......@@ -8,7 +9,9 @@ left outer join
join
slapos_item on catalog.uid = slapos_item.uid
where
jio_api_revision.uid IS NULL
(jio_api_revision.uid IS NULL
OR jio_api_revision.web_section!=<dtml-sqlvar expr="web_section" type="string" optional>)
AND (catalog.portal_type="Slave Instance" OR catalog.portal_type="Software Instance")
AND slapos_item.slap_state!="draft"
AND catalog.validation_state="validated"
......@@ -25,7 +25,7 @@
</item>
<item>
<key> <string>width</string> </key>
<value> <int>6</int> </value>
<value> <int>0</int> </value>
</item>
</dictionary>
<dictionary>
......@@ -43,7 +43,25 @@
</item>
<item>
<key> <string>width</string> </key>
<value> <int>42</int> </value>
<value> <int>0</int> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>name</string> </key>
<value> <string>portal_type</string> </value>
</item>
<item>
<key> <string>null</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>t</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</list>
......@@ -51,7 +69,7 @@
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
<value> <string>web_section</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
......
return list(context.Base_zSelectMissingJIOAPIRevisionInstanceList()) + list(context.Base_zSelectMissingJIOAPIRevisionSoftwareAndComputeList())
return list(context.Base_zSelectMissingJIOAPIRevisionInstanceList(web_section=web_section)) \
+ list(context.Base_zSelectMissingJIOAPIRevisionSoftwareAndComputeList(web_section=web_section))
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>web_section</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
select
catalog.uid,
catalog.relative_url
catalog.relative_url,
catalog.portal_type
from
catalog
left outer join
jio_api_revision on catalog.uid = jio_api_revision.uid
where
jio_api_revision.uid IS NULL
(jio_api_revision.uid IS NULL
OR jio_api_revision.web_section!=<dtml-sqlvar expr="web_section" type="string">)
AND (catalog.portal_type="Compute Node" OR catalog.portal_type="Software Installation")
AND catalog.validation_state="validated"
......@@ -43,7 +43,25 @@
</item>
<item>
<key> <string>width</string> </key>
<value> <int>42</int> </value>
<value> <int>43</int> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>name</string> </key>
<value> <string>portal_type</string> </value>
</item>
<item>
<key> <string>null</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>t</string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>21</int> </value>
</item>
</dictionary>
</list>
......@@ -51,7 +69,7 @@
</item>
<item>
<key> <string>arguments_src</string> </key>
<value> <string></string> </value>
<value> <string>web_section</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<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>SlaveInstance_calculatejIOAPIRevisionHash</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment