diff --git a/do_tests.py b/do_tests.py index 89126f315e0647c0ca999fc2291c8cce12eddf7c_ZG9fdGVzdHMucHk=..d4a964711550af3030c0bfe32e25fa930180e7ab_ZG9fdGVzdHMucHk= 100755 --- a/do_tests.py +++ b/do_tests.py @@ -170,7 +170,7 @@ c = configparser.ConfigParser() if not os.path.exists(setup_path): - logging.fatal('Missing %s', setup_path) + _logger.fatal('Missing %s', setup_path) return 12 c.read(setup_path) @@ -192,9 +192,9 @@ c.has_option('odoo_scripts', 'postgresql_version') and c.get('odoo_scripts', 'postgresql_version')) or '9.6' image = "%s/%s:latest" % (registry, project) - logging.debug("Docker image: %s", image) + _logger.debug("Docker image: %s", image) # read from odoo.conf if it exists sample_conf = 'conf/dev/odoo.conf' if os.path.exists(sample_conf): @@ -196,9 +196,9 @@ # read from odoo.conf if it exists sample_conf = 'conf/dev/odoo.conf' if os.path.exists(sample_conf): - logging.info('Reading from sample configuration %s', sample_conf) + _logger.info('Reading from sample configuration %s', sample_conf) c.read(sample_conf) if not odoo_db_user: if c.has_option('options', 'db_user'): @@ -220,7 +220,7 @@ ): extensions.append('unaccent') else: - logging.debug('No sample configuration %s', sample_conf) + _logger.debug('No sample configuration %s', sample_conf) extensions.append('unaccent') # Do stuff diff --git a/docker_dev_start.py b/docker_dev_start.py index 89126f315e0647c0ca999fc2291c8cce12eddf7c_ZG9ja2VyX2Rldl9zdGFydC5weQ==..d4a964711550af3030c0bfe32e25fa930180e7ab_ZG9ja2VyX2Rldl9zdGFydC5weQ== 100755 --- a/docker_dev_start.py +++ b/docker_dev_start.py @@ -60,6 +60,6 @@ """Run flake8 if found """ if which('flake8'): - logging.info('Running flake8') + _logger.info('Running flake8') call(['flake8']) else: @@ -64,6 +64,6 @@ call(['flake8']) else: - logging.warning('No flake8 in PATH') + _logger.warning('No flake8 in PATH') def main(argv=None): # IGNORE:C0111 @@ -280,8 +280,8 @@ if restore_filename: if not database: - logging.fatal('No database name given for restore') + _logger.fatal('No database name given for restore') return 13 c = ConfigParser() if not os.path.exists(setup_path): @@ -284,8 +284,8 @@ return 13 c = ConfigParser() if not os.path.exists(setup_path): - logging.fatal('Missing %s', setup_path) + _logger.fatal('Missing %s', setup_path) return 12 c.read(setup_path) @@ -293,7 +293,7 @@ if c.has_option('odoo_scripts', 'modules'): for entry in c.get('odoo_scripts', 'modules').split(): modules.extend(glob.glob(entry)) - logging.debug("addon modules: %s", modules) + _logger.debug("addon modules: %s", modules) registry = ( c.has_section('odoo_scripts') and @@ -312,8 +312,8 @@ c.has_section('odoo_scripts') and c.has_option('odoo_scripts', 'postgresql_version') and c.get('odoo_scripts', 'postgresql_version')) or '9.6' - logging.debug("Docker image: %s", image) + _logger.debug("Docker image: %s", image) # detect if docker image already exists docker_client = docker_api(base_url='unix://var/run/docker.sock') image_list = docker_client.images(name=image, quiet=True) if not image_list: @@ -316,6 +316,6 @@ # detect if docker image already exists docker_client = docker_api(base_url='unix://var/run/docker.sock') image_list = docker_client.images(name=image, quiet=True) if not image_list: - logging.info("Image %s does not exist", image) + _logger.info("Image %s does not exist", image) else: @@ -321,3 +321,3 @@ else: - logging.info("Image %s exists", image) + _logger.info("Image %s exists", image) if (not image_list and not nmspc.no_build) or nmspc.force_build: @@ -323,5 +323,5 @@ if (not image_list and not nmspc.no_build) or nmspc.force_build: - logging.info("Building image %s", image) + _logger.info("Building image %s", image) import docker_build arguments = [ '--dev' @@ -416,7 +416,7 @@ if addresses: local_ip = addresses[0] except ImportError: - logging.warn("Consider installing python netifaces" + _logger.warn("Consider installing python netifaces" " to ease local IP detection") if not local_ip: import socket @@ -420,7 +420,7 @@ " to ease local IP detection") if not local_ip: import socket - logging.info('Contacting Google Public DNS to find our IP') + _logger.info('Contacting Google Public DNS to find our IP') local_ip = [ ( s.connect(('8.8.8.8', 53)), @@ -430,7 +430,7 @@ socket.socket(socket.AF_INET, socket.SOCK_DGRAM)] ][0][1] - logging.debug('IP found %s', local_ip) + _logger.debug('IP found %s', local_ip) arg.append('--db_host') arg.append(local_ip) @@ -445,7 +445,7 @@ user = db_user password = db_password if os.path.isfile(local_conf_path): - logging.info('Local configuration file found: %s' % local_conf_path) + _logger.info('Local configuration file found: %s' % local_conf_path) binds.append('%s:/opt/odoo/etc' % os.path.join( project_path, local_conf_dir)) cp_local = ConfigParser() @@ -466,7 +466,7 @@ # data volume handling if odoo_type != 'odoo7': data_volume_name = '{}_data'.format(project_name) - logging.debug('Using data volume %s', data_volume_name) + _logger.debug('Using data volume %s', data_volume_name) createVolume(docker_client, data_volume_name) # make sure the permission in the volume are correct mount_opts = '{}:/mnt/data'.format(data_volume_name) @@ -479,7 +479,7 @@ binds.append('{}:/mnt/data'.format(data_volume_name)) arg.append('--data-dir /mnt/data') else: - logging.debug('No data volume for this odoo version') + _logger.debug('No data volume for this odoo version') # avoid the duplication of unbind volumes with all addons # additionnal_addons only in odoo < 10 @@ -518,9 +518,9 @@ except OperationalError as exception: if nmspc.create_user: - logging.debug('Cannot connect to database with user %s', user) - logging.debug(exception) - logging.info('Creating user %s', user) + _logger.debug('Cannot connect to database with user %s', user) + _logger.debug(exception) + _logger.info('Creating user %s', user) if start_postgresql: connection = connect( user='pg', @@ -540,5 +540,5 @@ connection.commit() connection.close() else: - logging.fatal( + _logger.fatal( 'Cannot connect to database with user %s', user) @@ -544,8 +544,8 @@ 'Cannot connect to database with user %s', user) - logging.fatal(exception) - logging.info( + _logger.fatal(exception) + _logger.info( "You can add the --create-user argument to create it") return 16 # restore if restore_filename: restore_basename = os.path.basename(restore_filename) @@ -547,9 +547,9 @@ "You can add the --create-user argument to create it") return 16 # restore if restore_filename: restore_basename = os.path.basename(restore_filename) - logging.info("Copying dump file in docker") + _logger.info("Copying dump file in docker") call([ 'docker', 'cp', restore_filename, '{}:/tmp/{}'.format(name, restore_basename)]) @@ -553,6 +553,6 @@ call([ 'docker', 'cp', restore_filename, '{}:/tmp/{}'.format(name, restore_basename)]) - logging.info("Creating database") + _logger.info("Creating database") call([ 'docker', 'exec', name, 'createdb', '-U', user, database]) @@ -557,8 +557,8 @@ call([ 'docker', 'exec', name, 'createdb', '-U', user, database]) - logging.info("Restoring database") + _logger.info("Restoring database") restore = call([ 'docker', 'exec', name, 'pg_restore', '-U', user, '-O', '-d', database, '/tmp/{}'.format(restore_basename)]) if not restore: return 15 @@ -560,9 +560,9 @@ restore = call([ 'docker', 'exec', name, 'pg_restore', '-U', user, '-O', '-d', database, '/tmp/{}'.format(restore_basename)]) if not restore: return 15 - logging.info("Removing dump file in docker") + _logger.info("Removing dump file in docker") call(['docker', 'exec', name, '/tmp/{}'.format(restore_basename)]) if not start_postgresql and not odoo_help and restore_filename: @@ -566,8 +566,8 @@ call(['docker', 'exec', name, '/tmp/{}'.format(restore_basename)]) if not start_postgresql and not odoo_help and restore_filename: - logging.info("Creating database %s", database) + _logger.info("Creating database %s", database) createdb = call([ 'createdb', '-U', user, database]) if not createdb: return 17 @@ -570,8 +570,8 @@ createdb = call([ 'createdb', '-U', user, database]) if not createdb: return 17 - logging.info("Restoring database %s", database) + _logger.info("Restoring database %s", database) restore = call([ 'pg_restore', '-U', user, '-O', '-d', database, restore_filename]) @@ -614,7 +614,7 @@ cmd.extend(options) cmd.append(image) cmd.extend(arg) - logging.debug(' '.join(cmd)) + _logger.debug(' '.join(cmd)) result = call(cmd) return result @@ -624,6 +624,6 @@ """ volumes = docker_client.volumes(filters={'name': data_volume_name}) if volumes['Volumes']: - logging.debug('Volume %s already exist', data_volume_name) + _logger.debug('Volume %s already exist', data_volume_name) return volumes['Volumes'][0] else: @@ -628,6 +628,6 @@ return volumes['Volumes'][0] else: - logging.debug('Creating volume %s', data_volume_name) + _logger.debug('Creating volume %s', data_volume_name) return docker_client.create_volume(name=data_volume_name)