diff --git a/slapos/recipe/postgres/__init__.py b/slapos/recipe/postgres/__init__.py index 5d5ceeda7b558ac1947b19840851d6b2af77b5d2..26fd94e6ac09978592a5c15c698b119a7e9bbee3 100644 --- a/slapos/recipe/postgres/__init__.py +++ b/slapos/recipe/postgres/__init__.py @@ -209,10 +209,9 @@ class ExportRecipe(GenericBaseRecipe): ret = [] - if not os.path.exists(pgdata): - wrapper = self.options['wrapper'] - self.createBackupScript(wrapper) - ret.append(wrapper) + wrapper = self.options['wrapper'] + self.createBackupScript(wrapper) + ret.append(wrapper) return ret @@ -224,7 +223,10 @@ class ExportRecipe(GenericBaseRecipe): content = textwrap.dedent("""\ #!/bin/sh umask 077 - %(bin)s/pg_dump -h %(pgdata-directory)s -f %(backup-directory)s/backup.sql %(dbname)s + %(bin)s/pg_dump \\ + -h %(pgdata-directory)s \\ + -f %(backup-directory)s/backup.sql \\ + %(dbname)s """ % self.options) self.createExecutable(wrapper, content=content) diff --git a/stack/lapp/postgres/instance-postgres.cfg.in b/stack/lapp/postgres/instance-postgres.cfg.in index 8d484006c4ca3d21d906535c0c69a50d767bbb46..ffd6c0aff4ec2862f4e876e9ea35f2709b225bd4 100644 --- a/stack/lapp/postgres/instance-postgres.cfg.in +++ b/stack/lapp/postgres/instance-postgres.cfg.in @@ -177,7 +177,7 @@ dbname = db ip = $${slap-network-information:local-ipv4} # pgdata_directory is created by initdb, and should not exist beforehand. pgdata-directory = $${rootdirectory:var}/data -backup-directory = $${basedirectory:backup} +backup-directory = $${basedirectory:backup}/postgres services = $${basedirectory:services} bin = $${rootdirectory:bin}