forked from 3wordchant/capsul-flask
Add latest openbsd and alpine support
This commit is contained in:
parent
f02974eb5a
commit
cd92e8486d
@ -14,7 +14,7 @@ def init_app(app):
|
||||
databaseUrl = urlparse(app.config['DATABASE_URL'])
|
||||
|
||||
app.config['PSYCOPG2_CONNECTION_POOL'] = psycopg2.pool.SimpleConnectionPool(
|
||||
1,
|
||||
1,
|
||||
20,
|
||||
user = databaseUrl.username,
|
||||
password = databaseUrl.password,
|
||||
@ -34,13 +34,13 @@ def init_app(app):
|
||||
key = result.group()
|
||||
with open(join(schemaMigrationsPath, filename), 'rb') as file:
|
||||
schemaMigrations[key] = file.read().decode("utf8")
|
||||
|
||||
|
||||
connection = app.config['PSYCOPG2_CONNECTION_POOL'].getconn()
|
||||
|
||||
hasSchemaVersionTable = False
|
||||
actionWasTaken = False
|
||||
schemaVersion = 0
|
||||
desiredSchemaVersion = 7
|
||||
desiredSchemaVersion = 8
|
||||
|
||||
cursor = connection.cursor()
|
||||
|
||||
@ -95,11 +95,11 @@ def init_app(app):
|
||||
if schemaVersion != versionFromDatabase:
|
||||
app.logger.critical("incorrect schema version value \"{}\" after running migration {}, expected \"{}\". exiting.".format(
|
||||
versionFromDatabase,
|
||||
migrationKey,
|
||||
migrationKey,
|
||||
schemaVersion
|
||||
))
|
||||
exit(1)
|
||||
|
||||
|
||||
cursor.close()
|
||||
|
||||
app.config['PSYCOPG2_CONNECTION_POOL'].putconn(connection)
|
||||
|
31
capsulflask/schema_migrations/08_down_various_os_updates.sql
Normal file
31
capsulflask/schema_migrations/08_down_various_os_updates.sql
Normal 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;
|
34
capsulflask/schema_migrations/08_up_various_os_updates.sql
Normal file
34
capsulflask/schema_migrations/08_up_various_os_updates.sql
Normal 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;
|
Loading…
Reference in New Issue
Block a user