Commit e2915dc6 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Do not require a registered software release for check usage.

If the Software Release didn't exist, the values were been presented wrongly.
parent d62fa8e3
......@@ -6,4 +6,4 @@ else:
computer = current
software_release = context
return computer.Computer_getSoftwareReleaseUsage(software_release.getUid())
return computer.Computer_getSoftwareReleaseUsage(software_release.getUrlString())
......@@ -7,5 +7,5 @@ return portal.portal_catalog.countResults(
portal_type='Computer Partition',
parent_uid=computer.getUid(),
free_for_request=0,
software_release_url=portal.portal_catalog.getResultValue(uid=software_release_uid).getUrlString()
software_release_url=software_release_url
)[0][0]
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>software_release_uid</string> </value>
<value> <string>software_release_url</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -2,7 +2,7 @@ list = []
for si in context.portal_catalog(url_string=context.getUrlString(), portal_type='Software Installation', validation_state='validated'):
computer = si.getAggregateValue()
if si.getSlapState() == 'start_requested' and \
not computer.Computer_getSoftwareReleaseUsage(context.getUid()) \
not computer.Computer_getSoftwareReleaseUsage(context.getUrlString()) \
and computer.getValidationState() == 'validated':
list.append(computer)
......
......@@ -10,7 +10,7 @@ if len(uids) and software_release:
dialog = "SoftwareRelease_viewUsableComputerList"
for computer in portal.portal_catalog(uid=uids, portal_type="Computer"):
# XXX - We won't destroy Software release if it used on this computer
if not computer.Computer_getSoftwareReleaseUsage(software_release.getUid()):
if not computer.Computer_getSoftwareReleaseUsage(software_release.getUrlString()):
computer.requestSoftwareRelease(software_release_url=url_string,
state='destroyed')
item_count += 1
......
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