Commit 836a2cb9 authored by Rafael Monnerat's avatar Rafael Monnerat

Accept and process product.XXX as software release

 This api follows up the change done on slapos node client which
 let's the master decide the best or latest URL for a desired product.
parent 21f1d1bc
......@@ -29,9 +29,11 @@ from zc.buildout import UserError
from slapos.recipe.librecipe import wrap, JSON_SERIALISED_MAGIC_KEY
import json
from slapos import slap as slapmodule
from slapos.slap import SoftwareProductCollection
import slapos.recipe.librecipe.generic as librecipe
import traceback
SOFTWARE_PRODUCT_NAMESPACE = "product."
DEFAULT_SOFTWARE_TYPE = 'RootSoftwareInstance'
class Recipe(object):
......@@ -130,6 +132,19 @@ class Recipe(object):
options['computer-id'],
options['partition-id'],
).request
if software_url is not None and \
software_url.startswith(SOFTWARE_PRODUCT_NAMESPACE):
product = SoftwareProductCollection(self.logger, slap)
try:
software_url = product.__getattr__(
software_url[len(SOFTWARE_PRODUCT_NAMESPACE):])
except AttributeError as e:
self.logger.warning('Error on get software release : %s ' % e.message)
self._raise_request_exception = None
self._raise_request_exception_formatted = None
self.instance = None
......
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