Add latest openbsd and alpine support

This commit is contained in:
j3s 2020-10-29 21:25:29 -05:00
parent f02974eb5a
commit cd92e8486d
3 changed files with 70 additions and 5 deletions

View File

@ -14,7 +14,7 @@ def init_app(app):
databaseUrl = urlparse(app.config['DATABASE_URL']) databaseUrl = urlparse(app.config['DATABASE_URL'])
app.config['PSYCOPG2_CONNECTION_POOL'] = psycopg2.pool.SimpleConnectionPool( app.config['PSYCOPG2_CONNECTION_POOL'] = psycopg2.pool.SimpleConnectionPool(
1, 1,
20, 20,
user = databaseUrl.username, user = databaseUrl.username,
password = databaseUrl.password, password = databaseUrl.password,
@ -34,13 +34,13 @@ def init_app(app):
key = result.group() key = result.group()
with open(join(schemaMigrationsPath, filename), 'rb') as file: with open(join(schemaMigrationsPath, filename), 'rb') as file:
schemaMigrations[key] = file.read().decode("utf8") schemaMigrations[key] = file.read().decode("utf8")
connection = app.config['PSYCOPG2_CONNECTION_POOL'].getconn() connection = app.config['PSYCOPG2_CONNECTION_POOL'].getconn()
hasSchemaVersionTable = False hasSchemaVersionTable = False
actionWasTaken = False actionWasTaken = False
schemaVersion = 0 schemaVersion = 0
desiredSchemaVersion = 7 desiredSchemaVersion = 8
cursor = connection.cursor() cursor = connection.cursor()
@ -95,11 +95,11 @@ def init_app(app):
if schemaVersion != versionFromDatabase: if schemaVersion != versionFromDatabase:
app.logger.critical("incorrect schema version value \"{}\" after running migration {}, expected \"{}\". exiting.".format( app.logger.critical("incorrect schema version value \"{}\" after running migration {}, expected \"{}\". exiting.".format(
versionFromDatabase, versionFromDatabase,
migrationKey, migrationKey,
schemaVersion schemaVersion
)) ))
exit(1) exit(1)
cursor.close() cursor.close()
app.config['PSYCOPG2_CONNECTION_POOL'].putconn(connection) app.config['PSYCOPG2_CONNECTION_POOL'].putconn(connection)

View File

@ -0,0 +1,31 @@
DELETE FROM os_images WHERE id = 'openbsd68';
DELETE FROM os_images WHERE id = 'alpine312';
UPDATE os_images SET deprecated = FALSE WHERE id = 'openbsd67';
UPDATE os_images SET deprecated = FALSE WHERE id = 'alpine311';
UPDATE os_images SET template_image_file_name = 'ubuntu-18.04-minimal-cloudimg-amd64.img'
WHERE id = 'ubuntu18';
UPDATE os_images SET template_image_file_name = 'openbsd-cloud-2020-05.qcow2'
WHERE id = 'openbsd66';
UPDATE os_images SET template_image_file_name = 'openbsd67.img'
WHERE id = 'openbsd67';
UPDATE os_images SET template_image_file_name = 'ubuntu20.img'
WHERE id = 'ubuntu20';
UPDATE os_images SET template_image_file_name = 'debian10.img'
WHERE id = 'debian10';
UPDATE os_images SET template_image_file_name = 'centos7.img'
WHERE id = 'centos7';
UPDATE os_images SET template_image_file_name = 'centos8.img'
WHERE id = 'centos8';
UPDATE os_images SET template_image_file_name = 'guixsystem-cloud-2020-05.qcow2'
WHERE id = 'guix110';
UPDATE schemaversion SET version = 7;

View File

@ -0,0 +1,34 @@
INSERT INTO os_images (id, template_image_file_name, description, deprecated)
VALUES ('openbsd68', 'openbsd/6.8/root.img.qcow2', 'OpenBSD 6.8', FALSE);
INSERT INTO os_images (id, template_image_file_name, description, deprecated)
VALUES ('alpine312', 'alpine/3.12/root.img.qcow2', 'Alpine Linux 3.12', FALSE);
UPDATE os_images SET deprecated = TRUE WHERE id = 'openbsd67';
UPDATE os_images SET deprecated = TRUE WHERE id = 'alpine311';
UPDATE os_images SET template_image_file_name = 'ubuntu/18.04/root.img.qcow2'
WHERE id = 'ubuntu18';
UPDATE os_images SET template_image_file_name = 'openbsd/6.6/root.img.qcow2'
WHERE id = 'openbsd66';
UPDATE os_images SET template_image_file_name = 'openbsd/6.7/root.img.qcow2'
WHERE id = 'openbsd67';
UPDATE os_images SET template_image_file_name = 'ubuntu/20.04/root.img.qcow2'
WHERE id = 'ubuntu20';
UPDATE os_images SET template_image_file_name = 'debian/10/root.img.qcow2'
WHERE id = 'debian10';
UPDATE os_images SET template_image_file_name = 'centos/7/root.img.qcow2'
WHERE id = 'centos7';
UPDATE os_images SET template_image_file_name = 'centos/8/root.img.qcow2'
WHERE id = 'centos8';
UPDATE os_images SET template_image_file_name = 'guix/1.10/root.img.qcow2'
WHERE id = 'guix110';
UPDATE schemaversion SET version = 8;