ArielGlenn has submitted this change and it was merged.
Change subject: use cp.get_file to retrieve configs
......................................................................
use cp.get_file to retrieve configs
next step will be to get rid of the executor crap
and run code as an honest to goodness salt module
Change-Id: I4baf62df348dbe91707be47370cd540abaec0fea
---
M dataretention/retention/auditor.py
M dataretention/retention/runner.py
2 files changed, 19 insertions(+), 2 deletions(-)
Approvals:
ArielGlenn: Verified; Looks good to me, approved
diff --git a/dataretention/retention/auditor.py
b/dataretention/retention/auditor.py
index 06aeff7..5f88468 100644
--- a/dataretention/retention/auditor.py
+++ b/dataretention/retention/auditor.py
@@ -237,9 +237,9 @@
def set_up_perhost_rules(self):
self.perhost_rules_from_store = runpy.run_path(
- '/srv/salt/audits/retention/configs/%s_store.py' %
self.hostname)['rules']
+ '/srv/audits/retention/configs/%s_store.cf' %
self.hostname)['rules']
self.perhost_rules_from_file = runpy.run_path(
- '/srv/salt/audits/retention/configs/allhosts_file.py')['perhostcf']
+ '/srv/audits/retention/configs/allhosts_file.cf')['perhostcf']
if self.perhost_rules_from_store is not None:
self.add_perhost_rules_to_ignored()
diff --git a/dataretention/retention/runner.py
b/dataretention/retention/runner.py
index 3dd1a66..5a03930 100644
--- a/dataretention/retention/runner.py
+++ b/dataretention/retention/runner.py
@@ -63,8 +63,25 @@
# try to work around a likely race condition in zmq/salt
# time.sleep(5)
+
+ # step one: have them pick up the config files
+ # fixme only copy if exists, check returns
+ new_result = client.cmd_full_return(hosts, 'cp.get_file',
+
['salt://audits/retention/configs/{{grains.fqdn}}_store.py',
+
"/srv/audits/retention/configs/{{grains.fqdn}}_store.cf",
+ 'template=jinja'],
expr_form='list')
+ # fixme only copy if exists, check returns
+ # fixme this content should be ordered by host instead of by
ignore-list type
+ # and split into separate files just as the previous files are
+ new_result = client.cmd_full_return(hosts, 'cp.get_file',
+
['salt://audits/retention/configs/allhosts_file.py',
+
"/srv/audits/retention/configs/allhosts_file.cf",
+ 'template=jinja'],
expr_form='list')
+ print "salt-copy (2):", new_result
+
new_result = client.cmd(hosts, "cmd.exec_code", ["python2", code],
expr_form='list', timeout=self.timeout)
+
if new_result is not None:
result.update(new_result)
# fixme, collect and report on hosts that did
--
To view, visit https://gerrit.wikimedia.org/r/233452
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4baf62df348dbe91707be47370cd540abaec0fea
Gerrit-PatchSet: 2
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits