Commit 52fe8717 authored by Emmanuel Garette's avatar Emmanuel Garette
Browse files

updated are list

parent 4cd71845
Pipeline #771 passed with stage
in 0 seconds
...@@ -107,22 +107,23 @@ class SaltRunner(ZephirCommonController): ...@@ -107,22 +107,23 @@ class SaltRunner(ZephirCommonController):
command='saltutil.clear_cache') command='saltutil.clear_cache')
@register_wamp('v1.server.configuration.updated', None) @register_wamp('v1.server.configuration.updated', None)
async def configuration_update(self, server_id): async def configuration_update(self, servers_id):
server = await self.call('v1.server.describe', for server_id in servers_id:
serverid=server_id, server = await self.call('v1.server.describe',
configuration=True) serverid=server_id,
configuration=True)
pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id)
with open(pillar_file_path + '.tmp', 'w') as fh: pillar_file_path = '/srv/pillar/pillars_{0}.sls'.format(server_id)
if json.loads(server['configuration']): with open(pillar_file_path + '.tmp', 'w') as fh:
yaml.dump(json.loads(server['configuration']), fh, allow_unicode=True) if json.loads(server['configuration']):
else: yaml.dump(json.loads(server['configuration']), fh, allow_unicode=True)
yaml.dump({}, fh) else:
if isfile(pillar_file_path): yaml.dump({}, fh)
remove(pillar_file_path) if isfile(pillar_file_path):
rename(pillar_file_path + '.tmp', pillar_file_path) remove(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