Skip to content

Instantly share code, notes, and snippets.

View jkeiser's full-sized avatar

John Keiser jkeiser

View GitHub Profile
@jkeiser
jkeiser / gist:42afd5c42317b29eaa33
Created December 10, 2015 21:07
Cookbook Uploads and Artifacts
cookbooks/
if directory_name =~ /-\d+\.\d+\.\d+/
the directory name is <cookbook name>-<version>
elsif directory_name =~ /-/
else
the directory name is the cookbook name, metadata has the version
end
cookbook_artifacts/apache2/SHA
@jkeiser
jkeiser / diff.txt
Created October 30, 2015 00:00
Processed xml diff
--- ruby.xml.out 2015-10-29 16:55:27.000000000 -0700
+++ winrx.xml.out 2015-10-29 16:55:27.000000000 -0700
@@ -1,8 +1,8 @@
POST /wsman HTTP/1.1
+Connection: Keep-Alive
Content-Type: application/soap+xml;charset=UTF-8
-Authorization: Basic dmFncmFudDp2YWdyYW50
-User-Agent: Ruby WinRM Client (2.6.0.1, ruby 2.0.0 (2015-04-13))
-Accept: */*
+Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAKIAAABIAUgBugAAAB4AHgBYAAAADgAOAHYAAAAeAB4AhAAAABAAEAACAgAAFYKI4gYDgCUAAAAPRFdTF22TL67/uIpCX3UibFcASQBOAC0ANQBFADcAOQBTAFIAOQBDADMAMgAyAHYAYQBnAHIAYQBuAHQAVwBJAE4ALQA1AEUANwA5AFMAUgA5AEMAMwAyADIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//uE93iucL38Bsn6t2Gq5gEBAAAAAAAAbu0aF+kR0QH50X7dCJnEDAAAAAACAB4AVwBJAE4ALQA4AEoANwA0AEQASQAxAEcANABTAE8AAQAeAFcASQBOAC0AOABKADcANABEAEkAMQBHADQAUwBPAAQAHgBXAEkATgAtADgASgA3ADQARABJADEARwA0AFMATwADAB4AVwBJAE4ALQA4AEoANwA0AEQASQAxAEcANABTAE8ABwAIAG7tGhfpEdEBBgAEAAIAAAAIADAAMAAAAAAAAAAAAAAAADAAAPX/riDUqfP2y6J+eY0LgWzWiaSNvQjM0tJIFtL6sWyNCgAQAAAAAAAAAAAAAAAAAAAAAAAJACgASABUAFQAUAAvADEAOQAyAC4AMQA2ADgALgAxADMAN
===============================
ruby.xml
===============================
> Response (200) ruby.xml:9 :
{"xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
"xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
"xmlns:env"=>"http://www.w3.org/2003/05/soap-envelope",
"xmlns:a"=>"http://schemas.xmlsoap.org/ws/2004/08/addressing",
@jkeiser
jkeiser / autoload-rfc.md
Created October 27, 2015 23:13
Cookbook Autoload RFC
RFC Author Status Type
unassigned
John Keiser <jkeiser@chef.io>
Draft
Standards Track

Autoloaded Core Resource Cookbooks

Chef core resources will be moved into cookbooks and made implicit dependencies

@jkeiser
jkeiser / gist:e007158112a866d5c915
Created October 26, 2015 20:08
Cheffish stuff
chef_organization orgname do
validator_client_key_path
end
with_chef_server 'https://#{server}/organizations/#{orgname}'
chef_group 'new_group' do
users 'a', 'b'
end
# resources/super_file
property :path, String, name_property: true, coerce: proc { }, default: lazy { }
property :mode, Integer, default: '755', coerce: proc { |v| v.to_i(8) }
property :content, String
load_current_value do
current_value_does_not_exist! if !File.exist?(path)
mode File.stat(path).mode
content IO.read(path)
# In your recipe, do this at the top to monkeypatch the service resource the way we want:
Chef::Resource::DockerService.class_eval do
property :consumed_resources_updated, Boolean
def consumes(resource)
subscribes :consumed_resource_updated, resource, :immediately
subscribes :run, resource
end
@jkeiser
jkeiser / gist:437679a61edb174e8473
Created September 30, 2015 16:58
halite failures in my crazy bundle
~/src/chef> bundle exec rake halite_spec
Updating git://github.com/poise/poise.git
Updating git://github.com/poise/poise-boiler.git
Fetching gem metadata from https://rubygems.org/........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...................................
Using rake 10.4.2
Using addressable 2.3.8
Using backports 3.6.6
@jkeiser
jkeiser / chef-12-released.md
Created September 21, 2015 23:03
Chef 12 Released

We've just released Chef 12.4.2, a minor update with some packaging-related fixes.

  1. Support for installation via RPM 5 on Enterprise Linux. (PR)
  2. OS/X and Windows gem install and bundle install bugfix: rubygems and bundler have both been upgraded, and will now correctly pull in the latest universal version of a platform-specific gem on Windows and OS/X instead of searching for earlier Windows- or OS/X-specific versions.
  3. Chef itself will now resolve to 12.4.2 instead of 12.3.0 when bundle install or gem install is run on a gem with Chef as a dependency. (PR)

You can get it here.

You should see no changed behavior from 12.4.1, excepting potential bugfixes from dependencies which have been upgraded.

# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
{