summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2013-06-12 20:30:51 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2013-06-12 20:31:12 (GMT)
commit5f2411980277b0da1055023933085ec7cfe09579 (patch)
tree29d23d833679104ebab233e1c3d84c91b748cf34
parenta8eed2cfbc3faa48c589547257bc123fd288c186 (diff)
downloadwcsinst-5f2411980277b0da1055023933085ec7cfe09579.zip
wcsinst-5f2411980277b0da1055023933085ec7cfe09579.tar.gz
wcsinst-5f2411980277b0da1055023933085ec7cfe09579.tar.bz2
wcsinstd: do not fail if creating the database fails (maybe it exists already)
-rw-r--r--wcsinst/wcsinstd/deploy.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/wcsinst/wcsinstd/deploy.py b/wcsinst/wcsinstd/deploy.py
index 3d2f053..c9faaef 100644
--- a/wcsinst/wcsinstd/deploy.py
+++ b/wcsinst/wcsinstd/deploy.py
@@ -106,7 +106,10 @@ class DeployInstance(object):
pgconn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cur = pgconn.cursor()
- cur.execute('''CREATE DATABASE %s''' % database_name)
+ try:
+ cur.execute('''CREATE DATABASE %s''' % database_name)
+ except psycopg2.Error as e:
+ print 'got psycopg2 error:', e
cur.close()
wcs_cfg['postgresql']['database'] = database_name