Skip to content

Instantly share code, notes, and snippets.

def jj(p)
name = p.name.sub(/-cook/, " cook")
n_xml = Nokogiri::XML(@jenkins.client.job.get_config(name))
path = n_xml.xpath("//url").children.first
path.content = p.ssh_url_to_repo
gitlab = n_xml.xpath("//__projectPath").children.first
gitlab.content = p.web_url unless gitlab.nil?
@jenkins.client.job.post_config(name, n_xml.to_xml)
end
plain_pass = Chef::EncryptedDataBagItem.load("aws-admin-passwords", "svc_goagent")["password"]
p plain_pass
#if unix box
if node['platform'] == 'ubuntu'
chef_gem "ruby-shadow"
package "whois"
unless node.attribute? "svc_goagent_pass"
@thommay
thommay / gist:42b033d2c877e74e6b1a
Last active August 29, 2015 14:17
compile_time post mortem

Meeting

Start every PM stating the following

  1. This is a blameless Post Mortem.
  2. We assume everyone participating in the project wants to do a good job.
  3. We will not focus on the past events as they pertain to "could've", "should've", etc.
  4. All follow up action items must be actionable and have a participating individuals commitment to implement, design, or otherwise achieve them.

Post-mortem Facilitator: Thom May

Getting started

In the analytics directory, run rake converge.

Once the rake command has completed, you should be able to go to the Chef Web UI and log in with username analytics and password workshop.

Once logged in, download a private key for your user by going to the user's profile page, selecting reset key then copy the text into .chef/analytics.pem in this directory.

$chef_omnibus_root = "$env:systemdrive\opscode\chef"
$msi = "$env:TEMP\chef-12.3.0.msi"
$pretty_version = "12.3.0"
$version = "12.3.0"
$chef_msi_url = "https://opscode-omnibus-packages.s3.amazonaws.com/windows/2008r2/x86_64/chef-client-12.4.1-1.msi"
Function Check-UpdateChef($root, $version) {
if (-Not (Test-Path $root)) { return $true }
elseif ("$version" -eq "true") { return $false }
elseif ("$version" -eq "latest") { return $true }
require 'chef/provisioning/aws_driver'
with_driver 'aws:default:us-west-1'
with_chef_server "https://api.opscode.com/organizations/spincycle",
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]
node.set['ssh_key'] = 'thom_spincycle'
aws_key_pair node['ssh_key'] do
private_key_path ::File.expand_path("~/.ssh/#{node['ssh_key']}")
@thommay
thommay / kitchen build instructions
Last active August 29, 2015 14:27
delivery windows builder notes

has to be a 64bit toolchain - ie by installing ruby 64 and hence the 64 bit dev toolchain OPENSSL_LIB_DIR=C:\OpenSSL-Win64 OPENSSL_INCLUDE_DIR=C:\OpenSSL-Win64\include

rust nightly via straight windows_package -

windows_package 'rust' do
  source 'https://static.rust-lang.org/dist/2015-08-17/rust-nightly-x86_64-pc-windows-gnu.msi'
end
it "should accept relative templatedirs" do
Puppet[:templatedir] = "my/templates"
File.expects(:directory?).with(File.join(Dir.getwd,"my/templates")).returns(true)
Puppet::Module.find_template("mytemplate").should == File.join(Dir.getwd,"my/templates/mytemplate")
end
chef:/tmp# ohai
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin os
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin ruby
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin languages
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin kernel
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin command
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin hostname
[Mon, 26 Jan 2009 01:37:35 +0000] INFO: Loading plugin linux::hostname
/usr/lib/ruby/gems/1.8/gems/ohai-0.1.2/lib/ohai/mixin/command.rb:83:in `run_command': returned 1, expected 0 (Ohai::Exception::Exec)
from /usr/lib/ruby/gems/1.8/gems/ohai-0.1.2/lib/ohai/mixin/command.rb:67:in `chdir'
if node[:platform_version].to_f < 8.04
if File.directory?("/etc/event.d")
remote_file "/etc/event.d/runsvdir" do