Skip to content

Instantly share code, notes, and snippets.

View caryp's full-sized avatar

caryp

View GitHub Profile
Cloud Agnostic Attributes ¶
To avoid coding cloud specific attributes (like EC2's "public_ipv4") into recipes it would be nice to make available "cloud agnostic" attributes in the chef node. These attributes would be a collection of instance information that is common across all clouds (such as instance identifiers and public/private ip addresses). By abstracting these platform specific values and placing them in the chef node it will provide a uniform way for recipes to access instance information without adding 'if' or 'case' statement within the recipes.
Not only will this avoid clutter in the recipes, but it will also avoid a maintenance burden by placing cloud specific code in one place.
Some attributes immediately apparent are:
instance_id : an instance identifier assigned by the cloud provider. public_ip : the public facing IP address for the instance. private_ip : the private IP address for the instance. others??
naming suggestions ¶
diff --git a/spec/ohai/plugins/ec2_spec.rb b/spec/ohai/plugins/ec2_spec.rb
index 8ffb1ef..ddd046e 100644
--- a/spec/ohai/plugins/ec2_spec.rb
+++ b/spec/ohai/plugins/ec2_spec.rb
@@ -51,6 +51,10 @@ describe Ohai::System, "plugin ec2" do
end
it "should recursively fetch all the ec2 metadata" do
+ IO.stub!(:select).and_return([[],[1],[]])
+ t = mock("connection")
# Configuring Apache Multi-Processing Module
case node[:platform]
when "centos","redhat","fedora","suse"
binary_to_use = @node[:apache][:binary]
if @node[:apache][:mpm] != 'prefork'
binary_to_use << ".worker"
end
template "centos_sysconfig_httpd" do
#
# Cookbook Name:: dns
# Recipe:: default
#
## Set DNS for given id to the current address of this node
#
#dns "my.domain.id.com" do
# user "account_user_name"
# passwd "account_password"
#
# Cookbook Name:: repo_git
# Definition:: repo_git_pull
#
define :repo_git_pull, url => nil, branch => 'master', dest => nil, user => nil, cred => nil do
# add repository credentials
if params[:cred] != nil