def restore(self, app):
self._affectedServers = {}
self.app = app
self._checkNodeConfiguration()
ssh = SSH()
t = timeit.default_timer()
envs = self.app.configuration.get("SplunkNodes.envs")
for appName in self.app.options["--app:"]:
assert os.path.exists(os.path.join(self.app.options["--path:"], appName)), "The app \"" + appName + "\" does not exist under: " + self.app.options["--path:"]
role = self._roles[envs[self.app.options["--env:"]][self.app.options["--role:"]]["role"]]
role.setRoleInfo(self.app.logger, self.app.options["--env:"], envs[self.app.options["--env:"]], self.app.options["--role:"], envs[self.app.options["--env:"]][self.app.options["--role:"]])
self.app.logger.info("Restoring a backup for the selected apps (" + ", ".join(self.app.options["--app:"]) + ") from local path \"" + self.app.options["--path:"] + "\" to environment \"" + self.app.options["--env:"] + "\" and role \"" + self.app.options["--role:"] + "\"")
role.restore(list(self.app.options["--app:"]), ssh, self.app.options["--path:"])
t = timeit.default_timer() - t
if t < self.WarnDeploymentTime:
self.app.logger.info("Restore took: {:.4f} seconds".format(t))
else:
self.app.logger.warning("Restore took: {:.4f} seconds".format(t))
评论列表
文章目录