diff --git a/master/tests/__init__.py b/master/tests/__init__.py index ea518c2af356636f10ab9f064d195878dab64fa3..832ba4570c291b6b1282d420f92bcfb2cc029729 100644 --- a/master/tests/__init__.py +++ b/master/tests/__init__.py @@ -1,4 +1,22 @@ from test_suite import SavedTestSuite, ProjectTestSuite class VIFIB(SavedTestSuite, ProjectTestSuite): + _bt_list = [ + 'erp5_configurator_vifib', + 'vifib_base', + 'vifib_core', + 'vifib_crm', + 'vifib_data', + 'vifib_data_category', + 'vifib_data_web', + 'vifib_erp5', + 'vifib_forge_release', + 'vifib_l10n_fr', + 'vifib_mysql_innodb_catalog', + 'vifib_open_trade', + 'vifib_slap', + 'vifib_software_pdm', + 'vifib_upgrader', + 'vifib_web', + ] _product_list = ['Vifib'] _saved_test_id = 'Products.Vifib.tests.VifibMixin' diff --git a/slapos/console.py b/slapos/console.py index a12248309ed6f0d8e4ec8f675bcfdd0f15f43463..75caf8cd0b2377c99f143d6f557e1b7626f6be54 100644 --- a/slapos/console.py +++ b/slapos/console.py @@ -29,6 +29,7 @@ import slapos.slap.slap from slapos.slap import ResourceNotReady import sys +import os from optparse import OptionParser, Option import ConfigParser @@ -61,6 +62,19 @@ class Parser(OptionParser): (options, args) = self.parse_args() if len(args) == 0: self.error("Incorrect number of arguments") + elif not os.path.isfile(args[0]): + self.error("%s: Not found or not a regular file." % args[0]) + + return options, args + +class RequestParser(Parser): + def check_args(self): + """ + Check arguments + """ + (options, args) = Parser.check_args(self) + if len(args) < 3: + self.error("Incorrect number of arguments") return options, args @@ -77,16 +91,22 @@ class Config: configuration_parser = ConfigParser.SafeConfigParser() configuration_parser.read(configuration_file_path) # Merges the arguments and configuration - for section in ("slapconsole",): - configuration_dict = dict(configuration_parser.items(section)) - for key in configuration_dict: - if not getattr(self, key, None): + for section in ('slapos', 'slapconsole'): + try: + configuration_dict = dict(configuration_parser.items(section)) + except ConfigParser.NoSectionError: + pass + else: + for key in configuration_dict: setattr(self, key, configuration_dict[key]) - configuration_dict = dict(configuration_parser.items('slapos')) - setattr(self, 'master_url', configuration_dict['master_url']) - - if not self.master_url: - raise ValueError('master_url is required.') + + master_url = getattr(self, 'master_url', None) + if not master_url: + raise ValueError("No option 'master_url'") + elif master_url.startswith('https') and \ + not getattr(self, 'key_file', None) and \ + not getattr(self, 'cert_file', None): + raise ValueError("No option 'key_file' and/or 'cert_file'") def init(config): @@ -98,7 +118,10 @@ def init(config): local = globals().copy() local['slap'] = slap # Create aliases as global variables - alias = config.alias.split('\n') + try: + alias = config.alias.split('\n') + except AttributeError: + alias = [] software_list = [] for software in alias: if software is not '': @@ -120,8 +143,8 @@ def request(): usage = """usage: %s [options] CONFIGURATION_FILE SOFTWARE_INSTANCE INSTANCE_REFERENCE slapos-request allows you to request slapos instances.""" % sys.argv[0] config = Config() - arguments = Parser(usage=usage).check_args()[1] - config.setConfig(*Parser(usage=usage).check_args()) + options, arguments = RequestParser(usage=usage).check_args() + config.setConfig(options, arguments[0]) local = init(config) diff --git a/slapos/grid/slapgrid.py b/slapos/grid/slapgrid.py index b881d85c0bb43a9646d4d885e55f7ca142b32fad..622a09e3f70d2cd8b29abfe032b6a5fbe34f7c6c 100644 --- a/slapos/grid/slapgrid.py +++ b/slapos/grid/slapgrid.py @@ -623,7 +623,7 @@ class Slapgrid(object): server_url=self.master_url, software_release_url=software_url, certificate_repository_path=self.certificate_repository_path, - console=self.console + console=self.console, buildout=self.buildout ) if computer_partition.getState() == "destroyed": try: