添加keys 发布接口

This commit is contained in:
pengtao 2019-11-05 14:44:17 +08:00
parent 6e896541c5
commit 7c1066bea3

View File

@ -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