添加keys 发布接口
This commit is contained in:
parent
043812f70e
commit
fdc40c8c8f
@ -30,20 +30,18 @@ class DeployKeys:
|
|||||||
def run(self):
|
def run(self):
|
||||||
svn_path, ipadr = self.get_config()
|
svn_path, ipadr = self.get_config()
|
||||||
if svn_path:
|
if svn_path:
|
||||||
shutil.rmtree(svn_path)
|
key_path = f"{svn_path}/keys"
|
||||||
|
args = dict()
|
||||||
|
tar_file = self.build_svn_tar(key_path)
|
||||||
|
if tar_file:
|
||||||
|
hostfile = self.build_hostfile()
|
||||||
|
args['hostfile'] = hostfile
|
||||||
|
args['tar_file'] = tar_file
|
||||||
|
self.ansible_deploy(args)
|
||||||
|
else:
|
||||||
|
log.error(f"tar file no found with {self.project}")
|
||||||
else:
|
else:
|
||||||
pass
|
raise Exception(f"{self.project} config not found in manager table!")
|
||||||
os.system(f"mkdir -p {svn_path}")
|
|
||||||
key_path = f"{svn_path}/keys"
|
|
||||||
args = dict()
|
|
||||||
tar_file = self.build_svn_tar(key_path)
|
|
||||||
if tar_file:
|
|
||||||
hostfile = self.build_hostfile()
|
|
||||||
args['hostfile'] = hostfile
|
|
||||||
args['tar_file'] = tar_file
|
|
||||||
self.ansible_deploy(args)
|
|
||||||
else:
|
|
||||||
log.error(f"tar file no found with {self.project}")
|
|
||||||
|
|
||||||
|
|
||||||
def get_config(self):
|
def get_config(self):
|
||||||
@ -76,6 +74,9 @@ class DeployKeys:
|
|||||||
try:
|
try:
|
||||||
log.info("svn export config start")
|
log.info("svn export config start")
|
||||||
s = svn.remote.RemoteClient(svn_path)
|
s = svn.remote.RemoteClient(svn_path)
|
||||||
|
if self.svn_paths:
|
||||||
|
shutil.rmtree(self.svn_paths)
|
||||||
|
|
||||||
s.export(self.svn_paths, force=True)
|
s.export(self.svn_paths, force=True)
|
||||||
log.info("svn export config success")
|
log.info("svn export config success")
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user