Skip to content

Instantly share code, notes, and snippets.

View slyness's full-sized avatar
🏠
Working from home

Aaron Baer slyness

🏠
Working from home
View GitHub Profile
@slyness
slyness / gist:b83c669010753154dcd3
Created August 27, 2014 23:11
dns cookbook provider error
Recipe: dns::default
* ruby_block[Set dns name attribute] action run
- execute the ruby block Set dns name attribute
* dns[Node DNS entry] action create
================================================================================
Error executing action `create` on resource 'dns[Node DNS entry]'
================================================================================
ArgumentError
@slyness
slyness / role_to_json.rb
Last active August 29, 2015 14:05
export a bunch of roles in json to files
%w( myrole
another
thisone
thatone
somany
roles ).each do |role|
puts "exporting: " + role + "\n"
content = `knife role show #{role} -F json | python -m json.tool`
File.write("/tmp/roles/#{role}.json", content)
end
require 'serverspec'
require 'pathname'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
c.before :all do
c.os = backend(Serverspec::Commands::Base).check_os
c.path = '/sbin:/usr/sbin'
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'mycookbook', path: '.'
cookbook 'fixtures', path: 'test/unit/fixtures'
require "serverspec"
require "net/http"
require "uri"
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
c.before :all do
c.path = "/sbin:/usr/sbin"
require "chefspec"
require "chefspec/librarian"
at_exit { ChefSpec::Coverage.report! } if ENV['COVERAGE']
def load_resource(cookbook, lwrp)
require "chef/resource/lwrp_base"
name = class_name_for_lwrp(cookbook, lwrp)
unless Chef::Resource.const_defined?(name)
Chef::Resource::LWRPBase.build_from_file(
@slyness
slyness / -
Created June 24, 2014 17:26
spec_helper.rb
require 'chefspec'
require 'chefspec/librarian'
RSpec.configure do |config|
config.log_level = :fatal
end
#!/usr/bin/env rake
begin
require 'emeril/rake'
rescue LoadError
puts ">>>>> Emeril gem not loaded, omitting tasks" unless ENV['CI']
end
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:unit) do |t|
source "https://rubygems.org"
gem "chefspec"
gem "emeril"
gem "foodcritic", "~> 3.0"
gem "librarian-chef"
gem 'guard-rspec'
gem "ipaddr_extensions"
gem "builder"
# -*- mode: ruby -*-
# vi: set ft=ruby :
guard :rspec, spec_paths: ["test/unit"] do
watch(%r{^test/unit/.+_spec\.rb$})
watch(%r{^(libraries|definitions|providers|recipes|resources)/(.+)\.rb$}) { |m| "test/unit/#{m[1]}/#{m[2]}_spec.rb" }
watch("test/unit/spec_helper.rb") { "test/unit" }
end