anchor.diff:  checkStatus "Error: Chef-Server organization creation fails. Please try again"
   echo "New organization created for chef-server. RSA private key for organization stored at: /etc/chef-server/$orgShortName-validator.pem"
   
  -## Install Webui
  -echo "Installing Management Console (i.e web portal) for Chef Server..."
  -sudo chef-server-ctl install opscode-manage
  -
  -checkStatus "Error: Management Console installation failed!!! Please try again"
  -echo "Installed Webui for Chef Server"
  -
  -## configure webui
  -echo "Configuring Chef Server's Webui..."
  -sudo opscode-manage-ctl reconfigure
  -checkStatus "Error: Unable to configure webui"
  -echo "Configured Chef Server's Webui"
  -
  -## reconfigure chef-server for Webui
  -echo "Reconfiguring chef-server for Webui..."
  -sudo chef-server-ctl reconfigure
  -checkStatus "Error: Unable to reconfigure chef-server"
  -echo "Reconfigured chef-server for Webui"
  -
   echo "Successfully Installed Chef Server v12.0 !!!"
   echo "USER NAME = ${user}"
   echo "PASSWORD = ${password}"
   echo "ORGANIZATION = ${orgShortName}"
   echo "USER PRIVATE_KEY = /etc/chef-server/$user.pem"
   echo "ORGANIZATION PRIVATE_KEY = /etc/chef-server/$orgShortName-validator.pem"
  -
  -echo "Webui URL = "; cat /etc/chef-server/chef-server.rb | grep api_fqdn | awk '{print $2}'
  
positive.code:     exit 1
    fi
  }
  
  temp_dir="<%= Dir.mktmpdir %>"
  <% if node['chef-server-image']['package_url'] %>
    if ! exists /usr/bin/chef-server-ctl; then
      echo "Installing Chef Server..."
      pkg_url="<%= node['chef-server-image']['package_url'] %>"
      if exists wget; then
        wget ${pkg_url} -O ${temp_dir}/chef-server-pkg --no-check-certificate
      elif exists curl; then
        curl -L ${pkg_url} -o ${temp_dir}/chef-server-pkg
      else
        echo "Neither wget nor curl found. Please install one and try again." >&2
        exit 1
      fi
      sudo dpkg -i $temp_dir/chef-server-pkg
      checkStatus "Chef-Server Package installation failed..."
    fi
  <% else %>
    version="<%= node['chef-server-image']['package_version'] %>"
    name="<%= node['chef-server-image']['package_name'] %>"
    sudo apt-get install $name=$version
  <% end %>
  
  sudo chef-server-ctl reconfigure
  
  sudo mkdir /etc/chef-server
  
  cat > /etc/chef-server/chef-server.rb <<'EOP'
  
  topology "standalone"
  
  api_fqdn "<%= node['chef-server']['api_fqdn'] %>"
  
  <% node['chef-server']['configuration'].each_pair do |component, tunables| -%>
  <% case tunables -%>
  <% when Hash -%>
  <% tunables.each_pair do |name, value| -%>
  <% value = %Q["#{value}"] if value.kind_of?(String) -%>
  <%= "#{component.gsub("-","_")}['#{name}'] = #{value}" %>
  <% end -%>
  <% when String -%>
  <%= component.gsub('-', '_') %> "<%= tunables %>"
  <% end -%>
  <% end -%>
  EOP
  
  ## Take chef server configuration from user
  while getopts ":u:f:l:e:p:o:F:" opt; do
  
negative.code:   usage
  fi
  
  ## Install Chef Server
  
  temp_dir="<%= Dir.mktmpdir %>"
  <% if node['chef-server-image']['package_url'] %>
    if ! exists /usr/bin/chef-server-ctl; then
      echo "Installing Chef Server..."
      pkg_url="<%= node['chef-server-image']['package_url'] %>"
      if exists wget; then
        wget ${pkg_url} -O ${temp_dir}/chef-server-pkg --no-check-certificate
      elif exists curl; then
        curl -L ${pkg_url} -o ${temp_dir}/chef-server-pkg
      else
        echo "Neither wget nor curl found. Please install one and try again." >&2
        exit 1
      fi
      sudo dpkg -i $temp_dir/chef-server-pkg
      checkStatus "Chef-Server Package installation failed..."
    fi
  <% else %>
    version="<%= node['chef-server-image']['package_version'] %>"
    name="<%= node['chef-server-image']['package_name'] %>"
    sudo apt-get install $name=$version
  <% end %>
  
  sudo chef-server-ctl reconfigure
  
  sudo mkdir /etc/chef-server
  
  cat > /etc/chef-server/chef-server.rb <<'EOP'
  
  topology "standalone"
  
  api_fqdn "<%= node['chef-server']['api_fqdn'] %>"
  
  <% node['chef-server']['configuration'].each_pair do |component, tunables| -%>
  <% case tunables -%>
  <% when Hash -%>
  <% tunables.each_pair do |name, value| -%>
  <% value = %Q["#{value}"] if value.kind_of?(String) -%>
  <%= "#{component.gsub("-","_")}['#{name}'] = #{value}" %>
  <% end -%>
  <% when String -%>
  <%= component.gsub('-', '_') %> "<%= tunables %>"
  <% end -%>
  <% end -%>
  EOP
  
  sudo chef-server-ctl reconfigure
  
  ## Create user
  