Exemplo n.º 1
0
 def _post_restore_action(self):
     # restart all running containers
     for name in magic_consts.RUNNING_REQUIRED_CONTAINERS:
         docker.stop_container(name)
         # FIXME: when astute container restart corrent this may be removed
         if "astute" == name:
             try:
                 docker.start_container(name)
             except Exception:
                 LOG.warn(
                     "Failed to start astute container for the first time")
                 docker.stop_container(name)
             else:
                 continue
         docker.start_container(name)
Exemplo n.º 2
0
 def _post_restore_action(self):
     # restart all running containers
     for name in magic_consts.RUNNING_REQUIRED_CONTAINERS:
         docker.stop_container(name)
         # FIXME: when astute container restart corrent this may be removed
         if "astute" == name:
             try:
                 docker.start_container(name)
             except Exception:
                 LOG.warn(
                     "Failed to start astute container for the first time")
                 docker.stop_container(name)
             else:
                 continue
         docker.start_container(name)
Exemplo n.º 3
0
 def restore(self):
     dump = self.archive.extractfile(self.filename)
     subprocess.call(
         ["systemctl", "stop", "docker-{0}.service".format(self.db)])
     docker.stop_container(self.db)
     docker.run_in_container(
         "postgres",
         ["sudo", "-u", "postgres", "dropdb", "--if-exists", self.db],
     )
     with docker.in_container("postgres",
                              ["sudo", "-u", "postgres", "psql"],
                              stdin=subprocess.PIPE) as process:
         process.stdin.write(dump.read())
     docker.start_container(self.db)
     docker.wait_for_container(self.db)
     subprocess.call(
         ["systemctl", "start", "docker-{0}.service".format(self.db)])
Exemplo n.º 4
0
 def restore(self):
     dump = self.archive.extractfile(self.filename)
     subprocess.call([
         "systemctl", "stop", "docker-{0}.service".format(self.db)
     ])
     docker.stop_container(self.db)
     docker.run_in_container(
         "postgres",
         ["sudo", "-u", "postgres", "dropdb", "--if-exists", self.db],
     )
     with docker.in_container("postgres",
                              ["sudo", "-u", "postgres", "psql"],
                              stdin=subprocess.PIPE) as process:
         process.stdin.write(dump.read())
     subprocess.call([
         "systemctl", "start", "docker-{0}.service".format(self.db)
     ])
     docker.start_container(self.db)
Exemplo n.º 5
0
 def post_restore_action(self, *args, **kwargs):
     docker.stop_container("cobbler")
     docker.start_container("cobbler")
Exemplo n.º 6
0
 def restore(self):
     super(CobblerArchivator, self).restore()
     docker.stop_container("cobbler")
     docker.start_container("cobbler")