Skip to content

Instantly share code, notes, and snippets.

def serialize(self, queryset, **options):
"""
Serialize a queryset.
"""
self.options = options
self.stream = options.get("stream", StringIO())
self.selected_fields = options.get("fields")
self.use_natural_keys = options.get("use_natural_keys", False)
def load_django_models():
try:
from django.db.models.loading import get_models
for m in get_models():
ip.ex("from %s import %s" % (m.__module__, m.__name__))
except ImportError:
print "INFO: could not find a django env"
[Fri Sep 16 17:31:57 2011] [error] Recursive log message sent to SentryHandler
[Fri Sep 16 17:31:57 2011] [error] Unable to reach Sentry log server: <urlopen error [Errno -2] Name or service not known> (url: http://sentry1/sentry/store/)
[Fri Sep 16 17:31:57 2011] [error] Recursive log message sent to SentryHandler
[Fri Sep 16 17:31:57 2011] [error] Start from server, version: 8.0, properties: {u'information': u'Licensed under the MPL. See http://www.rabbitmq.com/', u'product': u'RabbitMQ', u'copyright': u'Copyright (C) 2007-2011 VMware, Inc.', u'capabilities': {}, u'platform': u'Erlang/OTP', u'version': u'2.5.1'}, mechanisms: [u'PLAIN', u'AMQPLAIN'], locales: [u'en_US']
[Fri Sep 16 17:31:57 2011] [error] Recursive log message sent to SentryHandler
[Fri Sep 16 17:31:57 2011] [error] Unable to reach Sentry log server: <urlopen error [Errno -2] Name or service not known> (url: http://sentry1/sentry/store/)
[Fri Sep 16 17:31:57 2011] [error] Recursive log message sent to SentryHandler
[Fri Sep 16 17:31:57 2011]
Mem: 171824K used, 27232K free, 0K shrd, 21152K buff, 88816K cached
CPU: 3.7% usr 4.7% sys 0.0% nic 90.2% idle 0.0% io 0.0% irq 1.1% sirq
Load average: 0.21 0.23 0.18 1/89 25895
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
2121 1 root S 435m223.4 0 3.1 /bin/dmaosd start
2044 1 root S 107m 55.3 0 0.4 MediaLogic AV MSGL_FATAL
25441 4232 root R 3712 1.8 0 0.4 top
2043 1 root S 3648 1.8 0 0.4 /bin/sh /usr/bin/wdlxtv.watch
4151 1643 root S 2944 1.4 0 0.4 dropbear -r /conf/rsa_key -d /conf/dss_key
2065 1 root S 13024 6.5 0 0.2 DMARender
@itmustbejj
itmustbejj / gist:c949739b26fb08e54ae5
Last active December 2, 2015 21:55
Using Knife ACL to allow members of the "users" group to properly do validatorless bootstraps
~/lab/repos/chef-server-ha-provisioning/src/chef-server-ha-aws-install   master ●  knife acl show containers nodes
create:
actors: pivotal
groups:
clients
users
admins
delete:
actors: pivotal
groups:
@itmustbejj
itmustbejj / gist:b30502c2ff33a0f842c8
Created January 13, 2016 22:00
Chef Success Slack Emoticons
:allthethings:
:angrydoge:
:asyouwish:
:awesome:
:awthanks:
:awyeah:
:bacon:
:beez:
:bicepleft:
:bicepright:
- If Delivery is a goal, policyfiles are in more of a wait-and-see mode
- Policy groups replace environments, Policies replaces roles.
- Policyfiles don't have a complete solution for environmental attributes. Best practice is to namespace attributes by env or use a discovery tool.
- Without policy inheritence, consolidating all commmon cookbooks into a base cookbook that is included in mulitple policies, is the most sane way to manage dependency overlap in policies.
- While gaining explicit versioning from policyfiles, any change to a common cookbook requires all/many policies to be regenerated. Some people want to have their cake and eat it too.
- Policies work best on a per application level. Customers might be more successful if they follow an application cookbook pattern.
[user]
....
[core]
editor = vim
pager = less -R
[merge]
tool = meld
[diff]
tool = meld
[alias]
function bump_cookbook {
#export BUMP_TYPE=${1:-p}
declare -A bump_types
#bump_types=(["patch"]="p" ["minor"]="mi" ["major"]="ma")
bump_types["patch"]="p"
export SV=`grep -o '\([0-9]*\.[0-9]*\.[0-9]*\)' metadata.rb`;
sed -i -e "s/$SV/`eval increment_version -$1 $SV`/g" metadata.rb }
unset SV
alias bcma="bump_cookbook mmajor;git add metadata.rb"
function bump_cookbook {
#export BUMP_TYPE=${1:-p}
declare -A bump_types
#bump_types=(["patch"]="p" ["minor"]="m" ["major"]="M")
bump_types["patch"]="p"
export SV=`grep -o '\([0-9]*\.[0-9]*\.[0-9]*\)' metadata.rb`;
sed -i -e "s/$SV/`eval increment_version -$1 $SV`/g" metadata.rb }
unset SV
alias bcma="bump_cookbook mmajor;git add metadata.rb"