Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: f0855fa04a09
Choose a base ref
...
head repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b442dabcd70d
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Jan 19, 2015

  1. Copy the full SHA
    ec1dc12 View commit details
  2. Copy the full SHA
    c729436 View commit details
  3. Copy the full SHA
    b442dab View commit details
Showing with 56 additions and 15 deletions.
  1. +51 −13 .chef/bootstrap/rubygems-trusty.erb
  2. +2 −0 .chef/knife.rb
  3. +2 −1 Rakefile
  4. +1 −1 cookbooks/rubygems/recipes/default.rb
64 changes: 51 additions & 13 deletions .chef/bootstrap/rubygems-trusty.erb
Original file line number Diff line number Diff line change
@@ -17,14 +17,56 @@ sh -c "echo \"deb http://repo01.common.rubygems.org trusty main\" > /etc/apt
apt-get update
apt-get upgrade -y

exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi
}

<% if knife_config[:bootstrap_install_command] %>
<%= knife_config[:bootstrap_install_command] %>
<% else %>
install_sh="<%= knife_config[:bootstrap_url] ? knife_config[:bootstrap_url] : "https://www.opscode.com/chef/install.sh" %>"
if ! exists /usr/bin/chef-client; then
echo "Installing Chef Client..."
if exists wget; then
bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_wget_options] %> ${install_sh} -O -) <%= latest_current_chef_version_string %>
elif exists curl; then
bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> <%= knife_config[:bootstrap_curl_options] %> ${install_sh}) <%= latest_current_chef_version_string %>
else
echo "Neither wget nor curl found. Please install one and try again." >&2
exit 1
fi
fi
<% end %>

mkdir -p /etc/chef

# Setup the validation key.
(
cat <<'EOP'
<%= IO.read(Chef::Config[:validation_key]) %>
cat > /etc/chef/validation.pem <<'EOP'
<%= validation_key %>
EOP
chmod 0600 /etc/chef/validation.pem

<% if encrypted_data_bag_secret -%>
cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
<%= encrypted_data_bag_secret %>
EOP
) > /etc/chef/validation.pem
chmod 0600 /etc/chef/encrypted_data_bag_secret
<% end -%>

<%# Generate Ohai Hints -%>
<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
mkdir -p /etc/chef/ohai/hints

<% @chef_config[:knife][:hints].each do |name, hash| -%>
cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
<%= Chef::JSONCompat.to_json(hash) %>
EOP
<% end -%>
<% end -%>

# Setup the client configuration.
(
@@ -40,14 +82,10 @@ node_name "<%= @config[:chef_node_name] %>"
EOP
) > /etc/chef/client.rb

(
cat <<'EOP'
<%= { "run_list" => @run_list }.to_json %>
cat > /etc/chef/first-boot.json <<'EOP'
<%= Chef::JSONCompat.to_json(first_boot) %>
EOP
) > /etc/chef/first-boot.json

curl -L https://www.opscode.com/chef/install.sh | sudo bash

/usr/bin/chef-client -j /etc/chef/first-boot.json
echo "Starting first Chef Client run..."

'
<%= start_chef %>'
2 changes: 2 additions & 0 deletions .chef/knife.rb
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@
cookbook_path "#{current_dir}/../cookbooks"
environment_path "#{current_dir}/../environments"

knife[:bootstrap_file] = "#{current_dir}/bootstrap/rubygems-trusty.erb"

# Provision new instances with knife-ec2
knife[:aws_access_key_id] = ENV['RUBYGEMS_AWS_ACCESS_KEY_ID']
knife[:aws_secret_access_key] = ENV['RUBYGEMS_AWS_SECRET_KEY_ID']
3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ FoodCritic::Rake::LintTask.new(:foodcritic) do |t|
cookbook_paths: 'cookbooks',
tags: [
'~FC003',
'~FC011'
'~FC011',
'~FC017'
]
}
end
2 changes: 1 addition & 1 deletion cookbooks/rubygems/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

ruby_block 'check chef-client-stopped tag' do
block do
if node[:tags].include?('chef-client-stopped')
if node['tags'].include?('chef-client-stopped')
Chef::Log.debug('Stopping chef run because chef-client-stopped tag exists.')
Process.exit!(true)
end