This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This uses the grains module | |
# http://docs.saltstack.org/en/latest/ref/modules/all/salt.modules.grains.html#module-salt.modules.grains | |
# http://salt.readthedocs.org/en/latest/ref/states/all/salt.states.module.html#module-salt.states.module | |
salt: | |
module.run: | |
- name: grains.ls | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In /etc/salt/master: | |
reactor: | |
- 'minion_start': | |
- /opt/salt/reactor/start.sls | |
in /opt/salt/reactor/start.sls: | |
run_highstate: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!py | |
import pprint | |
import yaml | |
space_character = " " | |
def run(): | |
''' | |
Print the config files | |
''' | |
t = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Command(object): | |
''' | |
Enables to run subprocess commands in a different thread | |
with TIMEOUT option! | |
Based on jcollado's solution: | |
http://stackoverflow.com/questions/1191374/subprocess-with-timeout/4825933#4825933 | |
''' | |
def __init__(self, cmd): | |
self.cmd = cmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm | |
function map() { | |
emit(1, // Or put a GROUP BY key here | |
{sum: this.value, // the field you want stats for | |
min: this.value, | |
max: this.value, | |
count:1, | |
diff: 0, // M2,n: sum((val-mean)^2) | |
}); |
NewerOlder