Commit 0cc83ec5 authored by Bruno Boiget's avatar Bruno Boiget

download_files: remove old files before tar extraction

parent 9622b48c
Pipeline #489 passed with stage
in 0 seconds
......@@ -6,6 +6,7 @@ import signal
import time
import json, yaml
from os import path, makedirs, getpid, unlink, remove, walk, path, stat
from shutil import rmtree
import tarfile
import base64
......@@ -155,8 +156,6 @@ class SaltRunner(ZephirCommonController):
creole_files_path = '{0}/creole_files.tar.gz'.format(minion_dir)
makedirs(minion_dir, exist_ok=True)
server = await self.call('v1.server.describe',
_session_user=_session_user,
serverid=server_id,
......@@ -185,10 +184,13 @@ class SaltRunner(ZephirCommonController):
eoleconfig = {"eole":{"configuration": { "files":{}}}}
rmtree(minion_dir)
makedirs(minion_dir)
with open(creole_files_path, 'wb') as fh:
fh.write(base64.b64decode(servermodel['conffiles']))
tar = tarfile.open(creole_files_path,'r:gz')
tar.extractall(f'{minion_dir}')
tar.extractall(minion_dir)
remove(creole_files_path)
# r=root, d=directories, f = files
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment