Commit a21618ac authored by Lionel Morin's avatar Lionel Morin
Browse files

Merge branch 'updated_list' into 'develop'

updated are list

See merge request !15
parents 17afe2c9 840d38ee
Pipeline #869 passed with stage
in 0 seconds
...@@ -110,24 +110,23 @@ class SaltRunner(ZephirCommonController): ...@@ -110,24 +110,23 @@ class SaltRunner(ZephirCommonController):
client_mode="local") client_mode="local")
@register_wamp('v1.server.configuration.updated', None) @register_wamp('v1.server.configuration.updated', None)
async def configuration_update(self, server_id, deploy): async def configuration_update(self, servers_id):
if not deploy: for server_id in servers_id:
return server = await self.call('v1.server.describe',
server = await self.call('v1.server.describe', serverid=server_id,
serverid=server_id, configuration=True)
configuration=True)
pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id)
pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id) with open(pillar_file_path + '.tmp', 'w') as fh:
with open(pillar_file_path + '.tmp', 'w') as fh: if json.loads(server['configuration']):
if json.loads(server['configuration']): yaml.dump(json.loads(server['configuration']), fh, allow_unicode=True)
yaml.dump(json.loads(server['configuration']), fh, allow_unicode=True) else:
else: yaml.dump({}, fh)
yaml.dump({}, fh) if isfile(pillar_file_path):
if isfile(pillar_file_path): remove(pillar_file_path)
remove(pillar_file_path) rename(pillar_file_path + '.tmp', pillar_file_path)
rename(pillar_file_path + '.tmp', pillar_file_path)
self.pillar_clear_cache(str(server_id))
self.pillar_clear_cache(str(server_id))
@register_wamp('v1.execution.salt.configuration.deploy', @register_wamp('v1.execution.salt.configuration.deploy',
notification_uri='v1.execution.salt.configuration.deploy-scheduled') notification_uri='v1.execution.salt.configuration.deploy-scheduled')
......
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