This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Starting Bake" | |
puts config[:bake] | |
if config[:bake] | |
image_name = config[:bake] | |
puts image_name | |
image_description = (config[:run_list] || config[:role]).join(', ') | |
puts image_description | |
ami_info = connection.create_image(@server.identity, image_name, image_description) | |
puts ami_info.inspect | |
new_ami_id = ami_info.body['imageId'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: clean install | |
install: | |
bundle install | |
bundle exec berks install | |
test: | |
@bundle exec bash ${CHEF_PATH}/scripts/knife_test.sh | |
@bundle exec bash ${CHEF_PATH}/scripts/foodcritic_test.sh | |
@bundle exec bash ${CHEF_PATH}/scripts/rspec_test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function download_cookbook() { | |
cookbook=${1} | |
if _check_input ${cookbook} | |
then | |
_clone_cookbook ${cookbook} | |
_link_cookbook_files ${cookbook} | |
cd ${CHEF_PATH}/cookbooks/${cookbook} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ptbr_laugh; (1..(1 + rand * 10)).map {("h" + ((rand * 4) + 1).to_i.times.map {%w(a e i o u)[rand * 5]}.join )}.join; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = node['redisio']['mirror'] | |
base_name = node['redisio']['base_name'] | |
version = node['redisio']['version'] | |
extension = node['redisio']['artifact_type'] | |
tarball_name = "#{base_name}#{version}" | |
tarball = "#{tarball_name}.#{extension}" | |
download_url = "#{url}/#{tarball}" | |
download_dir = node['redisio']['download_dir'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = node['redisio']['mirror'] | |
base_name = node['redisio']['base_name'] | |
version = node['redisio']['version'] | |
extension = node['redisio']['artifact_type'] | |
tarball_name = "#{base_name}#{version}" | |
tarball = "#{tarball_name}.#{extension}" | |
download_url = "#{url}/#{tarball}" | |
download_dir = node['redisio']['download_dir'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_open_point(existing_device_prefix, new_device_range_start, new_device_range_stop) | |
# existing_device_prefix should be something like 'xvd' or 'md' | |
# new_device_range should be similar to '0' and '9' or 'f' and 'p' | |
possible_attach_points = (new_device_range_start..new_device_range_stop).map do |drive_letter| | |
"/dev/#{existing_device_prefix}#{drive_letter}" | |
end | |
Chef::Log.debug("#{@new_resource} Possible Attach Points: #{possible_attach_points}") | |
# Get a list of in use devices (fold numbered partitions together if looking at disk drives) | |
existing_devices = `ls /dev/#{existing_device_prefix}*`.split().each do |existing_device| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
action :create do | |
# Some Chef Code | |
end | |
action :remove do | |
# Some more Chef code | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chef | |
class Provider | |
class CloudMagic < Chef::Provider | |
# We MUST override this method in our custom provider | |
def load_current_resource | |
# Here we keep the existing version of the resource | |
# if none exists we create a new one from the resource we defined earlier | |
@current_resource ||= Chef::Resource::CloudMagic.new(new_resource.name) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
action :enable, :remove | |
default_action :enable | |
attribute :magic, kind_of => [TrueClass, FalseClass], :default => true | |
attribute :cloud, kind_of => String, :name_attribute => true |