Skip to content

Instantly share code, notes, and snippets.

View juliandunn's full-sized avatar

Julian C. Dunn juliandunn

View GitHub Profile

A Quick Tour of A Chef Client Run Internals

Dan DeLeo appeared on the FoodFightShow some time ago to walk through "what a Chef run really does". I expanded on these remarks in my personal investigation.

/usr/bin/chef-client

  • bin/chef-client creates a new Chef::Application::Client (subclass of Chef::Application which sets up common things like loggers across chef-client, chef-solo, knife, etc.) then jump to:

  • lib/chef/client.rb

  • application classes create a new Chef::Client object, which calls initialize().

@juliandunn
juliandunn / attributes-default.rb
Last active August 29, 2015 14:07
Recipe example to use the bash.rb Ohai plugin mentioned above.
default['ohai']['plugins']['remediate-shellshock'] = 'plugins'
@juliandunn
juliandunn / bash.rb
Last active August 29, 2015 14:07
Example Ohai plugin to report on a version of Bash, as well as whether it is vulnerable to Shellshock (CVE-2014-7169) or not.
#
# Author:: Julian C. Dunn (<[email protected]>)
# Copyright:: Copyright (c) 2014, Chef Software, 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
@juliandunn
juliandunn / chef-client-aix-output
Created September 29, 2014 22:39
Yey, Chef Client running on AIX
l59fvp002_pub[/usr/bin] > chef-client
Starting Chef Client, version 12.0.0.alpha.0
resolving cookbooks for run list: ["chef-client", "aixtest"]
Synchronizing Cookbooks:
- chef-client
- cron
- logrotate
- windows
- chef_handler
- aixtest
11:04 < nick1> Ugh why aren't the developers of this open source project available 24/7 to fix my every issue? :P
11:06 < nick2> have you taken all the proper steps, including posting "need help ASAP!!! Very important project
in jeapordy!!" to the mailing list and stackexchange?
11:07 < nick2> that usually motivates people
#!/bin/sh
chfs -a size=+2000000 /usr
chfs -a size=+2000000 /opt
chfs -a size=+2000000 /home
chfs -a size=+2000000 /var
chfs -a size=+2000000 /tmp
rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/coreutils/coreutils-5.2.1-2.aix5.1.ppc.rpm
chsec -f /etc/security/limits -s default -a "data=-1"
@juliandunn
juliandunn / nokogiri-fetal-position.txt
Last active August 29, 2015 14:06
New Buzzfeed article: How to make a sysadmin cry with this one neat trick
$ gem install nokogiri
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
Building libxml2-2.8.0 for nokogiri with the following patches applied:
- 0001-Fix-parser-local-buffers-size-problems.patch
- 0002-Fix-entities-local-buffers-size-problems.patch
- 0003-Fix-an-error-in-previous-commit.patch
- 0004-Fix-potential-out-of-bound-access.patch
- 0005-Detect-excessive-entities-expansion-upon-replacement.patch
- 0006-Do-not-fetch-external-parsed-entities.patch
$ kitchen test --destroy=never service-init-centos-65
-----> Starting Kitchen (v1.2.1)
-----> Cleaning up any prior instances of <service-init-centos-65>
-----> Destroying <service-init-centos-65>...
Finished destroying <service-init-centos-65> (0m0.00s).
-----> Testing <service-init-centos-65>
-----> Creating <service-init-centos-65>...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'opscode-centos-6.5'...
==> default: Matching MAC address for NAT networking...
@juliandunn
juliandunn / erlang-not-sure-if-crashed-or.txt
Last active August 29, 2015 14:06
never quite know if erlang succeeded or failed
=PROGRESS REPORT==== 7-Sep-2014::23:52:03 ===
supervisor: {local,lager_sup}
started: [{pid,<0.49.0>},
{name,lager_crash_log},
{mfargs,
{lager_crash_log,start_link,
["log/crash.log",65536,10485760,[{hour,0}],5]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,worker}]
#!/bin/sh
#
# aixsetup.sh: Set up an AIX 6.1 server to have all the prerequisites to run Omnibus.
#
# Authors: Scott Hain (<[email protected]>), Julian Dunn (<[email protected]>)
#
# Notes:
# 1. /bin/sh is actually ksh. Your bashisms ain't gonna work here, sonny!
# 2. Run this script as superuser.
# 3. I've tried to be clear about what requires GNU Make and what requires BSD make