Commit a63e82d3 authored by Matthieu Lamalle's avatar Matthieu Lamalle Committed by Lionel Morin
Browse files

211 transfert files

parent 3f748384
...@@ -67,7 +67,7 @@ RUN curl https://repo.saltstack.com/apt/ubuntu/18.04/amd64/2018.3/SALTSTACK-GPG- ...@@ -67,7 +67,7 @@ RUN curl https://repo.saltstack.com/apt/ubuntu/18.04/amd64/2018.3/SALTSTACK-GPG-
ENV EOLE_FORMULA_DIR=/srv/formulas ENV EOLE_FORMULA_DIR=/srv/formulas
ENV EOLE_CONFIGURATION_FORMULA_URL="https://dev-eole.ac-dijon.fr/git/eole-configuration-formula.git" ENV EOLE_CONFIGURATION_FORMULA_URL="https://dev-eole.ac-dijon.fr/git/eole-configuration-formula.git"
ENV EOLE_CONFIGURATION_FORMULA_REF=0a9f42bc90ec10631f9c58289bc990633654ab10 ENV EOLE_CONFIGURATION_FORMULA_REF=ecc1d134036bfcb5abb34b0d55defce8abbb8ad1
RUN git clone "${EOLE_CONFIGURATION_FORMULA_URL}" "${EOLE_FORMULA_DIR}/eole-configuration-formula" \ RUN git clone "${EOLE_CONFIGURATION_FORMULA_URL}" "${EOLE_FORMULA_DIR}/eole-configuration-formula" \
&& cd "${EOLE_FORMULA_DIR}/eole-configuration-formula" \ && cd "${EOLE_FORMULA_DIR}/eole-configuration-formula" \
......
...@@ -5,7 +5,9 @@ import asyncio ...@@ -5,7 +5,9 @@ import asyncio
import signal import signal
import time import time
import json, yaml import json, yaml
from os import path, makedirs, getpid, unlink from os import path, makedirs, getpid, unlink, remove, walk, path
import tarfile
import base64
from autobahn.wamp.exception import ApplicationError from autobahn.wamp.exception import ApplicationError
...@@ -147,9 +149,11 @@ class SaltRunner(ZephirCommonController): ...@@ -147,9 +149,11 @@ class SaltRunner(ZephirCommonController):
async def download_configuration_files(self,_session_user, async def download_configuration_files(self,_session_user,
server_id): server_id):
minion_dir = '{0}/{1}'.format(MINION_DIR, server_id) minion_dir = '{0}{1}'.format(MINION_DIR, server_id)
creolefuncs_file_path = '{0}/config.creolefuncs'.format(minion_dir) creolefuncs_file_path = '{0}/config.creolefuncs'.format(minion_dir)
pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id) pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id)
creole_files_path = '{0}/creole_files.tar.gz'.format(minion_dir)
makedirs(minion_dir, exist_ok=True) makedirs(minion_dir, exist_ok=True)
server = await self.call('v1.server.describe', server = await self.call('v1.server.describe',
...@@ -172,19 +176,37 @@ class SaltRunner(ZephirCommonController): ...@@ -172,19 +176,37 @@ class SaltRunner(ZephirCommonController):
inheritance=False, inheritance=False,
resolvdepends=False, resolvdepends=False,
creolefuncs=True, creolefuncs=True,
probes=True) probes=True,
conffiles=True)
with open(creolefuncs_file_path, 'w') as fh: with open(creolefuncs_file_path, 'w') as fh:
fh.write(servermodel['creolefuncs']) fh.write(servermodel['creolefuncs'])
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}')
remove(creole_files_path)
files = []
# r=root, d=directories, f = files
for r, d, f in walk(f'{minion_dir}/creole_files'):
for file in f:
files.append(path.join(r, file))
for f in files:
print(f)
self._download_env(server_id, servermodel) self._download_env(server_id, servermodel)
def _download_env(self, server_id, servermodel): def _download_env(self, server_id, servermodel):
minion_dir = '{0}/{1}'.format(MINION_DIR, server_id) minion_dir = '{0}{1}'.format(MINION_DIR, server_id)
makedirs(minion_dir, exist_ok=True) makedirs(minion_dir, exist_ok=True)
env_file_path = '{0}/config.env'.format(minion_dir) env_file_path = '{0}/config.env'.format(minion_dir)
with open(env_file_path, 'w') as fh: with open(env_file_path, 'w') as fh:
fh.write(servermodel['probes']) fh.write(servermodel['probes'])
async def download_env(self,server_id): async def download_env(self,server_id):
_session_user = {'profil': 'root'} _session_user = {'profil': 'root'}
......
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