From 7c1066bea3e9c5ce7231d90c43f03ce5a44cea55 Mon Sep 17 00:00:00 2001 From: pengtao Date: Tue, 5 Nov 2019 14:44:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0keys=20=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/deploy_keys.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/deploy/deploy_keys.py b/deploy/deploy_keys.py index 62316da..3fc080f 100644 --- a/deploy/deploy_keys.py +++ b/deploy/deploy_keys.py @@ -76,7 +76,7 @@ class DeployKeys: try: log.info("svn export config start") pdb.set_trace() - cmd = f"cd {self.svn_paths} && svn up" + cmd = f"cd {self.svn_paths} && svn up && tar zcvf keys.tar.gz keys " status, output = run_cmd(cmd) if status: log.info("svn export config success") @@ -85,20 +85,20 @@ class DeployKeys: except Exception: log.error(f"get remote {self.project} svn failed", exc_info=True) - project_paths = os.path.join(self.svn_paths, self.project) - tar = tarfile.open(self.svn_paths + '.tar.gz', 'w:gz') - os.chdir(self.svn_paths) - key_dirs = os.path.join(self.svn_paths, "keys") - for f in os.listdir(key_dirs): - tar.add(f) - tar.close() + # project_paths = os.path.join(self.svn_paths, self.project) + # tar = tarfile.open(self.svn_paths + '.tar.gz', 'w:gz') + # os.chdir(self.svn_paths) + # key_dirs = os.path.join(self.svn_paths, "keys") + # for f in os.listdir(key_dirs): + # tar.add(f) + # tar.close() # 判断是否有生成tar包 - list_dir = os.listdir(project_paths) + list_dir = os.listdir(self.svn_paths) tar_files = list() for i in list_dir: - if i == "{0}.tar.gz".format(self.project) and os.path.isfile(os.path.join(project_paths, i)): - tar_files.append(os.path.join(project_paths, i)) + if i == "{0}.tar.gz".format(self.project) and os.path.isfile(os.path.join(self.svn_paths, i)): + tar_files.append(os.path.join(self.svn_paths, i)) if len(tar_files) == 1: log.info("tarfile {0} config to tar.gz success".format(self.project)) return tar_files