Commit a8cd5d87 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Restoring backups on Docker with the `git` user

I've had cases of leftover group directories and HGRC belonging
to root, blocking subsequent test runs. Not sure this is the
real culprit, but restoring as root was wrong anyway.

This requires more passing of kwargs down to the Docker call
parent 70f8ec33c26e
......@@ -20,8 +20,8 @@ def heptapod_exec(ct, command, user='root'):
return exit_code, out
def heptapod_run_shell(ct, command):
exit_code, output = heptapod_exec(ct, command)
def heptapod_run_shell(ct, command, **kw):
exit_code, output = heptapod_exec(ct, command, **kw)
if exit_code:
raise RuntimeError(('Heptapod command {command} returned a non-zero '
'exit code {exit_code}').format(
......@@ -245,7 +245,7 @@ class Heptapod:
if driver is not None:
def run_shell(self, command):
def run_shell(self, command, **kw):
raise NotImplementedError('run_shell')
def force_remove_route(self, route_path, source_type='Project'):
......@@ -277,8 +277,8 @@ class DockerHeptapod(Heptapod):
def execute(self, command, user='root'):
return docker.heptapod_exec(self.docker_container, command, user=user)
def run_shell(self, command):
return docker.heptapod_run_shell(self.docker_container, command)
def run_shell(self, command, **kw):
return docker.heptapod_run_shell(self.docker_container, command, **kw)
def put_archive(self, dest, path, owner='git'):
res = docker.heptapod_put_archive(self.docker_container, dest, path)
......@@ -340,7 +340,7 @@ class DockerHeptapod(Heptapod):
self.run_shell(('find', '/var/opt/gitlab/backups',
'-name', '*.tar',
self.run_shell(('gitlab-rake', 'gitlab:backup:create'))
self.run_shell(('gitlab-rake', 'gitlab:backup:create'), user='git')
def backup_restore(self):
......@@ -357,7 +357,8 @@ class DockerHeptapod(Heptapod):
self.run_shell(('gitlab-ctl', 'stop', service))
self.run_shell(('gitlab-rake', 'gitlab:backup:restore',
for service in app_services:
self.run_shell(('gitlab-ctl', 'start', service))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment