summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/knife/bootstrap.rb20
-rw-r--r--lib/chef/knife/bootstrap/chef-full.erb29
2 files changed, 36 insertions, 13 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index cb49cfbb2e..aae927e0ca 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -154,6 +154,26 @@ class Chef
:description => "A file containing the secret key to use to encrypt data bag item values",
:proc => Proc.new { |sf| Chef::Config[:knife][:secret_file] = sf }
+ option :bootstrap_url,
+ :long => "--bootstrap-url URL",
+ :description => "URL to a custom installation script",
+ :proc => Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
+
+ option :bootstrap_install_command,
+ :long => "--bootstrap-install-command COMMANDS",
+ :description => "Custom command to install chef-client",
+ :proc => Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
+
+ option :bootstrap_wget_options,
+ :long => "--bootstrap-wget-options OPTIONS",
+ :description => "Add options to wget when installing chef-client",
+ :proc => Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
+
+ option :bootstrap_curl_options,
+ :long => "--bootstrap-curl-options OPTIONS",
+ :description => "Add options to curl when install chef-client",
+ :proc => Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
+
def find_template(template=nil)
# Are we bootstrapping using an already shipped template?
if config[:template_file]
diff --git a/lib/chef/knife/bootstrap/chef-full.erb b/lib/chef/knife/bootstrap/chef-full.erb
index 1d75117b72..c0b8d54dad 100644
--- a/lib/chef/knife/bootstrap/chef-full.erb
+++ b/lib/chef/knife/bootstrap/chef-full.erb
@@ -19,20 +19,23 @@ exists() {
fi
}
-install_sh="https://www.opscode.com/chef/install.sh"
-version_string="-v <%= chef_version %>"
-
-if ! exists /usr/bin/chef-client; then
- echo "Installing Chef Client..."
- if exists wget; then
- bash <(wget <%= "--proxy=on " if knife_config[:bootstrap_proxy] %> ${install_sh} -O -) ${version_string}
- elif exists curl; then
- bash <(curl -L <%= "--proxy \"#{knife_config[:bootstrap_proxy]}\" " if knife_config[:bootstrap_proxy] %> ${install_sh}) ${version_string}
- else
- echo "Neither wget nor curl found. Please install one and try again." >&2
- exit 1
+<% 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" %>"
+ version_string="-v <%= chef_version %>"
+ 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 -) ${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}) ${version_string}
+ else
+ echo "Neither wget nor curl found. Please install one and try again." >&2
+ exit 1
+ fi
fi
-fi
+<% end %>
mkdir -p /etc/chef