Skip to content

Instantly share code, notes, and snippets.

@pcn
pcn / letmetellyouastory
Created January 29, 2013 18:00
Stack update
757 pn@PN-mac 12:42 ~/dvcs/tools/CloudFormation/templates/cassandra $ kcs stacks update cassandra CassandraPriamCluster.template PN ChefSoloVersion=0.0.75
* KCS requires 2 environment variables which were not found: STG_AWS_ACCESS_KEY and STG_AWS_SECRET_KEY
* Defaulting to AWS_CREDENTIAL_FILE=/Users/pn/.aws/staging-cf-credential-file
* KCS requires 2 environment variables which were not found: UTIL_AWS_ACCESS_KEY and UTIL_AWS_SECRET_KEY
* Defaulting to AWS_CREDENTIAL_FILE=/Users/pn/.aws/staging-cf-credential-file
* KCS requires 2 environment variables which were not found: UTIL_AWS_ACCESS_KEY and UTIL_AWS_SECRET_KEY
* Defaulting to AWS_CREDENTIAL_FILE=/Users/pn/.aws/staging-cf-credential-file
* KCS requires 2 environment variables which were not found: UTIL_AWS_ACCESS_KEY and UTIL_AWS_SECRET_KEY
* Defaulting to AWS_CREDENTIAL_FILE=/Users/pn/.aws/staging-cf-credential-file
* Parameters that will be MODIFIED:
@pcn
pcn / The loop.rb
Created February 1, 2013 17:43
Something is failing in overriding node data. The answer: use node.override instead of node.set
p "Finalizing and setting everything in the node data"
node['nagios']['virtual_hosts'].each do |virt_key, virt_val|
virt_val.each do |stack_key, stack_val|
if stack_key.start_with?('elb_')
p stack_val
stack_name = virt_val['stack_name']
stack_val.each do |k, v|
if k == "name"
p "It is a name, so trying #{elb_mapping[stack_name][0]}"
p "#{virt_key} #{stack_key} #{k}"
@pcn
pcn / s3_stacktrace
Created February 13, 2013 15:43
Stacktrace from a long s3 list or an s3_get with paging handled. I am trying to figure out why s3 is getting me NoneType objects and why it's happening so low down in boto.
Traceback (most recent call last):
File "/home/pn/s3-describe-bucket", line 264, in <module>
main()data/pearsoncourseeventsdump_2013_01_17T17_40_40/62a0e4f7202d558f5222c0f147e8d682_ea33f882-f362-4ca4-a654-f96c41c4a374: 15712 kB
File "/home/pn/s3-describe-bucket", line 249, in main
write_output(generated_key_list, opts)
File "/home/pn/s3-describe-bucket", line 213, in write_output
for key in s3_generator:
File "/home/pn/s3-describe-bucket", line 167, in yield_keys_list
for k in src:
File "/mnt/data/s3-costs/local/lib/python2.7/site-packages/k/aws/util.py", line 56, in yield_aws_data
@pcn
pcn / syslog
Created March 18, 2013 17:02
Stuff during a bivins unit test run
Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034349] INFO: task bdi-default:19 blocked for more than 120 s
econds.Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034364] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" di
sables this message.Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034375] bdi-default D 0000000000000000 0 19 2 0
x00000000Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034380] ffff8801df8f9c10 0000000000000246 ffff880001855aa0 f
fff8801df8f9b90Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034383] 0000000000000001 ffff8801df8f9bd8 ffff8801df8f6878 f
fff8801df8f9fd8
Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034386] ffff8801df8f64c0 ffff8801df8f64c0 ffff8801df8f64c0 f
fff8801df8f9fd8
Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034388] Call Trace:
Mar 18 16:26:00 ip-10-124-157-76 kernel: [243480.034398] [<ffffffff81024d59>] ? wake_affine+0x2e9/0x370
@pcn
pcn / requirements.txt
Created March 21, 2013 00:24
setuptools/distutils/distribute failing miserably
```
PyYAML>=3.09,<4.0
boto>=2.5.0,<2.6
requests==1.1.0-knewton
kerberos>=1.1.1
requests-kerberos>=0.1-knewton,<0.2
```
#
# Author:: Christopher Peplin (<peplin@bueda.com>)
# Copyright:: Copyright (c) 2010 Bueda, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
def to_hash_recursive(hash_thing)
new = {}
hash_thing.each do |k,v|
new[k] = v.kind_of?(Hash) ? to_hash(v) : v
end
new
end
@pcn
pcn / commented_out.rb
Created May 13, 2013 20:28
Cron resource breaks on chef-solo version 10.24.0
# The resource fails with the commented-out section, but succeeds with the uncommented section:
# Save the nodetool gossipinfo to syslog periodically. This is to identify
# ghost nodes if we replace one.
cron "log_gossip_info" do
minute "18"
hour "3,9,15,21"
# command <<EOF
# nodetool -h0 gossipinfo | awk '{ if($0 ~ /^\//) printf("\n%s", $0) ; else printf("%s", $0) ; } | logger -p \
local1.info -t nodetool_gossipinfo
@pcn
pcn / log
Last active December 17, 2015 07:39
Logstash-1.1.12 says that a path is relative, when it means that the file doesn't exist
2013-05-14_05:40:45.82695 Exception in thread "LogStash::Runner" org.jruby.exceptions.RaiseException: (ArgumentError) File paths must be absolute, relative path specified: [ "/var/log/auth.log", "/var/log/messages", "/var/log/syslog" ]
The problem here is that the configuration has an array quoted: '[ "/var/log/..."]' which doesn't exist at all.
@pcn
pcn / gist:5597092
Created May 17, 2013 05:20
Using jq with json-ified ec2din output
~/work/test-wrap-cmd.py| ~/Downloads/jq '[.instance_list[] | select(contains({"availabilty_zone": "us-east-1a"})) ]'