summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaustubh-d <kaustubh@clogeny.com>2013-10-08 20:02:59 +0530
committerkaustubh-d <kaustubh@clogeny.com>2013-10-09 10:45:43 +0530
commit0812600cee1b1817daa40697ee9b4c25cd734874 (patch)
tree0daa7e34d408aaa804d0fe0ffdde990d059a81b7
parent0ab20c9cfe459c6849876f1dd4c3683adac88557 (diff)
downloadchef-0812600cee1b1817daa40697ee9b4c25cd734874.tar.gz
AIX: implement review comments, name as chef-aix and use ksh -c
-rw-r--r--lib/chef/knife/bootstrap/chef-aix.erb (renamed from lib/chef/knife/bootstrap/chef-on-aix.erb)31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/chef/knife/bootstrap/chef-on-aix.erb b/lib/chef/knife/bootstrap/chef-aix.erb
index 1d37a58389..59993b478a 100644
--- a/lib/chef/knife/bootstrap/chef-on-aix.erb
+++ b/lib/chef/knife/bootstrap/chef-aix.erb
@@ -1,12 +1,21 @@
-#!/bin/ksh
-<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
-
-if ! [[ -e /usr/bin/chef-client ]] ; then
+ksh -c '
+
+function exists {
+ if type $1 >/dev/null 2>&1
+ then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if ! exists /usr/bin/chef-client; then
<% if @chef_config[:aix_package] -%>
# Read the download URL/location from knife.rb with option aix_package
- # For now just install from local, TODO - fetch from download URL
- # perl -e 'use LWP::Simple; getprint($ARGV[0]);' package_url > /tmp/chef-install_file
- installp -aYF -d <%= @chef_config[:aix_package] %> chef
+ rm -rf /tmp/chef_installer # ensure there no older pkg
+ echo "<%= @chef_config[:aix_package] %>"
+ perl -e '\''use LWP::Simple; getprint($ARGV[0]);'\'' <%= @chef_config[:aix_package] %> > /tmp/chef_installer
+ installp -aYF -d /tmp/chef_installer chef
<% else -%>
echo ":aix_package location is not set in knife.rb"
exit
@@ -15,13 +24,13 @@ fi
mkdir -p /etc/chef
-awk NF > /etc/chef/validation.pem <<'EOP'
+cat > /etc/chef/validation.pem <<'EOP'
<%= validation_key %>
EOP
chmod 0600 /etc/chef/validation.pem
-<% if @chef_config[:encrypted_data_bag_secret] -%>
-awk NF > /etc/chef/encrypted_data_bag_secret <<'EOP'
+<% if encrypted_data_bag_secret -%>
+cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
<%= encrypted_data_bag_secret %>
EOP
chmod 0600 /etc/chef/encrypted_data_bag_secret
@@ -46,4 +55,4 @@ cat > /etc/chef/first-boot.json <<'EOP'
<%= first_boot.to_json %>
EOP
-<%= start_chef %>
+<%= start_chef %>'