Skip to content

Instantly share code, notes, and snippets.

View johanek's full-sized avatar

Johan van den Dorpe johanek

View GitHub Profile
(salt)Johan-van-den-Dorpes-Macbook-Pro:tests johan$ python ./runtests.py -n unit.lint_test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Transplanting configuration files to '/tmp/salt-tests-tmpdir/config'
* Current Directory: /Users/johan/git/salt/tests
* Test suite is running under PID 58310
* Logging tests on /var/folders/h6/sf9lyr_54s54ymw_qkyf0dxw0000gn/T/salt-runtests.log
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Starting unit.lint_test Tests
~~~~~~~~~~~~~~~~~~~~~~~
haproxy: reload is not a valid argument for service.running
sudo ./scripts/salt-call --local --file-root=/Users/johan/dneg/salt/formula/ state.validate_sls test
import sys
import os
import salt.config
import salt.loader
import salt.utils
__opts__ = salt.config.minion_config('/etc/salt/minion')
__salt__ = salt.loader.minion_mods(__opts__)
statemods = salt.loader.states(__opts__, __salt__)
print sorted(list(statemods.keys()))
>>> ['alias.absent', 'alias.present', 'alternatives.auto', 'alternatives.install', 'alternatives.remove', 'alternatives.set', 'apache.configfile', 'archive.closing', 'archive.extracted', 'at.absent', 'at.present', 'blockdev.formatted', 'blockdev.tuned', 'boto_asg.absent', 'boto_asg.present', 'boto_cloudwatch_alarm.absent', 'boto_cloudwatch_alarm.present', 'boto_elasticache.absent', 'boto_elasticache.present', 'boto_elb.absent', 'boto_elb.present', 'boto_iam_role.absent', 'boto_iam_role.present', 'boto_lc.absent', 'boto_lc.present', 'boto_route53.absent', 'boto_route53.present', 'boto_secgroup.absent', 'boto_secgroup.present', 'boto_sqs.absent', 'boto_sqs.present', 'buildout.installed', 'cloud.absent', 'cloud.present', 'cloud.profile', 'cloud.volum
In [1]: import salt.config
In [2]: import salt.loader
In [3]: import salt.renderers.yaml
In [4]:
In [4]: content = open('test.sls').read()
@johanek
johanek / README
Last active December 30, 2015 00:09
graphite-web + logstash
logstash(search) - hits for search string
logstash(search,field,facet) - return stats on a field - facets are count, min, max, total, mean.
logstashGroup(search, group, field, facet) - return stats on a field, grouped by a value.
@johanek
johanek / postgres
Last active August 28, 2017 10:59
Useful postgres commands
Example of getting size of fields:
SELECT id, length(raw), length(cooked) FROM posts ORDER BY length(cooked) DESC limit 100;
Truncate table:
truncate table <table>;
@johanek
johanek / gist:6120466
Created July 31, 2013 08:51
ruby warrior

class Player
def play_turn(warrior)
@warrior = warrior
@health ||= warrior.health
@direction ||= :forward
attack || look || retreat || wall || captive || rest || walk
@health = warrior.health
end
@johanek
johanek / build-gems.sh
Created April 22, 2013 08:29
build-gems.sh
#!/bin/bash
FPM=/usr/bin/fpm
if [ ! -d BUILD ]
then
mkdir -p BUILD
fi
for gem in `cat gem-list | grep -v "#" `
@johanek
johanek / sample-init.sh
Last active December 11, 2015 08:29
Generic init script
#!/bin/sh
#
# MYNAME DESCRIPTION
#
# chkconfig: 345 95 5
# description: DESCRIPTION
#
### BEGIN INIT INFO
# Provides: NAME