Commit b12a7d5e authored by Matthieu Lamalle's avatar Matthieu Lamalle

Correction : pass _session_user to calls

parent 9aad3ca7
Pipeline #333 passed with stage
in 0 seconds
......@@ -100,8 +100,8 @@ class SaltRunner(ZephirCommonController):
@register_wamp('v1.execution.salt.configuration.deploy',
notification_uri='v1.execution.salt.configuration.deploy-scheduled')
async def configuration_deploy(self, minion_pattern):
await self.download_configuration_files(int(minion_pattern))
async def configuration_deploy(self,_session_user, minion_pattern):
await self.download_configuration_files(_session_user,int(minion_pattern))
try:
deploy_command = 'state.apply'
......@@ -120,8 +120,8 @@ class SaltRunner(ZephirCommonController):
except SaltExecErrorExecuteError as err:
raise ApplicationError('execution.salt.exec.error.execute', reason=str(err))
async def server_started(self, server_id):
await self.download_env(server_id)
async def server_started(self,_session_user, server_id):
await self.download_env(_session_user,server_id)
self.executor.exec_command(minion_pattern=str(server_id),
command='state.apply',
arg='eole.configuration.deploy')
......@@ -145,7 +145,7 @@ class SaltRunner(ZephirCommonController):
None,
'local')[server_id]
async def download_configuration_files(self,
async def download_configuration_files(self,_session_user,
server_id):
minion_dir = '{0}/{1}'.format(MINION_DIR, server_id)
creolefuncs_file_path = '{0}/config.creolefuncs'.format(minion_dir)
......@@ -153,6 +153,7 @@ class SaltRunner(ZephirCommonController):
makedirs(minion_dir, exist_ok=True)
server = await self.call('v1.server.describe',
_session_user=_session_user,
serverid=server_id,
configuration=True)
......@@ -185,8 +186,9 @@ class SaltRunner(ZephirCommonController):
with open(env_file_path, 'w') as fh:
fh.write(servermodel['probes'])
async def download_env(self, server_id):
async def download_env(self,_session_user,server_id):
server = await self.call('v1.server.describe',
_session_user=_session_user,
serverid=server_id)
servermodel = await self.call('v1.servermodel.describe',
servermodelid=server['servermodelid'],
......@@ -197,9 +199,9 @@ class SaltRunner(ZephirCommonController):
self._download_env(server_id, servermodel)
@register_wamp('v1.server.created', notification_uri='v1.execution.salt.peer.registered')
async def peer_register(self, serverid):
async def peer_register(self,_session_user,serverid):
try:
await self.download_configuration_files(serverid)
await self.download_configuration_files(_session_user,serverid)
secret = await self.call('v1.vault.secret.get', secretkey="{}_passphrase".format(serverid))
passphrase = secret["secret"]["passphrase"]
minion_id = str(serverid)
......
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