Commit 7516aa3b authored by Lionel Morin's avatar Lionel Morin
Browse files

Merge branch '384_creole_files' into 'develop'

download_files: remove old files before tar extraction

See merge request !9
parents 58e8d54e 0cc83ec5
Pipeline #492 passed with stage
in 0 seconds
...@@ -6,6 +6,7 @@ import signal ...@@ -6,6 +6,7 @@ import signal
import time import time
import json, yaml import json, yaml
from os import path, makedirs, getpid, unlink, remove, walk, path, stat from os import path, makedirs, getpid, unlink, remove, walk, path, stat
from shutil import rmtree
import tarfile import tarfile
import base64 import base64
...@@ -157,8 +158,6 @@ class SaltRunner(ZephirCommonController): ...@@ -157,8 +158,6 @@ class SaltRunner(ZephirCommonController):
creole_files_path = '{0}/creole_files.tar.gz'.format(minion_dir) creole_files_path = '{0}/creole_files.tar.gz'.format(minion_dir)
makedirs(minion_dir, exist_ok=True)
server = await self.call('v1.server.describe', server = await self.call('v1.server.describe',
_session_user=_session_user, _session_user=_session_user,
serverid=server_id, serverid=server_id,
...@@ -187,10 +186,13 @@ class SaltRunner(ZephirCommonController): ...@@ -187,10 +186,13 @@ class SaltRunner(ZephirCommonController):
eoleconfig = {"eole":{"configuration": { "files":{}}}} eoleconfig = {"eole":{"configuration": { "files":{}}}}
rmtree(minion_dir)
makedirs(minion_dir)
with open(creole_files_path, 'wb') as fh: with open(creole_files_path, 'wb') as fh:
fh.write(base64.b64decode(servermodel['conffiles'])) fh.write(base64.b64decode(servermodel['conffiles']))
tar = tarfile.open(creole_files_path,'r:gz') tar = tarfile.open(creole_files_path,'r:gz')
tar.extractall(f'{minion_dir}') tar.extractall(minion_dir)
remove(creole_files_path) remove(creole_files_path)
# r=root, d=directories, f = files # 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