Skip to content

Instantly share code, notes, and snippets.

View davidbirdsong's full-sized avatar

david birdsong davidbirdsong

  • san francisco, ca
View GitHub Profile
@davidbirdsong
davidbirdsong / nginx.conf
Created October 29, 2012 05:46
set_body_file not working as expected
server {
server_name $hostname;
listen 80;
# add_header Content-Type application/json
location /foo {
proxy_pass http://127.0.0.1:2000;
}
location / {
client_body_in_file_only on;
@davidbirdsong
davidbirdsong / relative_make_flags
Created February 18, 2013 05:15
link tokyo cabinet using relative path
CFLAGS = -I../include -Wall -Wno-cast-align -g
LIBS = -L../lib -levent -ljson -lm -lc -ltokyocabinet
LDFLAGS='-Wl,-R,$$ORIGIN/../lib/'
@davidbirdsong
davidbirdsong / unicode_kwargs
Created April 5, 2013 20:02
test unicode kwargs
import pprint
v_attrs = {u'change_user': u'david',
u'path': u'/gfs/v1/cans/loko.example.13510.26654.7305-pkg1/04/046ec7dc3e',
u'publish_date': u'2013-04-05 19:44:54',
u'release_date': u'2013-04-05 19:54:28',
u'release_user': u'david',
u'sha': u'046ec7dc3e',
u'user': u'david'}
@davidbirdsong
davidbirdsong / cobber_import_err
Created May 10, 2013 00:53
cobblerd import error
[david@ops-1 ~]$ cobbler import --path=/data/mirror/centos/6/imgix/ --name=imgix-base --arch=x86_64
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 184, in check_setup
s.ping()
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1243, in request
Tue May 14 17:55:16 2013 - INFO | import_tree; ['rsync://ops-1/mirror/centos/6/imgix/x86_64', 'imgix-base', None, None, None]
Tue May 14 17:55:16 2013 - INFO | importing from a network location, running rsync to fetch the files first
Tue May 14 17:55:16 2013 - INFO | running: rsync -a 'rsync://ops-1/mirror/centos/6/imgix/x86_64/' /var/www/cobbler/ks_mirror/imgix-base-x86_64 --exclude-from=/etc/cobbler/rsync.exclude --progress
Tue May 14 17:55:16 2013 - INFO | received on stdout: receiving incremental file list
sent 185 bytes received 1065 bytes 2500.00 bytes/sec
total size is 221863715 speedup is 177490.97
Tue May 14 17:55:16 2013 - DEBUG | received on stderr:
Tue May 14 17:55:16 2013 - INFO | No import managers found a valid signature at the location specified
@davidbirdsong
davidbirdsong / gist:5588008
Created May 15, 2013 22:40
cjson, lua and empty tables

this is an annoying side effect of lua tables consider the following:

an empty table when encoded returns a map-like json structure

[david@foulplay ~]$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require('cjson')
> t= {}
> return cjson.encode(t)
{}
@davidbirdsong
davidbirdsong / inventory_staging_tree
Last active December 17, 2015 20:28
tree structure of staging directory
[david@ops-1 staging{master}]$ tree .
.
├── ansible.cfg
└── inventory
├── ec2.ini
├── ec2.py
└── group_vars
└── tag_mogilefsd_1
[david@ops-1 staging{master}]$ cat ansible.cfg
@davidbirdsong
davidbirdsong / cobbler_login_traceback
Last active December 17, 2015 23:19
cobbler login failed
[root@ops-2 ~]# cobbler help
Traceback (most recent call last):
File "/usr/bin/cobbler", line 35, in <module>
sys.exit(app.main())
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 558, in main
rc = cli.run(sys.argv)
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 202, in run
self.token = self.remote.login("", self.shared_secret)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
@davidbirdsong
davidbirdsong / conditional loop
Created June 6, 2013 23:14
conditional inside of loop
---
- hosts: all
sudo: yes
tasks:
- name: mount filter
debug: msg="{{ item['mount'] + ' is awesome!'}}"
when: {{ item['mount'].endswith('da3') }}
with_items: $ansible_mounts
@davidbirdsong
davidbirdsong / set_facts_testing
Created June 6, 2013 23:41
attempt at building a variable on the end node of a list of mounts i'm interested in
---
- hosts: all
sudo: yes
tasks:
- name: mount filter
set_fact:
args:
mounts="{{ x['mount'] for x in ansible_mounts if x['mount'].endswith('da3') }}"
- name: echo each mount