Commit 939a70fc authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

slap: default software type is now 'default'

See merge request nexedi/slapos.core!677
parent 47784ddb
...@@ -35,7 +35,8 @@ import re ...@@ -35,7 +35,8 @@ import re
import os import os
from datetime import datetime from datetime import datetime
from slapos.slap.slap import Computer, ComputerPartition, \ from slapos.slap.slap import Computer, ComputerPartition, \
SoftwareRelease, SoftwareInstance, NotFoundError SoftwareRelease, SoftwareInstance, NotFoundError, \
DEFAULT_SOFTWARE_TYPE, OLD_DEFAULT_SOFTWARE_TYPE
from slapos.proxy.db_version import DB_VERSION from slapos.proxy.db_version import DB_VERSION
import slapos.slap import slapos.slap
from slapos.util import bytes2str, unicode2str, sqlite_connect, \ from slapos.util import bytes2str, unicode2str, sqlite_connect, \
...@@ -478,7 +479,7 @@ def requestComputerPartition(): ...@@ -478,7 +479,7 @@ def requestComputerPartition():
'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg',
) )
if parsed_request_dict['software_release'] in apache_frontend_sr_url_list \ if parsed_request_dict['software_release'] in apache_frontend_sr_url_list \
and parsed_request_dict.get('software_type', '') in ('', 'RootSoftwareInstance', 'default'): and parsed_request_dict.get('software_type', '') in ('', OLD_DEFAULT_SOFTWARE_TYPE, DEFAULT_SOFTWARE_TYPE):
url = parsed_request_dict['partition_parameter_kw'].get('url') url = parsed_request_dict['partition_parameter_kw'].get('url')
if url: if url:
app.logger.warning("Bypassing frontend for %s => %s", parsed_request_dict, url) app.logger.warning("Bypassing frontend for %s => %s", parsed_request_dict, url)
...@@ -795,7 +796,7 @@ def requestNotSlave(software_release, software_type, partition_reference, partit ...@@ -795,7 +796,7 @@ def requestNotSlave(software_release, software_type, partition_reference, partit
q += ' ,requested_by=?' q += ' ,requested_by=?'
a(partition_id) a(partition_id)
if not software_type: if not software_type:
software_type = 'RootSoftwareInstance' software_type = DEFAULT_SOFTWARE_TYPE
else: else:
if partition['requested_by']: if partition['requested_by']:
root_partition = getRootPartition(partition['requested_by']) root_partition = getRootPartition(partition['requested_by'])
......
...@@ -70,7 +70,8 @@ fallback_logger.setLevel(logging.INFO) ...@@ -70,7 +70,8 @@ fallback_logger.setLevel(logging.INFO)
fallback_logger.addHandler(fallback_handler) fallback_logger.addHandler(fallback_handler)
DEFAULT_SOFTWARE_TYPE = 'RootSoftwareInstance' OLD_DEFAULT_SOFTWARE_TYPE = 'RootSoftwareInstance'
DEFAULT_SOFTWARE_TYPE = 'default'
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME = '.slapos-request-transaction-%s' COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME = '.slapos-request-transaction-%s'
class SlapDocument: class SlapDocument:
......
...@@ -487,12 +487,12 @@ class SoftwareReleaseSchema(object): ...@@ -487,12 +487,12 @@ class SoftwareReleaseSchema(object):
def __init__(self, software_url, software_type): def __init__(self, software_url, software_type):
# type: (str, Optional[str]) -> None # type: (str, Optional[str]) -> None
self.software_url = software_url self.software_url = software_url
# XXX: Transition from DEFAULT_SOFTWARE_TYPE ("RootSoftwareInstance") # XXX: Transition from OLD_DEFAULT_SOFTWARE_TYPE ("RootSoftwareInstance")
# to "default" is already complete for SR schemas. # to DEFAULT_SOFTWARE_TYPE ("default") is already complete for SR schemas.
from slapos.slap.slap import DEFAULT_SOFTWARE_TYPE from slapos.slap.slap import OLD_DEFAULT_SOFTWARE_TYPE, DEFAULT_SOFTWARE_TYPE
if software_type == DEFAULT_SOFTWARE_TYPE: if software_type == OLD_DEFAULT_SOFTWARE_TYPE:
software_type = None software_type = None
self.software_type = software_type or 'default' self.software_type = software_type or DEFAULT_SOFTWARE_TYPE
def _warn(self, message, e): def _warn(self, message, e):
warnings.warn( warnings.warn(
......
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