From 9fc318b2e5906e73ec6ef9a891126c572d3215eb Mon Sep 17 00:00:00 2001 From: Liam Young Date: Tue, 17 Apr 2018 07:45:20 +0000 Subject: [PATCH] Add bionic support This change is mostly a port of the change authored by mthaddon to add bionic support to the charm. As noted in the readme postgres 10 is currently not supported so the corresponding functional test uses a xenial postgresql node. Change-Id: I3f11f024ced8aa5ae58135d5e5e23ed94d4c31f9 --- src/README.md | 4 +++- src/metadata.yaml | 2 +- src/reactive/vault.py | 2 +- src/tests/bundles/bionic-postgres.yaml | 13 +++++++++++++ src/tests/tests.yaml | 1 + 5 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/tests/bundles/bionic-postgres.yaml diff --git a/src/README.md b/src/README.md index 31386d9..3196ef7 100644 --- a/src/README.md +++ b/src/README.md @@ -11,7 +11,9 @@ SSH credentials, and more. ## About the Charm This charm installs Vault from the Ubuntu Snap Store and -supports the PostgreSQL storage backend only. +supports the PostgreSQL and MySQL storage backends. Note that Vault itself +does not support PostgreSQL 10, so neither does this charm. If you're +deploying on bionic, you'll need to deploy a 9.x version of PostgreSQL. After deploying and relating the charm to postgresql, install the vault snap locally and use "vault init" to create the diff --git a/src/metadata.yaml b/src/metadata.yaml index 2cd1bd5..4204939 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -12,8 +12,8 @@ description: | credentials, SQL/NoSQL databases, X.509 certificates, SSH credentials, and more. series: - - bionic - xenial + - bionic tags: - security requires: diff --git a/src/reactive/vault.py b/src/reactive/vault.py index 0bce605..ea3b8fe 100644 --- a/src/reactive/vault.py +++ b/src/reactive/vault.py @@ -141,7 +141,7 @@ def mysql_setup(database): @when_not('vault.schema.created') def create_vault_table(pgsql): status_set('maintenance', 'connecting to database') - conn = psycopg2.connect(pgsql.master) + conn = psycopg2.connect(str(pgsql.master)) cur = conn.cursor() status_set('maintenance', 'creating vault table') cur.execute(VAULT_TABLE_DDL) diff --git a/src/tests/bundles/bionic-postgres.yaml b/src/tests/bundles/bionic-postgres.yaml new file mode 100644 index 0000000..75c1699 --- /dev/null +++ b/src/tests/bundles/bionic-postgres.yaml @@ -0,0 +1,13 @@ +series: bionic +services: + vault: + num_units: 1 + series: bionic + charm: ../../../vault + postgresql: + series: xenial + charm: cs:postgresql + num_units: 1 +relations: +- - vault:db + - postgresql:db diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index 4f2ea5b..bf36517 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -6,6 +6,7 @@ configure: gate_bundles: - xenial-postgres - xenial-mysql + - bionic-postgres smoke_bundles: - xenial-mysql dev_bundles: