Selaa lähdekoodia

Ambari management and monitoring code

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/ambari-0.1@1335750 13f79535-47bb-0310-9956-ffa450edef68
Suhas 13 vuotta sitten
commit
f6e531a1a0
100 muutettua tiedostoa jossa 8255 lisäystä ja 0 poistoa
  1. 46 0
      README.txt
  2. 94 0
      hmc/ShellScripts/puppet_agent_install.sh
  3. 246 0
      hmc/archive/ShellScripts/configureClusterAdvanced.sh
  4. 176 0
      hmc/archive/ShellScripts/dbLib.sh
  5. 179 0
      hmc/archive/ShellScripts/deploy.sh
  6. 55 0
      hmc/archive/ShellScripts/discoverNodes.sh
  7. 105 0
      hmc/archive/ShellScripts/easyInstallerLib.sh
  8. 98 0
      hmc/archive/ShellScripts/generateNodeFiles.sh
  9. 70 0
      hmc/archive/ShellScripts/pdshDiscoverNodes.sh
  10. 227 0
      hmc/archive/ShellScripts/pdshSuggestMem.sh
  11. 207 0
      hmc/archive/ShellScripts/servicesLib.sh
  12. 227 0
      hmc/archive/ShellScripts/suggestMemSize.sh
  13. 115 0
      hmc/archive/ShellScripts/suggestNodes.sh
  14. 55 0
      hmc/archive/ShellScripts/templates/gsCluster.properties.in
  15. 206 0
      hmc/archive/ShellScripts/templates/gsInstaller.properties.in
  16. 40 0
      hmc/archive/ShellScripts/templates/monInstaller.properties.in
  17. 166 0
      hmc/archive/php/assignHosts.php
  18. 163 0
      hmc/archive/php/configureCluster.php
  19. 35 0
      hmc/archive/php/createCluster.php
  20. 335 0
      hmc/archive/php/dbLib.php
  21. 130 0
      hmc/archive/php/deploy.php
  22. 77 0
      hmc/archive/php/displayLogs.php
  23. 18 0
      hmc/archive/php/displayNodeProgress.php
  24. 18 0
      hmc/archive/php/dummyDeploy.php
  25. 22 0
      hmc/archive/php/dummyFetchTxnLogs.php
  26. 53 0
      hmc/archive/php/dummyFetchTxnProgressReport.php
  27. 17 0
      hmc/archive/php/globals.inc
  28. 216 0
      hmc/archive/php/gsInstallerUtils.php
  29. 281 0
      hmc/archive/php/initializeCluster.php
  30. 38 0
      hmc/archive/php/listClusters.php
  31. 2 0
      hmc/archive/php/memorySuggestor-data.txt
  32. 54 0
      hmc/archive/php/options.php
  33. 24 0
      hmc/archive/php/pluggableDisplayHeaderFooter.php
  34. 91 0
      hmc/archive/php/serviceAdmin.php
  35. 181 0
      hmc/archive/php/servicesStatus.php
  36. 280 0
      hmc/archive/php/tmpInitializeCluster.php
  37. 45 0
      hmc/archive/php/uploadFiles.php
  38. 24 0
      hmc/archive/php/utils.php
  39. 86 0
      hmc/archive/playground/assignHosts.php
  40. 71 0
      hmc/archive/playground/configureCluster.php
  41. 3 0
      hmc/archive/playground/data.txt
  42. 5 0
      hmc/archive/playground/input/hostsFile.txt
  43. 27 0
      hmc/archive/playground/input/va_rsa
  44. 7 0
      hmc/archive/playground/mergeTest.php
  45. 60 0
      hmc/archive/playground/nodessugg.php
  46. 1 0
      hmc/archive/playground/output/DashboardSuggest.out
  47. 1 0
      hmc/archive/playground/output/GangliaCollectorSuggest.out
  48. 1 0
      hmc/archive/playground/output/GatewaySuggest.out
  49. 1 0
      hmc/archive/playground/output/HBaseMasterSuggest.out
  50. 1 0
      hmc/archive/playground/output/HCatalogServerSuggest.out
  51. 5 0
      hmc/archive/playground/output/HostDiscovery.out
  52. 1 0
      hmc/archive/playground/output/JobTrackerSuggest.out
  53. 1 0
      hmc/archive/playground/output/NagiosServerSuggest.out
  54. 4 0
      hmc/archive/playground/output/NameNodeMountPointsSuggest.out
  55. 1 0
      hmc/archive/playground/output/NameNodeSuggest.out
  56. 1 0
      hmc/archive/playground/output/OozieServerSuggest.out
  57. 1 0
      hmc/archive/playground/output/SecondaryNameNodeSuggest.out
  58. 1 0
      hmc/archive/playground/output/TempletonNodeSuggest.out
  59. 120 0
      hmc/archive/playground/readFromProps.php
  60. 15 0
      hmc/archive/playground/rez.php
  61. 11 0
      hmc/archive/playground/testing.php
  62. 25 0
      hmc/conf/hmc.conf
  63. 5 0
      hmc/cpp/foo.sh
  64. 21 0
      hmc/cpp/runscriptasroot.c
  65. 27 0
      hmc/css/clusters.css
  66. 247 0
      hmc/css/common.css
  67. 161 0
      hmc/css/common2.css
  68. 267 0
      hmc/css/common3.css
  69. 143 0
      hmc/css/manageServices.css
  70. 143 0
      hmc/css/selectHosts.css
  71. 448 0
      hmc/db/schema.dump
  72. 184 0
      hmc/html/addNodesWizard.php
  73. 31 0
      hmc/html/bootstrapJs.htmli
  74. 41 0
      hmc/html/cluster.php
  75. 103 0
      hmc/html/clusters.php
  76. 56 0
      hmc/html/displayLogs.php
  77. 278 0
      hmc/html/dummyInitializeCluster.php
  78. 39 0
      hmc/html/expandTab.html
  79. 3 0
      hmc/html/footer.html
  80. 8 0
      hmc/html/header.html
  81. 102 0
      hmc/html/history.html
  82. 52 0
      hmc/html/index.php
  83. 337 0
      hmc/html/initializeCluster.php
  84. BIN
      hmc/html/logo.jpg
  85. 149 0
      hmc/html/manageServices.php
  86. 119 0
      hmc/html/rez.html
  87. 55 0
      hmc/html/rez.html.old
  88. 45 0
      hmc/html/serviceStatus.html
  89. 49 0
      hmc/html/summary.html
  90. 124 0
      hmc/html/tempHostMapping.html
  91. 115 0
      hmc/html/tempHostMapping2.html
  92. 10 0
      hmc/html/tryRadio.html
  93. 26 0
      hmc/html/x.html
  94. 1 0
      hmc/html/x.txt
  95. BIN
      hmc/images/green_check.gif
  96. BIN
      hmc/images/green_check.png
  97. BIN
      hmc/images/green_check_large.png
  98. BIN
      hmc/images/loading.gif
  99. BIN
      hmc/images/loadingLarge.gif
  100. BIN
      hmc/images/loading_orange.gif

+ 46 - 0
README.txt

@@ -0,0 +1,46 @@
+How to use HMC:
+
+The rpm has a dependency on puppet. For now (until we have yum repo for HMC and puppet), to install puppet on the install host, you will have to add the following repo.
+
+edit file  /etc/yum.repos.d/puppet.repo as root
+to contain:
+[Puppet]
+name=Puppet
+baseurl = http://yum.puppetlabs.com/el/5/products/x86_64/
+enabled=1
+gpgcheck=0
+
+yum install rpm-build
+
+cd hmc; // The new directory structure
+
+cd package/rpm
+./create_hmc_rpm.sh
+
+To install the rpm:
+sudo yum install php 5.1.6
+sudo yum install pdsh pdsh-rcmd-exec pdsh-rcmd-ssh
+sudo yum install httpd-devel mod_ssl
+sudo yum install puppet-2.7.9
+sudo yum install php-pdo-5.1.6
+sudo yum install php-pecl-json-1.2.1
+sudo yum install ruby-devel rubygems
+sudo rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm
+sudo yum install mod_passenger
+sudo rpm -iv  build/rpmbuild/RPMS/noarch/hmc-0.0.1-2.noarch.rpm
+
+To Run:
+
+Before starting, HMC requires java 32 bit and 64 bit to be available on the HMC host at /var/run/hmc/downloads/.
+
+sudo service hmc  start
+
+Visit:
+
+ http://HOSTNAME/hmc/html/index.php
+
+ to get started.
+
+ Make sure you copy root's ssh public keys to all the cluster hosts.
+ You will have to copy the ssh private key to your desktop for later use in the UI.
+

+ 94 - 0
hmc/ShellScripts/puppet_agent_install.sh

@@ -0,0 +1,94 @@
+#!/bin/bash
+#*
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+#
+#  /* This script takes three arguments,
+#   * - sshkey: if not specified then ssh w/o key
+#   * - repository information : to be added to remote node
+#   * - list of hosts
+#  */
+#set -e
+#set -x 
+trap 'pp_cmd=$ppp_cmd; ppp_cmd=$previous_command; previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
+#trap 'echo "$host: retcode:[$?] command:[$previous_command], out:[$out]"' EXIT
+#printf 'Argument is __%s__\n' "$@"
+
+master=$1
+repo_name=$2
+repo_desc=$3
+repourl=$4
+gpgkeyurl=$5
+
+host=`hostname -f | tr '[:upper:]' '[:lower:]'`
+
+#echo "$host:_ERROR_:$master, $repo_name, $repo_desc, $repourl, $gpgkeyurl"
+
+repo_file_content=''
+if [[ -z "$gpgkeyurl" ]]; then
+  repo_file_content="[$repo_name]\nname=$repo_desc\nbaseurl=$repourl\nenabled=1\ngpgcheck=0"
+else 
+  repo_file_content="[$repo_name]\nname=$repo_desc\nbaseurl=$repourl\nenabled=1\ngpgcheck=1\ngpgkey=$gpgkeyurl"
+fi
+
+out=`echo -e $repo_file_content > /etc/yum.repos.d/$repo_name.repo`
+ret=$?
+if [[ "$ret" != "0" ]]; then
+  echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+  exit 1
+fi
+
+
+if [[ ! -z "$gpgkeyurl" ]]; then
+  out=`rpm --import $gpgkeyurl`
+  ret=$?
+  if [[ "$ret" != "0" ]]; then
+    echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+    exit 1
+  fi
+fi
+
+out=`rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm 2>&1`
+out=`/etc/init.d/iptables stop 1>/dev/null`
+out=`yum install -y puppet-2.7.9-2`
+ret=$?
+if [[ "$ret" != "0" ]]; then
+  echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+  exit 1
+fi
+out=`mkdir -p /etc/puppet/agent 2>&1`
+agent_auth_conf="path /run\nauth any\nallow $master\n\npath /\nauth any"
+out=`echo -e $agent_auth_conf > /etc/puppet/agent/auth.conf`
+out=`touch /etc/puppet/agent/namespaceauth.conf`
+out=`cp -f /etc/puppet/puppet.conf /etc/puppet/agent/ 2>&1`
+ret=$?
+if [[ "$ret" != "0" ]]; then
+  echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+  exit 1
+fi
+#TODO clean this up for better fix. For now make sure we stop puppet agent. The issue here is we do not know if we started this puppet agent during our run or not.
+out=`service puppet stop`
+ret=$?
+out=`puppet agent --verbose --confdir=/etc/puppet/agent --listen --runinterval 5 --server $master --report --no-client --waitforcert 10 --debug --logdest=/var/log/puppet_agent.log --httplog /var/log/puppet_agent_http.log --autoflush --pluginsync 2>&1`
+ret=$?
+if [[ "$ret" != "0" ]]; then
+  echo "$host:_ERROR_:retcode:[$ret], CMD:[$pp_cmd]: OUT:[$out]" >&2
+  exit 1
+fi
+exit 0

+ 246 - 0
hmc/archive/ShellScripts/configureClusterAdvanced.sh

@@ -0,0 +1,246 @@
+#!/bin/sh
+
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+baseDir=`dirname ${0}`;
+
+source ${baseDir}/easyInstallerLib.sh;
+source ${baseDir}/dbLib.sh;
+source ${baseDir}/servicesLib.sh;
+
+###########################
+### FILE-SCOPED GLOBALS ###
+###########################
+
+# TODO XXX Take this in from the UI in the future (and likely store it as a 
+# marker on disk, to really be of any use).
+clusterName="MyHDPCluster";
+
+#############################
+### FILE-SCOPED FUNCTIONS ###
+#############################
+
+function getServiceHost
+{
+  local serviceHost="";
+
+  local serviceName="${1}";
+
+  if [ "x" != "x${serviceName}" ]
+  then
+    serviceHostFile=`fetchDbFileForCluster "${clusterName}" "${serviceName}"`;
+    serviceHost=`getFirstWordFromFile "${serviceHostFile}"`;
+  fi
+
+  echo "${serviceHost}";
+}
+
+function generateServiceConfigChoiceXml
+{
+  local serviceConfigChoiceXml="";
+
+  local serviceHostFileName="${1}";
+  local serviceConfigKey="${2}";
+
+  if [ "x" != "x${serviceHostFileName}" ] && [ "x" != "x${serviceConfigKey}" ]
+  then
+    local serviceHostValue=`getServiceHost "${serviceHostFileName}"`;
+
+    serviceConfigChoiceXml="<hudson.model.ChoiceParameterDefinition>\
+<name>${serviceConfigKey}</name>\
+<description></description>\
+<choices class=\\\"java.util.Arrays\\\$ArrayList\\\">\
+<a class=\\\"string-array\\\">\
+<string>${serviceHostValue}</string>\
+</a>\
+</choices>\
+</hudson.model.ChoiceParameterDefinition>";
+  fi
+
+  echo "${serviceConfigChoiceXml}";
+}
+
+function generateOptionalServicesConfigChoicesXml
+{
+  local optionalServicesConfigChoicesXml="";
+
+  local isHBaseInstalled="${1}"; 
+  local isHCatalogInstalled="${2}";
+  local isTempletonInstalled="${3}";
+  local isOozieInstalled="${4}";
+
+  if [ "xyes" == "x${isHBaseInstalled}" ]
+  then
+    hBaseConfigChoicesXml=`generateServiceConfigChoiceXml "hbasemaster" "HDPHBaseMasterHost"`;
+    optionalServicesConfigChoicesXml="${optionalServicesConfigChoicesXml}${hBaseConfigChoicesXml}";
+  fi
+
+  if [ "xyes" == "x${isHCatalogInstalled}" ]
+  then
+    hCatalogConfigChoicesXml=`generateServiceConfigChoiceXml "hcatserver" "HDPHCatalogServerHost"`;
+    optionalServicesConfigChoicesXml="${optionalServicesConfigChoicesXml}${hCatalogConfigChoicesXml}";
+  fi
+
+  if [ "xyes" == "x${isTempletonInstalled}" ]
+  then
+    templetonConfigChoicesXml=`generateServiceConfigChoiceXml "templetonnode" "HDPTempletonNodeHost"`;
+    optionalServicesConfigChoicesXml="${optionalServicesConfigChoicesXml}${templetonConfigChoicesXml}";
+  fi
+
+  if [ "xyes" == "x${isOozieInstalled}" ]
+  then
+    oozieConfigChoicesXml=`generateServiceConfigChoiceXml "oozieserver" "HDPOozieServerHost"`;
+    optionalServicesConfigChoicesXml="${optionalServicesConfigChoicesXml}${oozieConfigChoicesXml}";
+  fi
+
+  echo "${optionalServicesConfigChoicesXml}";
+}
+
+#############
+### SETUP ###
+#############
+
+# XXX XXX RESUME FROM HERE
+###checkpointedStageNumber=`fetchDbCookieForCluster "${clusterName}" "${CHECKPOINTED_STAGE_NUMBER_COOKIE_NAME}"`;
+###
+###currentStageName="1-HDP-Initialize-Cluster";
+###currentStageNumber=`getStageNumberFromName "${currentStageName}"`;
+###
+###currentStageCanRun=`isStageTransitionAdmissable "${checkpointedStageNumber}" "${currentStageNumber}"`;
+###
+###if [ "${currentStageCanRun}" != "1" ]
+###then
+###  echo "Inadmissable stage transition attempted - bailing out.";
+###  exit 1;
+###fi
+
+# Create our per-build workspace - it's a shame Jenkins doesn't provide this for us.
+perBuildWorkspace=${WORKSPACE}/${BUILD_NUMBER};
+
+cmd="mkdir ${perBuildWorkspace}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+######################
+### PRE-PROCESSING ###
+######################
+
+# Do nothing.
+
+######################
+### THE MAIN EVENT ###
+######################
+
+# Do nothing.
+
+#######################
+### POST-PROCESSING ###
+#######################
+
+# Store the data we've gotten from the user into our DB.
+read -r -d '' gsClusterConf << EOConf
+s!@HDPHadoopHeapSize@!${HDPHadoopHeapSize}!g
+s!@HDPNameNodeHeapSize@!${HDPNameNodeHeapSize}!g
+s!@HDPFSInMemorySize@!${HDPFSInMemorySize}!g
+s!@HDPNameNodeOptNewSize@!${HDPNameNodeOptNewSize}!g
+s!@HDPDataNodeDuReserved@!${HDPDataNodeDuReserved}!g
+s!@HDPDataNodeHeapSize@!${HDPDataNodeHeapSize}!g
+s!@HDPJobTrackerOptNewSize@!${HDPJobTrackerOptNewSize}!g
+s!@HDPJobTrackerOptMaxNewSize@!${HDPJobTrackerOptMaxNewSize}!g
+s!@HDPJobTrackerHeapSize@!${HDPJobTrackerHeapSize}!g
+s!@HDPMapRedMapTasksMax@!${HDPMapRedMapTasksMax}!g
+s!@HDPMapRedReduceTasksMax@!${HDPMapRedReduceTasksMax}!g
+s!@HDPMapRedClusterMapMemoryMB@!${HDPMapRedClusterMapMemoryMB}!g
+s!@HDPMapRedClusterReduceMemoryMB@!${HDPMapRedClusterReduceMemoryMB}!g
+s!@HDPMapRedClusterMaxMapMemoryMB@!${HDPMapRedClusterMaxMapMemoryMB}!g
+s!@HDPMapRedClusterMaxReduceMemoryMB@!${HDPMapRedClusterMaxReduceMemoryMB}!g
+s!@HDPMapRedJobMapMemoryMB@!${HDPMapRedJobMapMemoryMB}!g
+s!@HDPMapRedJobReduceMemoryMB@!${HDPMapRedJobReduceMemoryMB}!g
+s!@HDPMapRedChildJavaOptsSize@!${HDPMapRedChildJavaOptsSize}!g
+s!@HDPIoSortMB@!${HDPIoSortMB}!g
+s!@HDPIoSortSpillPercent@!${HDPIoSortSpillPercent}!g
+s!@HDPMapReduceUserLogRetainHours@!${HDPMapReduceUserLogRetainHours}!g
+s!@HDPMaxTasksPerJob@!${HDPMaxTasksPerJob}!g
+s!@HDPDFSDataNodeFailedVolumeTolerated@!${HDPDFSDataNodeFailedVolumeTolerated}!g
+s!@HDPHBaseMasterHeapSize@!${HDPHBaseMasterHeapSize:-1024m}!g
+s!@HDPHBaseRegionServerHeapSize@!${HDPHBaseRegionServerHeapSize:-1024m}!g
+EOConf
+
+# The escaped quotes around ${gsClusterConf} are important because 
+# we're passing in a multi-line blob as a string, so the command-line 
+# invocation needs to have the blob quoted so storeDbConfForCluster can treat
+# it as a single string.
+cmd="storeDbConfForCluster ${clusterName} ${GSCLUSTER_PROPERTIES_CONF_NAME} \"${gsClusterConf}\"";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# Fetch the next stage's configuration
+nextJobName="5-HDP-Deploy";
+nextJobConfigFile="${perBuildWorkspace}/${nextJobName}.config.xml";
+
+cmd="fetchJobConfigTemplate ${nextJobName} ${nextJobConfigFile}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# Modify this fetched config to take into account the output of all the jobs till now.
+
+isHBaseInstalled=`isServiceInstalledForCluster "${clusterName}" "HBase"`;
+isPigInstalled=`isServiceInstalledForCluster "${clusterName}" "Pig"`;
+isHCatalogInstalled=`isServiceInstalledForCluster "${clusterName}" "HCatalog"`;
+isTempletonInstalled=`isServiceInstalledForCluster "${clusterName}" "Templeton"`;
+isOozieInstalled=`isServiceInstalledForCluster "${clusterName}" "Oozie"`;
+isSqoopInstalled=`isServiceInstalledForCluster "${clusterName}" "Sqoop"`;
+
+nameNodeHost=`getServiceHost "namenode"`;
+secondaryNameNodeHost=`getServiceHost "snamenode"`;
+jobTrackerHost=`getServiceHost "jobtracker"`;
+gangliaCollectorHost=`getServiceHost "gangliaserver"`;
+nagiosServerHost=`getServiceHost "nagiosserver"`;
+
+optionalServicesConfigChoicesXml=`generateOptionalServicesConfigChoicesXml \
+  "${isHBaseInstalled}" "${isHCatalogInstalled}" "${isTempletonInstalled}" "${isOozieInstalled}"`;
+
+cmd="sed -i.prev \
+	-e \"s!@HDPInstallHBaseChoice@!${isHBaseInstalled}!g\" \
+	-e \"s!@HDPInstallPigChoice@!${isPigInstalled}!g\" \
+	-e \"s!@HDPInstallHCatalogChoice@!${isHCatalogInstalled}!g\" \
+	-e \"s!@HDPInstallTempletonChoice@!${isTempletonInstalled}!g\" \
+	-e \"s!@HDPInstallOozieChoice@!${isOozieInstalled}!g\" \
+	-e \"s!@HDPInstallSqoopChoice@!${isSqoopInstalled}!g\" \
+	-e \"s!@HDPNameNodeHostChoice@!${nameNodeHost}!g\" \
+	-e \"s!@HDPSecondaryNameNodeHostChoice@!${secondaryNameNodeHost}!g\" \
+	-e \"s!@HDPJobTrackerHostChoice@!${jobTrackerHost}!g\" \
+	-e \"s!@HDPGangliaCollectorHostChoice@!${gangliaCollectorHost}!g\" \
+	-e \"s!@HDPNagiosServerHostChoice@!${nagiosServerHost}!g\" \
+	-e \"s!@HDPOptionalServicesConfigChoices@!${optionalServicesConfigChoicesXml}!g\" \
+      ${nextJobConfigFile}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# "Pipe" the output of this job into the next one's configuration.
+cmd="curl -H \"Content-Type: text/xml\" -d @${nextJobConfigFile} ${JENKINS_URL}job/${nextJobName}/config.xml";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# XXX TODO Advance the stage disk cookie.

+ 176 - 0
hmc/archive/ShellScripts/dbLib.sh

@@ -0,0 +1,176 @@
+#!/bin/sh
+
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+##################################
+###### INCLUDE REQUIREMENTS ######
+##################################
+#
+# * dbLib.sh
+#
+##################################
+
+PREVIOUS_VERSION_SUFFIX=".prev";
+
+function getClusterDbDir
+{
+  clusterName=${1};
+
+  if [ "x" != "x${clusterName}" ]
+  then
+    echo "${EASYINSTALLER_DB_DIR}/${clusterName}";
+  fi
+}
+
+function initDbForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ]
+  then
+    clusterDbDirVersioned="${clusterDbDir}.`date +%s`";
+
+    # Create the actual new DB directory (versioned with a timestamp).
+    mkdir -p "${clusterDbDirVersioned}";
+
+    if [ -L "${clusterDbDir}" ] 
+    then
+      clusterDbDirPrevious="${clusterDbDir}${PREVIOUS_VERSION_SUFFIX}";
+
+      # There's about to be a new ${clusterDbDirPrevious}, so get the existing
+      # one out of the way.
+      if [ -L "${clusterDbDirPrevious}" ]
+      then
+        rm -f "${clusterDbDirPrevious}";
+      fi
+
+      # Roll the current "current" over...
+      ln -s `readlink -n "${clusterDbDir}"` "${clusterDbDirPrevious}";
+      # ...and make way for the new "current".
+      rm -f "${clusterDbDir}";
+    fi
+
+    # Mark the newly-created version as "current".
+    ln -s ${clusterDbDirVersioned} ${clusterDbDir};
+
+    # And from here on, work with ${clusterDbDir} as if it were the only version in existence.
+    mkdir -p ${clusterDbDir}/conf;
+    mkdir -p ${clusterDbDir}/cookies;
+    mkdir -p ${clusterDbDir}/files;
+  else
+    echo "Can't init DB for empty clusterName"
+    return 1;
+  fi
+}
+
+function storeDbFileForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ] && [ "x" != "x${3}" ]
+  then
+    storedFile="${clusterDbDir}/files/${2}";
+    sourceFile="${3}";
+
+    # Make sure we preserve modes, perms etc.
+    [ -e "${sourceFile}" ] && cp -pf "${sourceFile}" "${storedFile}" && echo "${storedFile}";
+  fi 
+}
+
+function fetchDbFileForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ]
+  then
+    storedFile="${clusterDbDir}/files/${2}";
+
+    [ -e "${storedFile}" ] && echo "${storedFile}";
+  fi 
+}
+
+function storeDbConfForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ] && [ "x" != "x${3}" ]
+  then
+    storedConfFile="${clusterDbDir}/conf/${2}";
+    newConfReplacements="${3}";
+
+    # The first store needs us to copy in the template for ${storedConfFile}.
+    # Subsequent stores will build on this previously-partially-instantiated 
+    # template.
+    if [ ! -e "${storedConfFile}" ]
+    then
+      confTemplateFile="${EASYINSTALLER_CONF_TEMPLATES_DIR}/${2}.in";
+      cp "${confTemplateFile}" "${storedConfFile}";
+    fi
+
+    sedCmd="sed -i.prev";
+
+    # It's crucial that ${newConfReplacements} not be quoted here so it behaves
+    # like a stream with one expression per line.
+    for sedExpression in ${newConfReplacements}
+    do
+      sedCmd="${sedCmd} -e \"${sedExpression}\""; 
+    done
+
+    sedCmd="${sedCmd} ${storedConfFile}";
+
+    echo "${sedCmd}";
+    eval "${sedCmd}";
+  fi
+}
+
+function fetchDbConfForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ]
+  then
+    storedConfFile="${clusterDbDir}/conf/${2}";
+
+    [ -e "${storedConfFile}" ] && echo "${storedConfFile}";
+  fi 
+}
+
+function storeDbCookieForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ] && [ "x" != "x${3}" ]
+  then
+    storedCookieFile="${clusterDbDir}/cookies/${2}";
+
+    echo "${3}" > "${storedCookieFile}";
+  fi 
+}
+
+function fetchDbCookieForCluster
+{
+  clusterDbDir=`getClusterDbDir ${1}`;
+
+  if [ "x" != "x${clusterDbDir}" ] && [ "x" != "x${2}" ]
+  then
+    storedCookieFile="${clusterDbDir}/cookies/${2}";
+
+    [ -e "${storedCookieFile}" ] && getFirstWordFromFile "${storedCookieFile}";
+  fi 
+}

+ 179 - 0
hmc/archive/ShellScripts/deploy.sh

@@ -0,0 +1,179 @@
+#!/bin/sh
+
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+baseDir=`dirname ${0}`;
+
+source ${baseDir}/easyInstallerLib.sh;
+source ${baseDir}/dbLib.sh;
+source ${baseDir}/servicesLib.sh;
+
+###########################
+### FILE-SCOPED GLOBALS ###
+###########################
+
+# TODO XXX Take this in from the UI in the future (and likely store it as a 
+# marker on disk, to really be of any use).
+clusterName="MyHDPCluster";
+
+#############
+### SETUP ###
+#############
+
+# XXX XXX RESUME FROM HERE
+###checkpointedStageNumber=`fetchDbCookieForCluster "${clusterName}" "${CHECKPOINTED_STAGE_NUMBER_COOKIE_NAME}"`;
+###
+###currentStageName="1-HDP-Initialize-Cluster";
+###currentStageNumber=`getStageNumberFromName "${currentStageName}"`;
+###
+###currentStageCanRun=`isStageTransitionAdmissable "${checkpointedStageNumber}" "${currentStageNumber}"`;
+###
+###if [ "${currentStageCanRun}" != "1" ]
+###then
+###  echo "Inadmissable stage transition attempted - bailing out.";
+###  exit 1;
+###fi
+
+# Create our per-build workspace - it's a shame Jenkins doesn't provide this for us.
+perBuildWorkspace=${WORKSPACE}/${BUILD_NUMBER};
+
+cmd="mkdir ${perBuildWorkspace}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+######################
+### PRE-PROCESSING ###
+######################
+
+# Stage gsInstaller.
+
+# 0) Create the staging directory.
+stagingDirectory="${perBuildWorkspace}/gsInstaller";
+
+cmd="mkdir ${stagingDirectory}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# 1) Copy the sources over to ${stagingDirectory}.
+cmd="cp -r ${GSINSTALLER_SCRIPTS_DIR}/* ${stagingDirectory}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# 2) Pull in the customized (till this point in the flow) .properties files.
+for propertiesFile in "${GSINSTALLER_PROPERTIES_CONF_NAME}" "${GSCLUSTER_PROPERTIES_CONF_NAME}"
+do
+  storedPropertiesFile=`fetchDbConfForCluster "${clusterName}" "${propertiesFile}"`;
+
+  cmd="cp -pf ${storedPropertiesFile} ${stagingDirectory}";
+
+  echo "${cmd}";
+  eval "${cmd}";
+done
+ 
+# 3) Pull in all the flat node files.
+for nodeFile in "namenode" "snamenode" "jobtracker" "dashboard" "gangliaserver" "gateway" "hbasemaster" "hbasenodes" "hcatserver" "nagiosserver" "nodes" "oozieserver" "templetonnode" "zknodes"
+do
+  storedNodeFile=`fetchDbFileForCluster "${clusterName}" "${nodeFile}"`;
+
+  cmd="cp -pf ${storedNodeFile} ${stagingDirectory}";
+
+  echo "${cmd}";
+  eval "${cmd}";
+done
+
+# And we're done!
+
+######################
+### THE MAIN EVENT ###
+######################
+
+# XXX TODO Break this into separate commands and work upon the exit code of each.
+jobCmd="cd ${stagingDirectory}; sh createUsers.sh; sh gsPreRequisites.sh; echo y | sh gsInstaller.sh; echo y | sh monInstaller.sh;";
+#jobCmd="cd ${stagingDirectory}; echo *******xxxyyyzzz********;";
+
+echo "${jobCmd}";
+eval "${jobCmd}";
+
+jobExitCode=$?;
+
+#######################
+### POST-PROCESSING ###
+#######################
+
+# Mark the start/stop status of all the installed services on disk.
+
+for serviceName in "HDFS" "MapReduce" "HBase" "HCatalog" "Templeton" "Oozie"
+do
+  serviceIsInstalled=`isServiceInstalledForCluster "${clusterName}" "${serviceName}"`;
+
+  # Generate customized variables, one for each ${serviceName}, for use below.
+  eval "is${serviceName}Installed=${serviceIsInstalled}";
+
+  if [ "xyes" == "x${serviceIsInstalled}" ]
+  then
+    if [ "x0" == "x${jobExitCode}" ]
+    then
+      markServiceAsStartedForCluster "${clusterName}" "${serviceName}";
+    else
+      markServiceAsStoppedForCluster "${clusterName}" "${serviceName}";
+    fi
+  fi
+done
+
+# Update the downstream pages' configurations accordingly.
+
+# Fetch the next page's configuration.
+nextJobName="HDP-Manage-Services";
+nextJobConfigFile="${perBuildWorkspace}/${nextJobName}.config.xml";
+
+cmd="fetchJobConfigTemplate ${nextJobName} ${nextJobConfigFile}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# Modify this fetched config to take into account the output of all the jobs till now.
+
+hdfsStatusChoices=`generateServiceStatusChoicesForCluster "${clusterName}" "HDFS"`;
+mapReduceStatusChoices=`generateServiceStatusChoicesForCluster "${clusterName}" "MapReduce"`;
+
+# Note that the is${serviceName}Installed variables were generated and set in the
+# loop above that invokes markServiceAsStartedForCluster() for each ${serviceName}.
+optionalServicesStatusChoicesXml=`generateOptionalServicesStatusChoicesXmlForCluster \
+  "${clusterName}" \
+  "${isHBaseInstalled}" "${isHCatalogInstalled}" "${isTempletonInstalled}" "${isOozieInstalled}"`;
+
+cmd="sed -i.prev \
+	-e \"s!@HDPHDFSStatusChoices@!${hdfsStatusChoices}!g\" \
+	-e \"s!@HDPMapReduceStatusChoices@!${mapReduceStatusChoices}!g\" \
+	-e \"s!@HDPOptionalServicesStatusChoices@!${optionalServicesStatusChoicesXml}!g\" \
+      ${nextJobConfigFile}";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# "Pipe" the output of this job into the relevant job's configuration.
+cmd="curl -H \"Content-Type: text/xml\" -d @${nextJobConfigFile} ${JENKINS_URL}job/${nextJobName}/config.xml";
+
+echo "${cmd}";
+eval "${cmd}";
+
+# XXX TODO Advance the stage disk cookie.

+ 55 - 0
hmc/archive/ShellScripts/discoverNodes.sh

@@ -0,0 +1,55 @@
+maxNodes=0
+maxNodesFile=$(wc -l $easyInstallInput)
+
+for words in $maxNodesFile
+do
+  maxNodes=$words
+  break
+done
+
+nodes=$(cat $easyInstallInput)
+
+cmd=
+cmdOut=
+maxMem=
+maxCPU=
+node=
+
+execSshCmd() {
+  echo "Executing cmd: "
+  [ "$sshkey" == "" ] && echo "ssh $HDPClusterDeployUser@$node $cmd" && cmdOut=`ssh -o StrictHostKeyChecking=no $HDPClusterDeployUser@$node $cmd`
+  [ "$sshkey" != "" ] && echo "ssh -o StrictHostKeyChecking=no -i $sshkey $HDPClusterDeployUser@$node $cmd" \
+&& cmdOut=`ssh -o StrictHostKeyChecking=no -i $sshkey $HDPClusterDeployUser@$node $cmd` 
+}
+
+echo "SSHKEY is : " $sshkey
+echo "OutputFile: " $easyInstallOut
+
+for node in $nodes
+do
+  echo "Node: $node"
+  cmd='free -mt | tail -1'
+  execSshCmd
+  echo "$node: run free"
+  memFree=`echo $cmdOut | awk '{ print $NF }'`
+
+  cmd='grep -c processor /proc/cpuinfo'
+  execSshCmd
+  echo "$node: find proc count"
+  cpuCount=$cmdOut
+
+  cmd='uname -m'
+  execSshCmd
+  echo "$node: find processor arch"
+  osType=$cmdOut
+
+  cmd='df -klh | grep -v Filesystem'
+  execSshCmd
+  echo "$node: find disks"
+  MountPoints=$cmdOut
+  echo "xxx"
+
+  echo $node $memFree $cpuCount $osType >> $easyInstallOut
+  echo "yyy"
+done
+

+ 105 - 0
hmc/archive/ShellScripts/easyInstallerLib.sh

@@ -0,0 +1,105 @@
+#!/bin/sh
+
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+#################
+### CONSTANTS ###
+#################
+
+# Meant to be used in the future to deal with upgrades and downgrades.
+# XXX Remember to update this with every release of EasyInstaller. 
+HDP_VERSION_STRING="HDP-1.0.4-Preview-6";
+
+# We assume these are created by the RPM.
+EASYINSTALLER_DB_DIR="/var/db/hdp/easyInstaller";
+EASYINSTALLER_CONF_TEMPLATES_DIR="/etc/hdp/easyInstaller/templates";
+EASYINSTALLER_SCRIPTS_DIR="/usr/libexec/hdp/easyInstaller";
+GSINSTALLER_SCRIPTS_DIR="/usr/libexec/hdp/gsInstaller";
+
+GSINSTALLER_PROPERTIES_CONF_NAME="gsInstaller.properties";
+GSCLUSTER_PROPERTIES_CONF_NAME="gsCluster.properties";
+
+INSTALLED_HDP_VERSION_COOKIE_NAME="installedHDPVersion";
+CHECKPOINTED_STAGE_NUMBER_COOKIE_NAME="checkpointedStageNumber";
+
+CLUSTER_DEPLOY_USER_IDENTITY_FILE_NAME="clusterDeployUserIdentity";
+CLUSTER_HOSTS_FILE_NAME="clusterHosts";
+NAMENODE_MOUNT_POINTS_FILE_NAME="NameNodeMountPointsSuggest.out";
+
+# XXX TODO Remove this temporary hack once we figure out why Jenkins is not 
+#          pushing the advertised keys into the environment.
+JENKINS_URL="http://localhost:9040/"
+
+#################
+### FUNCTIONS ###
+#################
+
+function true2yes
+{
+  # Anything other than exactly "true" results in "no".
+  local answer="no";
+
+  if [ "xtrue" == "x${1}" ]
+  then
+    answer="yes";
+  fi
+
+  echo "${answer}";
+}
+
+function fetchJobConfigTemplate
+{
+  local jobName="${1}";
+  local jobConfigTemplateDestinationFile="${2}";
+
+  if [ "x" != "x${jobName}" ] && [ "x" != "x${jobConfigTemplateDestinationFile}" ]
+  then
+    cp -pf "${EASYINSTALLER_CONF_TEMPLATES_DIR}/jobs/${jobName}/config.xml" "${jobConfigTemplateDestinationFile}";
+  else
+    return 1;
+  fi
+}
+
+function getFirstWordFromFile
+{
+  local firstWord="";
+  local absFilePath="${1}";
+
+  if [ "x" != "x${absFilePath}" ] && [ -e "${absFilePath}" ]
+  then
+    firstWord=`head -1 ${absFilePath} | awk '{print $1;}'`;
+  fi
+
+  echo "${firstWord}";
+}
+
+function wrapWithXMLTag
+{
+  local wrappedOutput="";
+
+  local xmlTag="${1}";
+  local wrappedEntity="${2}";
+
+  if [ "x" != "x${xmlTag}" ] && [ "x" != "x${wrappedEntity}" ]
+  then
+    wrappedOutput="<${xmlTag}>${wrappedEntity}</${xmlTag}>";
+  fi
+
+  echo "${wrappedOutput}";
+}

+ 98 - 0
hmc/archive/ShellScripts/generateNodeFiles.sh

@@ -0,0 +1,98 @@
+property=$1
+OutputDir=$2
+
+[ -f $property ] && source $property
+
+`echo $HDPNameNodeHost > $OutputDir/namenode`
+`echo $HDPSecondaryNameNodeHost > $OutputDir/snamenode`
+`echo $HDPJobTrackerHost > $OutputDir/jobtracker`
+`echo $HDPHBaseMasterHost > $OutputDir/hbasemaster`
+`echo $HDPHCatalogServerHost > $OutputDir/hcatserver`
+`echo $HDPGangliaCollectorHost > $OutputDir/gangliaserver`
+`echo $HDPNagiosServerHost > $OutputDir/nagiosserver`
+`echo $HDPOozieServerHost > $OutputDir/oozieserver`
+`echo $HDPTempletonNodeHost > $OutputDir/templetonnode`
+
+## dashboardhost same as nagios.
+`echo $HDPNagiosServerHost > $OutputDir/dashboardhost`
+
+## slaves are present in the file referred by the nodes env variable
+## gateway = any slave.
+`cat $HDPClusterHostsFile | grep -vwE "$HDPNameNodeHost|$HDPSecondaryNameNode|$HDPJobTrackerHost|$HDPHBaseMasterHost|$HDPHCatServerHost|$HDPGangliaCollectorHost|$HDPNagiosServerHost|$HDPOozieServerHost|$HDPTempletonHost" | sort | uniq > $OutputDir/nodes`
+
+maxNodes=
+getLineCountofNodes()
+{
+  lineCount=`wc -l $OutputDir/nodes`
+  for words in $lineCount
+  do
+    maxNodes=$words
+    break
+  done
+}
+
+getLineCountofNodes
+[ $maxNodes == 0 ] `cat $HDPClusterHostsFile > $OutputDir/nodes`
+getLineCountofNodes
+
+linenum=0
+getNodeAtLineNum()
+{
+  linenum=$((linenum+1))  
+  if [ "$linenum" -gt "$maxNodes" ]; then
+    if [ "$maxNodes" -gt 0 ]; then
+      linenum=1
+    else
+      linenum=$maxNodes
+    fi
+  fi
+}
+
+outFile=
+writeNodeToFile()
+{
+  `awk "NR==$linenum{print;exit}" $OutputDir/nodes > $outFile`
+}
+
+appendNodeToFile()
+{
+  `awk "NR==$linenum{print;exit}" $OutputDir/nodes >> $outFile`
+}
+
+## Gateway host out
+outFile=$OutputDir/gateway
+if [ "$gwhost" != "" ]; then
+  `echo $gwhost > $outFile`
+else
+  getNodeAtLineNum
+  writeNodeToFile
+fi
+
+## Zookeeper
+## zknodes = 3 or lesser if lesser slaves.
+outFile=$OutputDir/zknodes
+if [ $maxNodes -gt 3 ]; then
+  getNodeAtLineNum
+  writeNodeToFile
+  getNodeAtLineNum
+  appendNodeToFile
+  getNodeAtLineNum
+  appendNodeToFile
+else
+  `cat $OutputDir/nodes > $outFile`
+fi
+
+
+## HBase slaves are all slave nodes
+`cat $OutputDir/nodes > $OutputDir/hbasenodes`
+
+getNameNodeMountPoint()
+{
+  cmd="df -klh | sed \"1 d\" | grep -vw \"/boot\" | grep -vw \"/dev\/shm\" | grep -vw \"/home\" | grep -vw \/ | awk '{ print \$(NF)}'"
+  [ "$HDPClusterDeployUserIdentityFile" == "" ] && `ssh -o StrictHostKeyChecking=no $HDPClusterDeployUser@$HDPNameNodeHost $cmd > $1`
+  [ "$HDPClusterDeployUserIdentityFile" != "" ] && `ssh -o StrictHostKeyChecking=no -i $HDPClusterDeployUserIdentityFile $HDPClusterDeployUser@$HDPNameNodeHost $cmd > $1`
+}
+
+outfile=$OutputDir/NameNodeMountPointsSuggest.out
+getNameNodeMountPoint $outfile
+

+ 70 - 0
hmc/archive/ShellScripts/pdshDiscoverNodes.sh

@@ -0,0 +1,70 @@
+maxNodes=0
+maxNodesFile=$(wc -l $easyInstallInput)
+
+for words in $maxNodesFile
+do
+  maxNodes=$words
+  break
+done
+
+nodes=$(cat $easyInstallInput)
+
+pdshExists=`which pdsh`
+if [ "x" != "x${pdshExists}" ]; then
+  usePdsh="yes"
+fi
+
+cmd=
+cmdOut=
+maxMem=
+maxCPU=
+node=
+
+execSshCmd() {
+  echo "Executing cmd: "
+  [ "$sshkey" == "" ] && echo "ssh $HDPClusterDeployUser@$node $cmd" && cmdOut=`ssh -o StrictHostKeyChecking=no $HDPClusterDeployUser@$node $cmd`
+  [ "$sshkey" != "" ] && echo "ssh -o StrictHostKeyChecking=no -i $sshkey $HDPClusterDeployUser@$node $cmd" \
+&& cmdOut=`ssh -o StrictHostKeyChecking=no -i $sshkey $HDPClusterDeployUser@$node $cmd` 
+}
+
+echo "SSHKEY is : " $sshkey
+echo "OutputFile: " $easyInstallOut
+
+execPdsh () {
+  commaSepNodes=`commaSeparatedHostList ${nodes}`
+  if [ "$sshkey" == "" ]; then
+    pdsh -R exec -w $commaSepNodes $*
+  fi
+}
+
+if [ $usepdsh == "yes" ]; then
+fi
+
+for node in $nodes
+do
+  echo "Node: $node"
+  cmd='free -mt | tail -1'
+  execSshCmd
+  echo "$node: run free"
+  memFree=`echo $cmdOut | awk '{ print $NF }'`
+
+  cmd='grep -c processor /proc/cpuinfo'
+  execSshCmd
+  echo "$node: find proc count"
+  cpuCount=$cmdOut
+
+  cmd='uname -m'
+  execSshCmd
+  echo "$node: find processor arch"
+  osType=$cmdOut
+
+  cmd='df -klh | grep -v Filesystem'
+  execSshCmd
+  echo "$node: find disks"
+  MountPoints=$cmdOut
+  echo "xxx"
+
+  echo $node $memFree $cpuCount $osType >> $easyInstallOut
+  echo "yyy"
+done
+

+ 227 - 0
hmc/archive/ShellScripts/pdshSuggestMem.sh

@@ -0,0 +1,227 @@
+inputDir=$1
+outputFile=$3
+inputFile=$2
+maxMapsPerNode=4
+maxRedsPerNode=2
+check=$4
+echo XXXX $inputFile XXXX
+echo XXXX $inputDir XXXX
+echo XXXX $outputFile XXXX
+
+source $inputFile
+
+cd $inputDir
+[[ -f "gateway" ]] && gwhost=$(cat gateway)
+[[ -f "namenode" ]] && nnhost=$(cat namenode)
+[[ -f "snamenode" ]] && snhost=$(cat snamenode)
+[[ -f "jobtracker" ]] && jthost=$(cat jobtracker)
+[[ -f "hbasemaster" ]] && hbmhost=$(cat hbasemaster)
+[[ -f "hcatserver" ]] && hcshost=$(cat hcatserver)
+[[ -f "templetonnode" ]] && ttonhosts=$(cat templetonnode)
+[[ -f "oozieserver" ]] && oozieshost=$(cat oozieserver)
+[[ -f "nodes" ]] && slaves=$(cat nodes)
+[[ -f "hbasenodes" ]] && rshosts=$(cat hbasenodes)
+[[ -f "zknodes" ]] && zkhosts=$(cat zknodes)
+[[ -f "gangliaserver" ]] && gangliahost=$(cat gangliaserver)
+[[ -f "nagiosserver" ]] && nagioshost=$(cat nagiosserver)
+
+maxMem=
+heapSizeSuggest=
+ConnectTimeOut=3
+sshCmdOnHost ()
+{
+  local cmd="ssh -o ConnectTimeOut=$ConnectTimeOut -o StrictHostKeyChecking=no -i $HDPClusterDeployUserIdentityFile $HDPClusterDeployUser@$1 \"$2\" > $3"
+  echo $cmd
+  eval $cmd
+}
+
+findMaxMemOnHost ()
+{
+  #  echo "SSHCMD: ssh -i /var/db/hdp/easyInstaller/MyHDPCluster/files/clusterDeployUserIdentity root@$1 \"free -m | sed \\\"1 d\\\" | awk '{print \\\$4}' | sed -n 1p\""
+  sshCmdOnHost $1 "free -m" "${PWD}/tmpMem.out"
+#  ssh -i $HDPClusterDeployUserIdentityFile $HDPClusterDeployUser@$1 "free -m" > tmpMem.out
+  maxMem=`cat $PWD/tmpMem.out | sed "1 d" | awk '{print $4}' | sed -n 1p`
+}
+
+scaleByThreads=2
+scaleRelativeMapsReds=3
+minMapsPerNode=1000
+minRedsPerNode=1000
+findMaxCoresOnHost ()
+{
+  sshCmdOnHost $1 "grep -c processor /proc/cpuinfo" ${PWD}/tmpCpu.out
+  cpuCount=`cat ${PWD}/tmpCpu.out`
+  maxMapsPerNode=`expr $cpuCount \* $scaleByThreads \* 2 / $scaleRelativeMapsReds`
+  maxRedsPerNode=`expr $cpuCount \* $scaleByThreads - $maxMapsPerNode`
+  totalProcessesPerSlave=`expr $maxMapsPerNode + $maxRedsPerNode`
+
+  if [ $maxMapsPerNode -lt 1 ]; then 
+    maxMapsPerNode=1
+  fi
+
+  if [ $maxRedsPerNode -lt 1 ]; then
+    maxRedsPerNode=1
+  fi
+
+  if [ $maxMapsPerNode -lt $minMapsPerNode ]; then
+    minMapsPerNode=$maxMapsPerNode
+  fi
+
+  if [ $maxRedsPerNode -lt $minRedsPerNode ]; then
+    minRedsPerNode=$maxRedsPerNode
+  fi
+  
+  echo CPUCOUNT: $cpuCount
+}
+
+list=
+for slave in $(echo $slaves)
+do
+  findMaxCoresOnHost $slave
+done
+
+maxMapsPerNode=$minMapsPerNode
+maxRedsPerNode=$minRedsPerNode
+
+if [ $check -eq 1 ]; then
+  userInputProperties=$5
+  source $userInputProperties
+fi
+
+#### -2 because -1 for count to go to 0 and -1 for allHosts
+totalProcessesPerSlave=`expr $maxMapsPerNode + $maxRedsPerNode - 2`
+list=$slaves
+while [ $totalProcessesPerSlave -ne 0 ];
+do
+totalProcessesPerSlave=`expr $totalProcessesPerSlave - 1`
+list="$list $slaves"
+done
+
+
+allHosts=`echo $slaves $jthost $nnhost $snhost $gwhost $hbmhost $hcshost $rshosts $zkhosts $nagioshost $gangliahost $list`
+# echo ALLHOSTS: $allHosts
+
+findForNodeType ()
+{
+  echo Hostname: $1
+  hostname=$1
+  echo "grep -o $1 <<< \"$allHosts\" | wc -l"
+  procCount=`grep -o $1 <<< "$allHosts" | wc -l`
+  echo PROCCOUNT: $procCount
+  findMaxMemOnHost $1
+#  findMaxCoresOnHost $1
+  echo MAXMEM: $maxMem
+  heapSizeSuggest=`expr $maxMem / $procCount`
+}
+
+echo NAMENODE $nnhost
+findForNodeType $nnhost
+nameNodeHeapSizeSuggest=$heapSizeSuggest
+echo "HDPNameNodeHeapSize ${heapSizeSuggest}" > $outputFile
+
+echo JOBTRACKER $jthost
+findForNodeType $jthost
+jobTrackerHeapSizeSuggest=$heapSizeSuggest
+echo "HDPJobTrackerHeapSize ${heapSizeSuggest}" >> $outputFile
+
+echo HBASEMASTER $hbmhost
+if [ "x" != "x$hbmhost" ]; then
+  findForNodeType $hbmhost
+  hbmHeapSizeSuggest=$heapSizeSuggest
+  echo "HDPHBaseMasterHeapSize=${heapSizeSuggest}" >> $outputFile
+fi
+
+# for now max value assumed to be 100G 
+minSuggest=100000000000
+for node in $(echo $slaves)
+do
+  findForNodeType $node
+  if [ "$minSuggest" -gt "$heapSizeSuggest" ]; then
+    minSuggest=$heapSizeSuggest
+  fi
+done
+
+echo DATANODE
+dataNodeHeapSizeSuggest=$minSuggest
+echo "HDPDataNodeHeapSize ${minSuggest}" >> $outputFile
+echo HADOOPHEAP
+hadoopHeapSizeSuggest=$minSuggest
+echo "HDPHadoopHeapSize ${minSuggest}" >> $outputFile
+echo CHILDOPTS
+childJavaOptsSize=$minSuggest
+echo "HDPMapRedChildJavaOptsSize ${minSuggest}" >> $outputFile
+
+echo "HDPMapRedMapTasksMax ${maxMapsPerNode}" >> $outputFile
+echo "HDPMapRedReduceTasksMax ${maxRedsPerNode}" >> $outputFile
+
+rm -f $PWD/tmpCpu.out $PWD/tmpMem.out
+
+checkAlpha ()
+{
+  num=$1
+  expr $num + 1 2> /dev/null
+  if [ $? = 0 ]; then
+    echo -n ""
+  else
+    echo "ERROR: Value was non-numeric"
+    exit 1;
+  fi
+
+  if [ $num -lt 0 ]; then
+    echo "ERROR: Invalid value less than 0"
+    exit 1;
+  fi
+}
+
+checkConfig ()
+{
+  echo "Checking Namenode heap size"
+  checkAlpha $nameNodeHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $jobTrackerHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $hbmHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $dataNodeHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $hadoopHeapSizeSuggest
+
+  if [ $HDPNameNodeHeapSize -gt $nameNodeHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Name Node.
+  fi
+
+  if [ $HDPJobTrackerHeapSize -gt $jobTrackerHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for JobTracker.
+  fi
+
+  if [ $HDPHBaseMasterHeapSize -gt $hbmHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for HBase Master.
+  fi
+
+  if [ $HDPDataNodeHeapSize -gt $dataNodeHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Data Node.
+  fi
+
+  ## May not be checked. If the user does not want to use the 
+  ## above conservative method, this can be masked
+  if [ $HDPHadoopHeapSize -gt $hadoopHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Hadoop Heap.
+  fi
+
+#  if [ $HDPMapRedChildJavaOptsSize -gt $childJavaOptsSize ]; then
+#    echo ERROR: Insufficient heap size for Child Java Opts.
+#  fi
+}
+
+if [ $check -eq 1 ]; then
+  checkConfig
+fi

+ 207 - 0
hmc/archive/ShellScripts/servicesLib.sh

@@ -0,0 +1,207 @@
+#!/bin/sh
+
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+##################################
+###### INCLUDE REQUIREMENTS ######
+##################################
+#
+# * easyInstallerLib.sh
+# * dbLib.sh
+#
+##################################
+
+#################
+### FUNCTIONS ###
+#################
+
+function getServiceStatusForCluster
+{
+  local serviceStatus="";
+
+  local clusterName="${1}";
+  local serviceName="${2}";
+
+  if [ "x" != "x${clusterName}" ] && [ "x" != "x${serviceName}" ]
+  then
+    serviceStatus=`fetchDbCookieForCluster "${clusterName}" "${serviceName}"`;
+  fi
+
+  echo "${serviceStatus}";
+}
+
+function isServiceInstalledForCluster
+{
+  local serviceIsInstalled="no";
+
+  local serviceStatus=`getServiceStatusForCluster "$@"`;
+
+  if [ "x" != "x${serviceStatus}" ]
+  then
+    serviceIsInstalled="yes";
+  fi
+
+  echo "${serviceIsInstalled}";
+}
+
+function isServiceStartedForCluster
+{
+  local serviceIsStarted="no";
+
+  local serviceStatus=`getServiceStatusForCluster "$@"`;
+
+  if [ "x1" == "x${serviceStatus}" ]
+  then
+    serviceIsStarted="yes";
+  fi
+
+  echo "${serviceIsStarted}";
+}
+
+function isServiceStoppedForCluster
+{
+  local serviceIsStopped="no";
+
+  local serviceStatus=`getServiceStatusForCluster "$@"`;
+
+  if [ "x0" == "x${serviceStatus}" ]
+  then
+    serviceIsStopped="yes";
+  fi
+
+  echo "${serviceIsStopped}";
+}
+
+function setServiceStatusForCluster
+{
+  local clusterName="${1}";
+  local serviceName="${2}";
+  local serviceStatus="${3}";
+
+  if [ "x" != "x${clusterName}" ] && [ "x" != "x${serviceName}" ] && [ "x" != "x${serviceStatus}" ]
+  then
+    storeDbCookieForCluster "${clusterName}" "${serviceName}" "${serviceStatus}";
+  fi
+}
+
+function markServiceAsStartedForCluster
+{
+  setServiceStatusForCluster "$@" "1";
+}
+
+function markServiceAsStoppedForCluster
+{
+  setServiceStatusForCluster "$@" "0";
+}
+
+function generateServiceStatusChoicesForCluster
+{
+  local serviceStatusChoices="";
+
+  local clusterName="${1}";
+  local serviceName="${2}";
+
+  if [ "x" != "x${clusterName}" ] && [ "x" != "x${serviceName}" ]
+  then
+    local currentStatusChoice="";
+
+    local serviceIsStarted=`isServiceStartedForCluster "${clusterName}" "${serviceName}"`;
+
+    if [ "xyes" == "x${serviceIsStarted}" ]
+    then
+      currentStatusChoice=`wrapWithXMLTag "string" "Started"`;
+    else
+      currentStatusChoice=`wrapWithXMLTag "string" "Stopped"`;
+    fi 
+
+    serviceStatusChoices="${currentStatusChoice}";
+  fi
+
+  echo "${serviceStatusChoices}";
+}
+
+function generateServiceStatusChoicesXmlForCluster
+{
+  local serviceStatusChoicesXml="";
+
+  local clusterName="${1}";
+  local serviceName="${2}";
+
+  if [ "x" != "x${clusterName}" ] && [ "x" != "x${serviceName}" ]
+  then
+    serviceStatusChoices=`generateServiceStatusChoicesForCluster "${clusterName}" "${serviceName}"`;
+
+    serviceStatusChoicesXml="<hudson.model.ChoiceParameterDefinition>\
+<name>HDP${serviceName}Status</name>\
+<description></description>\
+<choices class=\\\"java.util.Arrays\\\$ArrayList\\\">\
+<a class=\\\"string-array\\\">\
+${serviceStatusChoices}\
+</a>\
+</choices>\
+</hudson.model.ChoiceParameterDefinition>";
+  fi
+
+  echo "${serviceStatusChoicesXml}";
+}
+
+function generateOptionalServicesStatusChoicesXmlForCluster
+{
+  local optionalServicesStatusChoicesXml="";
+
+  local clusterName="${1}";
+
+  local isHBaseInstalled="${2}"; 
+  local isHCatalogInstalled="${3}";
+  local isTempletonInstalled="${4}";
+  local isOozieInstalled="${5}";
+
+  if [ "x" != "x${clusterName}" ]
+  then
+    if [ "xyes" == "x${isHBaseInstalled}" ]
+    then
+      hBaseStatusChoicesXml=`generateServiceStatusChoicesXmlForCluster \
+        "${clusterName}" "HBase"`;
+      optionalServicesStatusChoicesXml="${optionalServicesStatusChoicesXml}${hBaseStatusChoicesXml}";
+    fi
+
+    if [ "xyes" == "x${isHCatalogInstalled}" ]
+    then
+      hCatalogStatusChoicesXml=`generateServiceStatusChoicesXmlForCluster \
+        "${clusterName}" "HCatalog"`;
+      optionalServicesStatusChoicesXml="${optionalServicesStatusChoicesXml}${hCatalogStatusChoicesXml}";
+    fi
+
+    if [ "xyes" == "x${isTempletonInstalled}" ]
+    then
+      templetonStatusChoicesXml=`generateServiceStatusChoicesXmlForCluster \
+        "${clusterName}" "Templeton"`;
+      optionalServicesStatusChoicesXml="${optionalServicesStatusChoicesXml}${templetonStatusChoicesXml}";
+    fi
+
+    if [ "xyes" == "x${isOozieInstalled}" ]
+    then
+      oozieStatusChoicesXml=`generateServiceStatusChoicesXmlForCluster \
+        "${clusterName}" "Oozie"`;
+      optionalServicesStatusChoicesXml="${optionalServicesStatusChoicesXml}${oozieStatusChoicesXml}";
+    fi
+  fi
+
+  echo "${optionalServicesStatusChoicesXml}";
+}

+ 227 - 0
hmc/archive/ShellScripts/suggestMemSize.sh

@@ -0,0 +1,227 @@
+inputDir=$1
+outputFile=$3
+inputFile=$2
+maxMapsPerNode=4
+maxRedsPerNode=2
+check=$4
+echo XXXX $inputFile XXXX
+echo XXXX $inputDir XXXX
+echo XXXX $outputFile XXXX
+
+source $inputFile
+
+cd $inputDir
+[[ -f "gateway" ]] && gwhost=$(cat gateway)
+[[ -f "namenode" ]] && nnhost=$(cat namenode)
+[[ -f "snamenode" ]] && snhost=$(cat snamenode)
+[[ -f "jobtracker" ]] && jthost=$(cat jobtracker)
+[[ -f "hbasemaster" ]] && hbmhost=$(cat hbasemaster)
+[[ -f "hcatserver" ]] && hcshost=$(cat hcatserver)
+[[ -f "templetonnode" ]] && ttonhosts=$(cat templetonnode)
+[[ -f "oozieserver" ]] && oozieshost=$(cat oozieserver)
+[[ -f "nodes" ]] && slaves=$(cat nodes)
+[[ -f "hbasenodes" ]] && rshosts=$(cat hbasenodes)
+[[ -f "zknodes" ]] && zkhosts=$(cat zknodes)
+[[ -f "gangliaserver" ]] && gangliahost=$(cat gangliaserver)
+[[ -f "nagiosserver" ]] && nagioshost=$(cat nagiosserver)
+
+maxMem=
+heapSizeSuggest=
+ConnectTimeOut=3
+sshCmdOnHost ()
+{
+  local cmd="ssh -o ConnectTimeOut=$ConnectTimeOut -o StrictHostKeyChecking=no -i $HDPClusterDeployUserIdentityFile $HDPClusterDeployUser@$1 \"$2\" > $3"
+  echo $cmd
+  eval $cmd
+}
+
+findMaxMemOnHost ()
+{
+  #  echo "SSHCMD: ssh -i /var/db/hdp/easyInstaller/MyHDPCluster/files/clusterDeployUserIdentity root@$1 \"free -m | sed \\\"1 d\\\" | awk '{print \\\$4}' | sed -n 1p\""
+  sshCmdOnHost $1 "free -m" "${PWD}/tmpMem.out"
+#  ssh -i $HDPClusterDeployUserIdentityFile $HDPClusterDeployUser@$1 "free -m" > tmpMem.out
+  maxMem=`cat $PWD/tmpMem.out | sed "1 d" | awk '{print $4}' | sed -n 1p`
+}
+
+scaleByThreads=2
+scaleRelativeMapsReds=3
+minMapsPerNode=1000
+minRedsPerNode=1000
+findMaxCoresOnHost ()
+{
+  sshCmdOnHost $1 "grep -c processor /proc/cpuinfo" ${PWD}/tmpCpu.out
+  cpuCount=`cat ${PWD}/tmpCpu.out`
+  maxMapsPerNode=`expr $cpuCount \* $scaleByThreads \* 2 / $scaleRelativeMapsReds`
+  maxRedsPerNode=`expr $cpuCount \* $scaleByThreads - $maxMapsPerNode`
+  totalProcessesPerSlave=`expr $maxMapsPerNode + $maxRedsPerNode`
+
+  if [ $maxMapsPerNode -lt 1 ]; then 
+    maxMapsPerNode=1
+  fi
+
+  if [ $maxRedsPerNode -lt 1 ]; then
+    maxRedsPerNode=1
+  fi
+
+  if [ $maxMapsPerNode -lt $minMapsPerNode ]; then
+    minMapsPerNode=$maxMapsPerNode
+  fi
+
+  if [ $maxRedsPerNode -lt $minRedsPerNode ]; then
+    minRedsPerNode=$maxRedsPerNode
+  fi
+  
+  echo CPUCOUNT: $cpuCount
+}
+
+list=
+for slave in $(echo $slaves)
+do
+  findMaxCoresOnHost $slave
+done
+
+maxMapsPerNode=$minMapsPerNode
+maxRedsPerNode=$minRedsPerNode
+
+if [ $check -eq 1 ]; then
+  userInputProperties=$5
+  source $userInputProperties
+fi
+
+#### -2 because -1 for count to go to 0 and -1 for allHosts
+totalProcessesPerSlave=`expr $maxMapsPerNode + $maxRedsPerNode - 2`
+list=$slaves
+while [ $totalProcessesPerSlave -ne 0 ];
+do
+totalProcessesPerSlave=`expr $totalProcessesPerSlave - 1`
+list="$list $slaves"
+done
+
+
+allHosts=`echo $slaves $jthost $nnhost $snhost $gwhost $hbmhost $hcshost $rshosts $zkhosts $nagioshost $gangliahost $list`
+# echo ALLHOSTS: $allHosts
+
+findForNodeType ()
+{
+  echo Hostname: $1
+  hostname=$1
+  echo "grep -o $1 <<< \"$allHosts\" | wc -l"
+  procCount=`grep -o $1 <<< "$allHosts" | wc -l`
+  echo PROCCOUNT: $procCount
+  findMaxMemOnHost $1
+#  findMaxCoresOnHost $1
+  echo MAXMEM: $maxMem
+  heapSizeSuggest=`expr $maxMem / $procCount`
+}
+
+echo NAMENODE $nnhost
+findForNodeType $nnhost
+nameNodeHeapSizeSuggest=$heapSizeSuggest
+echo "HDPNameNodeHeapSize ${heapSizeSuggest}" > $outputFile
+
+echo JOBTRACKER $jthost
+findForNodeType $jthost
+jobTrackerHeapSizeSuggest=$heapSizeSuggest
+echo "HDPJobTrackerHeapSize ${heapSizeSuggest}" >> $outputFile
+
+echo HBASEMASTER $hbmhost
+if [ "x" != "x$hbmhost" ]; then
+  findForNodeType $hbmhost
+  hbmHeapSizeSuggest=$heapSizeSuggest
+  echo "HDPHBaseMasterHeapSize=${heapSizeSuggest}" >> $outputFile
+fi
+
+# for now max value assumed to be 100G 
+minSuggest=100000000000
+for node in $(echo $slaves)
+do
+  findForNodeType $node
+  if [ "$minSuggest" -gt "$heapSizeSuggest" ]; then
+    minSuggest=$heapSizeSuggest
+  fi
+done
+
+echo DATANODE
+dataNodeHeapSizeSuggest=$minSuggest
+echo "HDPDataNodeHeapSize ${minSuggest}" >> $outputFile
+echo HADOOPHEAP
+hadoopHeapSizeSuggest=$minSuggest
+echo "HDPHadoopHeapSize ${minSuggest}" >> $outputFile
+echo CHILDOPTS
+childJavaOptsSize=$minSuggest
+echo "HDPMapRedChildJavaOptsSize ${minSuggest}" >> $outputFile
+
+echo "HDPMapRedMapTasksMax ${maxMapsPerNode}" >> $outputFile
+echo "HDPMapRedReduceTasksMax ${maxRedsPerNode}" >> $outputFile
+
+rm -f $PWD/tmpCpu.out $PWD/tmpMem.out
+
+checkAlpha ()
+{
+  num=$1
+  expr $num + 1 2> /dev/null
+  if [ $? = 0 ]; then
+    echo -n ""
+  else
+    echo "ERROR: Value was non-numeric"
+    exit 1;
+  fi
+
+  if [ $num -lt 0 ]; then
+    echo "ERROR: Invalid value less than 0"
+    exit 1;
+  fi
+}
+
+checkConfig ()
+{
+  echo "Checking Namenode heap size"
+  checkAlpha $nameNodeHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $jobTrackerHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $hbmHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $dataNodeHeapSizeSuggest
+
+  echo "Checking Namenode heap size"
+  checkAlpha $hadoopHeapSizeSuggest
+
+  if [ $HDPNameNodeHeapSize -gt $nameNodeHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Name Node.
+  fi
+
+  if [ $HDPJobTrackerHeapSize -gt $jobTrackerHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for JobTracker.
+  fi
+
+  if [ $HDPHBaseMasterHeapSize -gt $hbmHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for HBase Master.
+  fi
+
+  if [ $HDPDataNodeHeapSize -gt $dataNodeHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Data Node.
+  fi
+
+  ## May not be checked. If the user does not want to use the 
+  ## above conservative method, this can be masked
+  if [ $HDPHadoopHeapSize -gt $hadoopHeapSizeSuggest ]; then
+    exit 1;
+    echo ERROR: Insufficient heap size for Hadoop Heap.
+  fi
+
+#  if [ $HDPMapRedChildJavaOptsSize -gt $childJavaOptsSize ]; then
+#    echo ERROR: Insufficient heap size for Child Java Opts.
+#  fi
+}
+
+if [ $check -eq 1 ]; then
+  checkConfig
+fi

+ 115 - 0
hmc/archive/ShellScripts/suggestNodes.sh

@@ -0,0 +1,115 @@
+property=$1
+
+[ -f $property ] && source $property
+
+sshkey=$HDPClusterDeployUserIdentityFile
+
+PreConfigOutputDir=$2
+
+easyInstallInput=$HDPClusterHostsFile
+easyInstallOut=$PreConfigOutputDir/HostDiscovery.out
+
+mkdir -p $PreConfigOutputDir
+if [ -f $easyInstallOut ]; then
+  rm -f $easyInstallOut
+fi
+
+cd `dirname ${0}`;
+echo $PWD
+source ./discoverNodes.sh 
+
+##### Find fat nodes from the discovered nodes #####
+##### Parse the output file from the DiscoverNodes.sh output #####
+
+##### For master nodes, we need to choose 64 bit Fat nodes #####
+##### Fat nodes are nodes with the highest memory #####
+`cat $easyInstallOut | grep x86_64 | sort -r -k 2 > $PreConfigOutputDir/temp64.out`
+
+maxNodes=0
+maxNodesFile=$(wc -l $PreConfigOutputDir/temp64.out)
+for words in $maxNodesFile
+do
+  maxNodes=$words
+  break
+done
+
+[ $maxNodes == 0 ] 
+
+linenum=0
+outfile=
+
+getNodeAtLineNum()
+{
+  linenum=$((linenum+1))
+  if [ "$linenum" -gt "$maxNodes" ]; then
+    if [ "$maxNodes" -gt 0 ]; then
+      linenum=1
+    else
+      linenum=$maxNodes
+    fi
+  fi
+}
+
+writeNodeToFile()
+{
+  `awk "NR==$linenum{print;exit}" $PreConfigOutputDir/temp64.out > $outfile`
+}
+
+namenode=
+cmd=
+getNameNodeMountPoint()
+{
+  cmd="df -klh | sed \"1 d\" | grep -vw \"/boot\" | grep -vw \"/dev\/shm\" | grep -vw \"/home\" | grep -vw \/ | awk '{ print \$(NF)}'"
+  [ "$sshkey" == "" ] && `ssh -o StrictHostKeyChecking=no $HDPClusterDeployUser@$node $cmd > $outfile`
+  [ "$sshkey" != "" ] && `ssh -o StrictHostKeyChecking=no -i $sshkey $HDPClusterDeployUser@$node $cmd > $outfile`
+}
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/NameNodeSuggest.out
+writeNodeToFile
+
+namenode=`cat $PreConfigOutputDir/NameNodeSuggest.out | awk '{print $1}'`
+outfile=$PreConfigOutputDir/NameNodeMountPointsSuggest.out
+getNameNodeMountPoint
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/SecondaryNameNodeSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/HBaseMasterSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/JobTrackerSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/GatewaySuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/HCatalogServerSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/GangliaCollectorSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/NagiosServerSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/DashboardSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/OozieServerSuggest.out
+writeNodeToFile
+
+getNodeAtLineNum
+outfile=$PreConfigOutputDir/TempletonNodeSuggest.out
+writeNodeToFile
+
+rm -f $PreConfigOutputDir/temp64.out

+ 55 - 0
hmc/archive/ShellScripts/templates/gsCluster.properties.in

@@ -0,0 +1,55 @@
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+hadoop_heap_size=@HDPHadoopHeapSize@
+
+namenode_javaheap=@HDPNameNodeHeapSize@
+fs_inmemory_size=@HDPFSInMemorySize@
+namenode_opt_newsize=@HDPNameNodeOptNewSize@
+
+datanode_du_reserved=@HDPDataNodeDuReserved@
+dt_heapsize=@HDPDataNodeHeapSize@
+
+jtnode_opt_newsize=@HDPJobTrackerOptNewSize@
+jtnode_opt_maxnewsize=@HDPJobTrackerOptMaxNewSize@
+jt_heapsize=@HDPJobTrackerHeapSize@
+
+mapred_map_tasks_max=@HDPMapRedMapTasksMax@
+mapred_red_tasks_max=@HDPMapRedReduceTasksMax@
+mapred_cluster_map_mem_mb=@HDPMapRedClusterMapMemoryMB@
+mapred_cluster_red_mem_mb=@HDPMapRedClusterReduceMemoryMB@
+mapred_cluster_max_map_mem_mb=@HDPMapRedClusterMaxMapMemoryMB@
+mapred_cluster_max_red_mem_mb=@HDPMapRedClusterMaxReduceMemoryMB@
+mapred_job_map_mem_mb=@HDPMapRedJobMapMemoryMB@
+mapred_job_red_mem_mb=@HDPMapRedJobReduceMemoryMB@
+mapred_child_java_opts_sz=@HDPMapRedChildJavaOptsSize@
+io_sort_mb=@HDPIoSortMB@
+io_sort_spill_percent=@HDPIoSortSpillPercent@
+mapreduce_userlog_retainhours=@HDPMapReduceUserLogRetainHours@
+max_tasks_per_job=@HDPMaxTasksPerJob@
+dfs_datanode_failed_volume_tolerated=@HDPDFSDataNodeFailedVolumeTolerated@
+
+#ENTER VALUES FOR zoo.cfg
+tickTime=2000
+initLimit=10
+syncLimit=5
+clientPort=2181
+
+#HBASE MEMORY SETTINGS
+hbase_master_heapsize=@HDPHBaseMasterHeapSize@
+hbase_regionserver_heapsize=@HDPHBaseRegionServerHeapSize@

+ 206 - 0
hmc/archive/ShellScripts/templates/gsInstaller.properties.in

@@ -0,0 +1,206 @@
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+#========================================================================================================================#
+#======================================== CORE PROPERTIES =====================================#
+#========================================================================================================================#
+
+#============================================================#
+# GENERAL INSTALLER PROPERTIES
+#============================================================#
+#ENTER THE DEPLOY USERNAME FOR TAR INSTALLATION
+deployuser=@HDPDeployUser@
+
+#ENTER THE FULL PATH TO THE INSTALLATION DIRECTORY FOR HDP (For tar installation only)
+installdir=
+
+#ENTER A VALUE FOR 32 BIT javahome AND 64 BIT javahome IF THE NODES HAVE JAVA INSTALLED.
+# ELSE IT WILL BE DEFAULTED TO ${installdir}/jdk1.6.0_26 (for tar install) AND /usr (for rpm install) AND JAVA WILL BE INSTALLED FROM ORACLE SITE
+java32home=
+java64home=
+
+#SUPPORTS ONLY rpm/tar - deb SUPPORT IS WORK IN PROGRESS
+package=rpm
+
+#TAKES yes/no VALUE AND ENABLES SECUIRTY IF SET TO yes. Defaults to no
+# Oozie should be turned off by setting installoozie=no when security=yes
+# Templeton should be turned off by setting installtempleton=no when security=yes
+security=no
+
+#============================================================#
+# HADOOP CONFIGURATION DETAILS
+#============================================================#
+
+#ENTER THE USER THAT HDFS/MAPRED SERVICES SHOULD USE.
+hdfsuser=hdfs
+mapreduser=mapred
+
+#TO ENABLE HBASE APPEND SET enableappend VALUE TO true
+enableappend=true
+
+#TO ENABLE WEBHDFS SET enablewebhdfs TO true
+enablewebhdfs=true
+
+#HADOOP DATA, LOG AND PID DIRECTORIES
+datanode_dir=@HDPDataNodeDataDir@
+namenode_dir=@HDPNameNodeDataDir@
+mapred_dir=@HDPMapReduceLocalDir@
+log_dir=/var/log/hadoop
+pid_dir=/var/run/hadoop
+
+#SCHEDULER TO USE
+taskscheduler="org.apache.hadoop.mapred.CapacityTaskScheduler"
+
+#FULL PATH TO KEYTAB LOCATION FOR HDFS USER - [ REQUIRED WHILE security IS SET TO yes ]
+hdfs_user_keytab="/homes/${hdfsuser}/${hdfsuser}.headless.keytab"
+
+#FULL PATH TO KINIT EXECUTABLE - [ REQUIRED WHILE security IS SET TO yes ]
+kinitpath=/usr/kerberos/bin/kinit
+
+#PATH TO NAMENODE/SNAMENODE/JOBTRACKER/DATANODE/HBASEMASTER/HCATSERVER/TASKTRACKER SERVCE KEYTABS - [ REQUIRED WHILE security IS SET TO yes ]
+keytabdir=/etc/security/keytabs
+
+#KERBEROS REALM FOR SECURED CLUSETR - [ REQUIRED WHILE security IS SET TO yes ]
+realm=EXAMPLE.COM
+
+#SPECIFY FULL PATH TO SSHKEY WHEN PASSWORDLESS REQUIRES A SSHKEY
+sshkey=@HDPSshKey@
+
+#TO ENABLE LZO COMPRESSION
+enablelzo=@HDPEnableLzo@
+
+#TO ENABLE snappy COMPRESSION
+enablesnappy=yes
+
+#============================================================#
+# PIG CONFIGURATION DETAILS
+#============================================================#
+
+#ENTER yes TO INSTALL PIG ; no OTHERWISE ; DEFAULTS TO yes
+installpig=@HDPInstallPig@
+
+#============================================================#
+# HBASE CONFIGURATION DETAILS
+# Hbase requires zookeeper, please enter zookeeper settings
+# defined below.
+#============================================================#
+
+#ENTER yes TO INSTALL HBASE ; no OTHERWISE ; DEFAULTS TO yes
+installhbase=@HDPInstallHBase@
+
+#ENTER THE LOG DIR AND PID DIR LOCATION FOR HBASE
+hbase_log_dir=/var/log/hbase
+hbase_pid_dir=/var/run/hbase
+
+#ENTER THE USER THAT HBASE SERVICES SHOULD USE.
+hbaseuser=hbase
+
+#ENTER true/false TO ENABLE/DISABLE SHORTCIRCUIT READS
+enableshortcircuit=true
+
+#============================================================#
+# ZOOKEEPER CONFIGURATION DETAILS
+# Required by Hbase and Templeton
+#============================================================#
+
+#ENTER THE LOG DIR AND DATA DIR LOCATION FOR ZOOKEEPER
+zk_log_dir=/var/log/zookeeper
+zk_pid_dir=/var/run/zookeeper
+zk_data_dir=@HDPZookeeperDataDir@
+zkuser=zookeeper
+
+#============================================================#
+# HCAT CONFIGURATION DETAILS
+#============================================================#
+
+#ENTER yes TO INSTALL HCAT ; no OTHERWISE ; DEFAULTS TO yes
+installhcat=@HDPInstallHCatalog@
+
+#ENTER THE LOG DIR AND PID DIR LOCATION FOR HCATALOG
+hcat_log_dir=/var/log/hcatalog
+hcat_pid_dir=/var/run/hcatalog
+
+#MYSQL SERVER HOST NAME
+mysqldbhost=@HDPHCatalogMySqlDbHost@
+
+#MYSQL DATABASE NAME, USERNAME AND PASSWORD
+databasename=@HDPHCatalogMySqlDbName@
+mysqldbuser=@HDPHCatalogMySqlDbUser@
+mysqldbpasswd=@HDPHCatalogMySqlDbPassword@
+
+#ENTER THE USER THAT HCAT SERVICE SHOULD USE.
+hcatuser=hcat
+
+#ENTER THE USER WHO SHOULD EXECUTE THE SMOKE TEST
+smoke_test_user="${hdfsuser}"
+#FULL PATH TO KEYTAB LOCATION FOR SMOKE TEST USER - [ REQUIRED WHILE security IS SET TO yes ]
+smoke_test_user_keytab="/homes/${smoke_test_user}/${smoke_test_user}.headless.keytab"
+
+
+#============================================================#
+# TEMPLETON CONFIGURATION DETAILS
+# Requires Hcatalog and Zookeeper installed, please fill
+# appropriate settings.
+#============================================================#
+#ENTER yes TO INSTALL TEMPLETON ; no OTHERWISE ; DEFAULTS TO yes
+installtempleton=@HDPInstallTempleton@
+
+#ENTER THE USER THAT TEMPLETON SERVICE SHOULD USE.
+templetonuser=mapred
+
+#ENTER THE LOG DIR AND PID DIR LOCATION FOR TEMPLETON
+templeton_log_dir=/var/log/templeton
+templeton_pid_dir=/var/run/templeton
+#============================================================#
+# SQOOP CONFIGURATION DETAILS
+#============================================================#
+
+#ENTER yes TO INSTALL SQOOP ; no OTHERWISE ; DEFAULTS TO yes
+installsqoop=@HDPInstallSqoop@
+
+#============================================================#
+# OOZIE CONFIGURATION DETAILS
+#============================================================#
+
+#ENTER yes TO INSTALL OOZIE ; no OTHERWISE ; DEFAULTS TO yes
+installoozie=@HDPInstallOozie@
+
+#ENTER THE LOG DIR, PID DIR and DB DIR LOCATION FOR OOZIE 
+oozie_log_dir=/var/log/oozie
+oozie_pid_dir=/var/run/oozie
+oozie_db_dir=@HDPOozieDbDir@
+
+#ENTER THE USER THAT OOZIE SERVICE SHOULD USE.
+oozieuser=oozie
+
+
+#========================================================================================================================#
+#======================================== UNIVR PROPERTIES =================================#
+#========================================================================================================================#
+
+#============================================================#
+# MONITORING PROPERTIES FOR GANGLIA AND NAGIOS
+#============================================================#
+#TO ENABLE NAGIOS AND GANGLIA INTEGRATION WITH HADOOP
+enablemon=yes
+
+outputlogfile=@HDPGSInstallLogFile@
+
+forceclean=true
+
+statusdumpfile=@HDPGSInstallStatusDumpFile@

+ 40 - 0
hmc/archive/ShellScripts/templates/monInstaller.properties.in

@@ -0,0 +1,40 @@
+#/*
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you under the Apache License, Version 2.0 (the
+# * "License"); you may not use this file except in compliance
+# * with the License.  You may obtain a copy of the License at
+# *
+# *     http://www.apache.org/licenses/LICENSE-2.0
+# *
+# * Unless required by applicable law or agreed to in writing, software
+# * distributed under the License is distributed on an "AS IS" BASIS,
+# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# * See the License for the specific language governing permissions and
+# * limitations under the License.
+# */
+
+#======================================================================#
+# MONITORING CONFIGURATION DETAILS      
+#======================================================================#
+installnagios=yes
+# Note: Some of the nagios alerts checks require snmp
+installsnmp=yes
+installganglia=yes
+installdashboard=yes
+snmpcommunity=hadoop
+# snmp source is used to configure source in snmpd.conf
+# snmpsource is a host or network addresses in CIDR notation 
+# e.g. 192.168.0.0/24 => means all the machines from 192.168.0.0 to
+# 192.168.0.255 are allowed to access data from snmp daemons
+# Note: Make sure Gateway and Nagios Server belong to snmpsource address range
+snmpsource=default
+nagioscontact=monitor\@monitor.com
+nagios_web_login=nagiosadmin
+nagios_web_password=admin
+gmetad_user=nobody
+gmond_user=nobody
+webserver_group=apache
+#======================================================================#

+ 166 - 0
hmc/archive/php/assignHosts.php

@@ -0,0 +1,166 @@
+<?php
+include 'dbLib.php';
+include 'utils.php';
+
+$requestdata = file_get_contents('php://input');
+$obj = json_decode($requestdata, true);
+/*
+$obj = array(
+         "clusterName"=> "MyCluster-12345",
+         "ClusterDeployUser"=> "hortonva",
+         "ClusterDeployUserIdentityFile"=> "va_rsa",
+         "ClusterHostsFile"=> "../hostsFile.txt",
+         "nameNode"=> "hrt12n15",
+         "secondaryNameNode"=> "hrt12n16",
+         "jobTracker"=> "hrt12n17",
+         "hbaseMaster"=> "hrt12n18",
+         "hcatServer"=> "hrt12n19",
+         "gangliaCollector"=> "hrt12n15",
+         "nagiosServer"=> "hrt12n16",
+         "oozieServer"=> "hrt12n17",
+         "templetonNode"=> "hrt12n18",
+         );
+*/
+
+
+$clusterName = $_GET['clusterName'];
+$clusterDir = getClusterDir($clusterName);
+
+/*
+$MapredName = "mapReduce";
+$HDFSName = "hdfs";
+$HBaseName = "hBase";
+$PigName = "pig";
+$HcatName = "hCatalog";
+$TempletonName = "templeton";
+$OozieName = "oozie";
+$SqoopName = "sqoop";
+$GatewayName = "gateway";
+
+
+*/
+
+/////////////// Persist final master-server names ///////////////////////////////
+$serviceMasters = array();
+
+$serviceMasters[$HDFSName] = array(
+          $NameNodeName => $obj["nameNodeHost"],
+          $SecondaryNameNodeName => $obj["secondaryNameNodeHost"]
+  );
+$serviceMasters[$MapredName] = array(
+          $JobTrackerName => $obj["jobTrackerHost"],
+          );
+if(isServiceEnabled($clusterName, $HBaseName)) {
+  $serviceMasters[$HBaseName] = array ( $HBaseMasterName => $obj["hBaseMasterHost"] );
+}
+if(isServiceEnabled($clusterName, $HCatName)) {
+  $serviceMasters[$HCatName] = array ( $HCatServerName => $obj["hCatServerHost"] );
+}
+if(isServiceEnabled($clusterName, $OozieName)) {
+  $serviceMasters[$OozieName] = array ( $OozieServerName => $obj["oozieServerHost"] );
+}
+if(isServiceEnabled($clusterName, $TempletonName)) {
+  $serviceMasters[$TempletonName] = array ( $TempletonNodeName => $obj["templetonNodeHost"] );
+}
+
+storeServiceMasters($clusterName, $serviceMasters);
+/////////////// End of persisting final master-server names /////////////////////
+
+$inputDirForGetMountPointsScript = $clusterDir."/inputDirForGetMountPointsScript/";
+$cmd="rm -rf $inputDirForGetMountPointsScript/*; mkdir -p $inputDirForGetMountPointsScript";
+error_log("Running cmd : $cmd");
+system("rm -rf $inputDirForGetMountPointsScript/*; mkdir -p $inputDirForGetMountPointsScript"); // TODO: Error codes
+$outputDirForGetMountPointsScript = getInstallerInputDir($clusterName);
+
+// Hard code host and identity files for now
+//$obj['ClusterDeployUserIdentityFile']="va_rsa";
+//$obj['ClusterHostsFile']="hostsFile.txt";
+
+// write the input file to the mountPointsScript
+$fp = fopen($inputDirForGetMountPointsScript."data.txt", 'w');
+//TODO: FIXME hardcoded. Need to persist and recover.
+//fwrite($fp, 'HDPClusterDeployUser='.$obj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUser='.getClusterDeployUser($clusterName)."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.getSshKeyFilePath($clusterName)."\n");
+fwrite($fp, 'HDPClusterHostsFile='.getHostsFilePath($clusterName)."\n");
+fwrite($fp, 'HDPNameNodeHost='.$obj['nameNodeHost']."\n");
+fwrite($fp, 'HDPSecondaryNameNodeHost='.$obj['secondaryNameNodeHost']."\n");
+fwrite($fp, 'HDPJobTrackerHost='.$obj['jobTrackerHost']."\n");
+fwrite($fp, 'HDPGangliaCollectorHost='.$obj['gangliaCollectorHost']."\n");
+fwrite($fp, 'HDPNagiosServerHost='.$obj['nagiosServerHost']."\n");
+if(isServiceEnabled($clusterName, $HBaseName)) {
+  fwrite($fp, 'HDPHBaseMasterHost='.$obj['hBaseMasterHost']."\n");
+}
+if(isServiceEnabled($clusterName, $HCatName)) {
+  fwrite($fp, 'HDPHCatalogServerHost='.$obj['hCatServerHost']."\n");
+}
+if(isServiceEnabled($clusterName, $OozieName)) {
+  fwrite($fp, 'HDPOozieServerHost='.$obj['oozieServerHost']."\n");
+}
+if(isServiceEnabled($clusterName, $TempletonName)) {
+  fwrite($fp, 'HDPTempletonNodeHost='.$obj['templetonNodeHost']."\n");
+}
+fclose($fp);
+
+$cmd = "/var/www/html/KickAssHDPUI/archive/ShellScripts/generateNodeFiles.sh ".$inputDirForGetMountPointsScript."data.txt ".$outputDirForGetMountPointsScript;
+error_log("Running cmd: $cmd");
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+//print $cmd;
+//echo "'$handle'; " . gettype($handle) . "\n";
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+}
+pclose($handle);
+
+$AllMountPoints = ReadNthWordsOfAllLinesFromFile($outputDirForGetMountPointsScript."/NameNodeMountPointsSuggest.out", 1);
+
+/*
+function generateDirs($allMountPts, $suffix) {
+  $result = "";
+  $first = true;
+  foreach ($allMountPts as $mountPt) {
+    if($first) {
+      $first = false;
+    } else {
+      $result = ",".$result;
+    }
+    $result = $result.$mountPt."/".$suffix;
+  }
+  return $result;
+}
+
+function generateSingleDir($allMountPts, $suffix) {
+  $result="";
+  foreach ($allMountPts as $mountPt) {
+    $result = $result.$mountPt."/".$suffix;
+    return $result;
+  }
+}
+*/
+
+$outjson = array(
+            "clusterName" => $clusterName,
+            "mountPoints" => $AllMountPoints,
+            "servicesInfo" => array (
+                                array( "keyName" => "nameNodeDataDir", "displayName" => "NameNode Data Directories", "maxDirectoriesNeeded" => -1, "suffix" => "hadoop/hdfs/namenode"),
+                                array( "keyName" => "dataNodeDataDir", "displayName" => "DataNode Data Directories", "maxDirectoriesNeeded" => -1, "suffix" => "hadoop/hdfs/data"),
+                                array( "keyName" => "mapReduceLocalDir", "displayName" => "MapReduce Data Directories", "maxDirectoriesNeeded" => -1, "suffix" => "hadoop/mapred"),
+                                array( "keyName" => "oozieDbDir", "displayName" => "Oozie DB Directory", "maxDirectoriesNeeded" => 1, "suffix" => "hadoop/oozie"),
+                                array( "keyName" => "zooKeeperDataDir", "displayName" => "ZooKeeper Data Directory", "maxDirectoriesNeeded" => 1 , "suffix" => "hadoop/zookeeper"),
+                                )
+            );
+/*            "nameNodeDataDir"=> generateDirs($AllMountPoints, "hadoop/hdfs/namenode"),
+            "dataNodeDataDir"=> generateDirs($AllMountPoints, "hadoop/hdfs/data"),
+            "mapreduceDataDir"=> generateDirs($AllMountPoints, "hadoop/mapred"),
+            "oozieDbDir"=> generateSingleDir($AllMountPoints, "hadoop/oozie"),
+            "zookeeperDataDir"=> generateSingleDir($AllMountPoints, "hadoop/zookeeper"),
+           );
+            */
+
+header("Content-type: application/json");
+print (json_encode($outjson));
+//var_dump($AllHosts);
+//print "hello";
+//var_dump(json_encode($outjson));
+?>

+ 163 - 0
hmc/archive/php/configureCluster.php

@@ -0,0 +1,163 @@
+<?php
+
+include 'dbLib.php';
+include 'utils.php';
+
+$requestdata = file_get_contents('php://input');
+$obj = json_decode($requestdata, true);
+
+/*
+$obj = array(
+         "clusterName"=> "MyCluster-12345",
+         "ClusterDeployUser"=> "hortonva",
+         "ClusterDeployUserIdentityFile"=> "va_rsa",
+         "ClusterHostsFile"=> "../hostsFile.txt",
+         "nameNode"=> "hrt12n15",
+         "secondaryNameNode"=> "hrt12n16",
+         "jobTracker"=> "hrt12n17",
+         "hbaseMaster"=> "hrt12n18",
+         "hcatServer"=> "hrt12n19",
+         "gangliaCollector"=> "hrt12n15",
+         "nagiosServer"=> "hrt12n16",
+         "oozieServer"=> "hrt12n17",
+         "templetonNode"=> "hrt12n18",
+         "mountPoints" => array ( "/grid/0", "/grid/1" );
+         );
+*/
+
+$clusterName = $_GET['clusterName'];
+$clusterDir = getClusterDir($clusterName);
+$installerInputDir = getInstallerInputDir($clusterName);
+
+// persist mount points 
+storeConfiguredDirectories($clusterName, $obj);
+
+$json_Output = array(
+  "clusterName" => $clusterName,
+  "services" => array (
+    "$MapredName" => array (
+      "enabled" => isServiceEnabled($clusterName, $MapredName),
+      "properties" => array (
+      "jobTrackerHeapSize" => array(
+        "type" => "text",
+        "displayName" => "JobTracker heap size",
+        "value" => "",
+      ),
+      "childJavaOptions" => array(
+        "type" => "text",
+        "displayName" => "Child Java options for MR tasks",
+        "value" => "",
+      ),
+      "maxMapsPerNode" => array(
+        "type" => "text",
+        "displayName" => "Maximum number of maps per node",
+        "value" => "",
+      ),
+      "maxRedsPerNode" => array(
+        "type" =>"text",
+        "displayName" => "Maximum number of reducers per node",
+        "value" => "",
+      ),
+      ),
+    ),
+    "$HDFSName" => array (
+      "enabled" => isServiceEnabled($clusterName, $HDFSName),
+      "properties" => array (
+      "nameNodeHeapSize" => array(
+        "type" => "text",
+        "displayName" => "Maximum heap size for NameNode",
+        "value" => "",
+      ),
+      "dataNodeHeapSize" => array(
+        "type" => "text",
+        "displayName" => "Maximum heap size for DataNodes",
+        "value" => "",
+      ),
+      ),
+    ),
+    "$PigName" => array (
+      "enabled" => isServiceEnabled($clusterName, $PigName),
+      "properties" => array (
+      ),
+    ),
+    "$HBaseName" => array (
+      "enabled" => isServiceEnabled($clusterName, $HBaseName),
+      "properties" => array (
+      ),
+    ),
+    "$OozieName" => array (
+      "enabled" => isServiceEnabled($clusterName, $OozieName),
+      "properties" => array (
+      ),
+    ),
+    "$HCatName" => array (
+      "enabled" => isServiceEnabled($clusterName, $HCatName),
+      "properties" => array (
+        "mysqlHost" => array (
+          "type" => "text",
+          "displayName" => "MySql host",
+          "value" => "",
+        ),
+
+        "mysqlDB" => array (
+          "type" => "text",
+          "displayName" => "MySql DBRoot",
+          "value" => "",
+        ),
+        "mysqlUser" => array (
+          "type" => "text",
+          "displayName" => "MySql DBUser",
+          "value" => "",
+        ),
+        "mysqlPasswd" => array (
+          "type" => "password",
+          "displayName" => "MySql Passwd",
+          "value" => "",
+        ),
+      ),
+    ),
+    "$TempletonName" => array (
+      "enabled" => isServiceEnabled($clusterName, $TempletonName),
+      "properties" => array (
+      ),
+    ),
+    "$SqoopName" => array (
+      "enabled" => isServiceEnabled($clusterName, $SqoopName),
+      "properties" => array (
+      ),
+    ),
+    "$GatewayName" => array (
+      "enabled" => isServiceEnabled($clusterName, $GatewayName),
+      "properties" => array (
+      ),
+    ),
+    "$ZooKeeperName" => array (
+      "enabled" => isServiceEnabled($clusterName, $ZooKeeperName),
+      "properties" => array (
+      ),
+    ),
+    "$MiscName" => array (
+      "enabled" => true,
+      "properties" => array (
+        "enableLZO" => array (
+          "type" => "checkbox",
+          "displayName" => "Enable LZO",
+          "value" => false,
+        ),
+      ),
+    ),
+    "$GangliaCollectorName" => array (
+      "enabled" => isServiceEnabled($clusterName, $GangliaCollectorName),
+      "properties" => array (
+      ),
+    ),
+    "$NagiosName" => array (
+      "enabled" => isServiceEnabled($clusterName, $NagiosName),
+      "properties" => array (
+      ),
+    ),
+  ),
+);
+print(json_encode($json_Output));
+
+?>

+ 35 - 0
hmc/archive/php/createCluster.php

@@ -0,0 +1,35 @@
+<?php
+include 'dbLib.php';
+
+/*
+function initCluster($clusterName) {
+  $clusterDir = getClusterDir($clusterName);
+  // TODO: FIXME: All die calls below
+  if (!is_dir($clusterDir) && !mkdir($clusterDir, 0700, true)) {
+        die('Failed to create directory...');
+  }
+  $dbDir = getClusterDBDir($clusterName);
+  if (!is_dir($dbDir) && !mkdir($dbDir, 0700, true)) {
+        die('Failed to create db-directory...');
+  }
+  $installerInputDir = getInstallerInputDir($clusterName);
+  if (!is_dir($installerInputDir) && !mkdir($installerInputDir, 0700, true)) {
+        die('Failed to create installer directory...');
+  }
+}
+*/
+
+// Read from the input
+$requestdata = file_get_contents('php://input');
+//error_log($requestdata, 3, "/tmp/rez.log");
+$requestObj = json_decode($requestdata, true);
+
+$clusterName = $requestObj["clusterName"];
+// Validate clusterName: TODO; FIXME
+initCluster($clusterName);
+
+$output = array( "clusterName" => $clusterName );
+
+header("Content-type: application/json");
+print (json_encode($output));
+?>

+ 335 - 0
hmc/archive/php/dbLib.php

@@ -0,0 +1,335 @@
+<?php
+
+// Valid constant names
+$rootDir = "/var/run/HMCDir/";
+$allClustersDir = $rootDir."clusters/";
+
+$SshKeyFileName = "user-ssh-key";
+$HostsFileName = "hosts.txt";
+
+$MapredName = "mapReduce";
+$HDFSName = "hdfs";
+$HBaseName = "hBase";
+$PigName = "pig";
+$HCatName = "hCatalog";
+$TempletonName = "templeton";
+$OozieName = "oozie";
+$ZooKeeperName = "zookeeper";
+$SqoopName = "sqoop";
+$GatewayName = "gateway";
+$MiscName = "miscellaneous";
+$GangliaCollectorName = "gangliaCollector";
+$NagiosName = "nagios";
+
+$JobTrackerName = "jobTracker";
+$NameNodeName = "nameNode";
+$SecondaryNameNodeName = "secondaryNameNode";
+$HBaseMasterName = "hBaseMaster";
+$OozieServerName = "oozieServer";
+$HCatServerName = "hCatServer";
+$MySqlServerName = "mySqlServer";
+$TempletonNodeName = "templetonNode";
+$NagiosServerName = "nagiosServer";
+
+function getAllClustersDir(){
+  global $allClustersDir;
+  return $allClustersDir;
+}
+
+function getClusterDir($clusterId) {
+  if (!isset($clusterId) || $clusterId == "") {
+    error_log("**** Got invalid clusterId **** ");
+    error_log(print_r(debug_backtrace(), true));
+  }
+  global $allClustersDir;
+  return $allClustersDir.$clusterId."/";
+}
+
+function getSshKeyFilePath($clusterId) {
+  global $SshKeyFileName;
+  $clusterDir = getClusterDir($clusterId);
+  return $clusterDir.$SshKeyFileName;
+}
+
+function getHostsFilePath($clusterId) {
+  global $HostsFileName;
+  $clusterDir = getClusterDir($clusterId);
+  return $clusterDir.$HostsFileName;
+}
+
+// TODO: FIX: Create a separate installer php page.
+function getInstallerInputDir($clusterId) {
+  $clusterDir = getClusterDir($clusterId);
+  return $clusterDir."/installer-input/";
+}
+
+// Till we have a db, we use filebased db
+function getDBDir() {
+  global $rootDir;
+  return $rootDir."my-db/";
+}
+
+function getClusterDBDir($clusterId) {
+  $dbdir = getDBDir().$clusterId."/";
+  return $dbdir;
+}
+
+/* Moved to createCluster.php. Not needed anymore
+function initCluster($clusterId) {
+  $clusterDir = getClusterDir($clusterId);
+  // TODO: FIXME: All die calls below
+  if (!is_dir($clusterDir) && !mkdir($clusterDir, 0700, true)) {
+        die('Failed to create directory...');
+  }
+  $dbDir = getClusterDBDir($clusterId);
+  if (!is_dir($dbDir) && !mkdir($dbDir, 0700, true)) {
+        die('Failed to create db-directory...');
+  }
+  $installerInputDir = getInstallerInputDir($clusterId);
+  if (!is_dir($installerInputDir) && !mkdir($installerInputDir, 0700, true)) {
+        die('Failed to create installer directory...');
+  }
+}
+*/
+
+/*
+function storeSelectedServiceNames($servicesArray) {
+  $dbDir = getDBDir();
+  foreach ($servicesArray as $service) {
+    touch($dbDir."SERVICE-".$service); // TODO: FIX: error code
+  }
+}
+*/
+
+function getClusterDeployUser($clusterId) {
+  $cluster_info = getPersistedClusterInfo($clusterId);
+  return $cluster_info["installInfo"]["deployUser"];
+}
+
+function storeServiceMasters($clusterId, $serviceMasters) {
+  $cluster_info = getPersistedClusterInfo($clusterId);
+  foreach ($serviceMasters as $svc=>$arr) {
+    foreach ($arr as $role=>$host) {
+      $cluster_info["services"][$svc]["masters"][$role]["hostName"] = $host;
+    }
+  }
+  persistClusterInfo($clusterId, $cluster_info);
+}
+
+function isServiceEnabled($clusterId, $serviceName) {
+  // $dbDir = getDBDir();
+  // return file_exists($dbDir."SERVICE-".$serviceName);
+  $info = getPersistedClusterInfo($clusterId);
+  if (!$info) { return false; }
+
+  if (isset($info["services"][$serviceName])
+      && isset($info["services"][$serviceName]["enabled"])
+      && $info["services"][$serviceName]["enabled"] == true) {
+    return true;
+  }
+  return false;
+}
+
+function storeOptions($clusterId, $optionsFromUser) {
+  $cluster_info = getPersistedClusterInfo($clusterId);
+  $services = $cluster_info["services"];
+
+  // Loop through the options and save them
+  error_log(json_encode($optionsFromUser), 0);
+  foreach ($optionsFromUser as $serviceName => $propertiesList) {
+    $serviceProperties = $services[$serviceName]["properties"];
+    //error_log($serviceName, 0);
+    //error_log(json_encode($propertiesList["properties"]), 0);
+    foreach($propertiesList["properties"] as $singlePropKey => $singlePropObj) {
+      $serviceProperties[$singlePropKey] = $singlePropObj;
+    }
+    //$serviceProperties = array_merge($serviceProperties, $propertiesList["properties"]);
+
+    // Persist back
+    $services[$serviceName]["properties"] = $serviceProperties;
+  }
+
+  // Store the final data back again
+  $cluster_info["services"] = $services;
+  persistClusterInfo($clusterId, $cluster_info);
+}
+
+function storeConfiguredDirectories($clusterId, $mountInfo) {
+
+  $cluster_info = getPersistedClusterInfo($clusterId);
+  $services = $cluster_info["services"];
+
+  // Store the list of all mount-points
+  $cluster_info["sysInfo"]["mountPoints"] = $mountInfo["mountPoints"];
+
+  // MapReduce properties
+  $mapRedServiceProperties = $services[$GLOBALS['MapredName']]["properties"];
+  $mapRedServiceProperties["mapReduceLocalDir"] = array( "displayName" => "MapReduce local directories", "value" => $mountInfo["clusterConfig"]["mapReduceLocalDir"]);
+  $services[$GLOBALS['MapredName']]["properties"] = $mapRedServiceProperties;
+
+  // HDFS properteis
+  $hdfsProperties = $services[$GLOBALS['HDFSName']]["properties"];
+  $hdfsProperties["nameNodeDataDir"] = array( "displayName" => "NameNode meta-data directories", "value" =>$mountInfo["clusterConfig"]["nameNodeDataDir"]);
+  $hdfsProperties["dataNodeDataDir"] = array( "displayName" => "DataNode data directories", "value" => $mountInfo["clusterConfig"]["dataNodeDataDir"]);
+  $services[$GLOBALS['HDFSName']]["properties"] = $hdfsProperties;
+
+  // Oozie properties
+  $oozieProperties = $services[$GLOBALS['OozieName']]["properties"];
+  $oozieProperties["oozieDbDir"] = array( "displayName" => "Oozie database directory", "value" => $mountInfo["clusterConfig"]["oozieDbDir"]);
+  $services[$GLOBALS['OozieName']]["properties"] = $oozieProperties;
+
+  // Zookeeper properties
+  $zooKeeperProperties = $services[$GLOBALS['ZooKeeperName']]["properties"];
+  $zooKeeperProperties["zooKeeperDir"] = array( "displayName" => "ZooKeeper data directory", "value" => $mountInfo["clusterConfig"]["zooKeeperDataDir"]);
+  $services[$GLOBALS['ZooKeeperName']]["properties"] = $zooKeeperProperties;
+
+  // Store the final data
+  $cluster_info["services"] = $services;
+  persistClusterInfo($clusterId, $cluster_info);
+}
+
+function storeMemoryOptionSuggestions($clusterId, $memoryOptionsSuggestions) {
+
+  $cluster_info = getPersistedClusterInfo($clusterId);
+  $services = $cluster_info["services"];
+
+  // MapReduce properties
+  $mapRedServiceProperties = $services[$GLOBALS['MapredName']]["properties"];
+  $mapRedServiceProperties["JobTrackerHeapSize"] = array( "displayName" => "Maximium Heap size for JobTracker", "value" => $memoryOptionsSuggestions["HDPJobTrackerHeapSize"]);
+  $mapRedServiceProperties["ChildJavaOptsSize"]= array( "displayName" => "Child Java options for MR tasks", "value" => $memoryOptionsSuggestions["HDPMapRedChildJavaOptsSize"]);
+  $mapRedServiceProperties["MapTasksMax"] = array( "displayName" => "Maximum number of maps per node", "value" => $memoryOptionsSuggestions["HDPMapRedMapTasksMax"]);
+  $mapRedServiceProperties["ReduceTasksMax"] = array( "displayName" => "Maximum number of reduces per node", "value" => $memoryOptionsSuggestions["HDPMapRedReduceTasksMax"]);
+  $services[$GLOBALS['MapredName']]["properties"] = $mapRedServiceProperties;
+
+  // HDFS properteis
+  $hdfsProperties = $services[$GLOBALS['HDFSName']]["properties"];
+  $hdfsProperties["NameNodeHeapSize"] = array( "displayName" => "Maximum heap size for NameNode", "value" => $memoryOptionsSuggestions["HDPNameNodeHeapSize"]);
+  $hdfsProperties["DataNodeHeapSize"] = array( "displayName" => "Maximum heap size for DataNodes", "value" => $memoryOptionsSuggestions["HDPDataNodeHeapSize"]);
+  $services[$GLOBALS['HDFSName']]["properties"] = $hdfsProperties;
+
+  // Store the final data
+  $cluster_info["services"] = $services;
+  error_log("STORE MEM OPTIONS");
+  error_log(print_r($cluster_info, true));
+  persistClusterInfo($clusterId, $cluster_info);
+}
+
+function persistClusterInfo($clusterId, $info) {
+  $filename = "ClusterInfo.out";
+  $GLOBALS["CLUSTER_INFO"][$clusterId]["info"] = $info;
+  persistData($clusterId, $filename, $info);
+}
+
+
+function getPersistedClusterInfo($clusterId) {
+  if (isset($GLOBALS["CLUSTER_INFO"][$clusterId]["info"])) {
+    return $GLOBALS["CLUSTER_INFO"][$clusterId]["info"];
+  }
+
+  $filename = "ClusterInfo.out";
+  $data = getPersistedData($clusterId, $filename);
+  $GLOBALS["CLUSTER_INFO"][$clusterId]["info"] = $data;
+  return $data;
+}
+
+/*
+ * filename to persist in
+ * data mixed array which will be stored as serialized json
+ */
+function persistData($clusterId, $filename, $data) {
+  $filepath = getClusterDBDir($clusterId).$filename;
+  $json_data = json_encode($data);
+  if (!file_put_contents($filepath, $json_data)) {
+    die("Failed to persist data to $filename");
+  } 
+}
+
+function getPersistedData($clusterId, $filename) {
+  $filepath = getClusterDBDir($clusterId).$filename; 
+  $data = file_get_contents($filepath);
+  if ($data != FALSE && isset($data) && $data != "") {
+    return json_decode($data, true);
+  }
+  error_log("Could not retrieve any data from $filepath");
+  return NULL;
+}
+
+function setInstallStarted($clusterId) {
+  $clusterInfo = getPersistedClusterInfo($clusterId);
+  $clusterInfo["install"] = array();
+  $clusterInfo["install"]["started"] = true;
+  persistClusterInfo($clusterId, $clusterInfo);
+
+  global $CLUSTER_STATUS_INSTALL_IN_PROGRESS;
+  setClusterStatus($clusterId, $CLUSTER_STATUS_INSTALL_IN_PROGRESS);
+}
+
+function hasInstallStarted($clusterId) {
+  $clusterInfo = getPersistedClusterInfo($clusterId);
+
+  if (isset( $clusterInfo["install"]["started"])
+      &&  $clusterInfo["install"]["started"] == true) {
+    return TRUE;
+  }
+  return FALSE;
+}
+
+$CLUSTER_STATUS_CONFIG_IN_PROGRESS = "CONFIG IN PROGRESS";
+$CLUSTER_STATUS_INSTALL_IN_PROGRESS = "INSTALL IN PROGRESS";
+$CLUSTER_STATUS_INSTALL_DONE = "INSTALL DONE";
+$CLUSTER_STATUS_UNINSTALL_IN_PROGRESS = "UNINSTALL IN PROGRESS";
+$CLUSTER_STATUS_INSTALL_SUCCESSFUL = "SUCCESSFUL INSTALL";
+$CLUSTER_STATUS_INSTALL_UNSUCCESSFUL = "UNSUCCESSFUL INSTALL";
+$CLUSTER_STATUS_DOES_NOT_EXIST = "DOES NOT EXIST";
+
+function setClusterStatus($clusterId, $status) {
+  global $CLUSTER_STATUS_CONFIG_IN_PROGRESS;
+  global $CLUSTER_STATUS_INSTALL_IN_PROGRESS;
+  global $CLUSTER_STATUS_INSTALL_DONE;
+  global $CLUSTER_STATUS_UNINSTALL_IN_PROGRESS;
+  global $CLUSTER_STATUS_INSTALL_SUCCESSFUL;
+  global $CLUSTER_STATUS_INSTALL_UNSUCCESSFUL;
+  if ($status != $CLUSTER_STATUS_CONFIG_IN_PROGRESS
+      && $status != $CLUSTER_STATUS_INSTALL_IN_PROGRESS
+      && $status != $CLUSTER_STATUS_INSTALL_DONE
+      && $status != $CLUSTER_STATUS_UNINSTALL_IN_PROGRESS
+      && $status != $CLUSTER_STATUS_INSTALL_SUCCESSFUL
+      && $status != $CLUSTER_STATUS_INSTALL_UNSUCCESSFUL) {
+    die ("Invalid status : $status");
+  }
+  $clusterInfo = getPersistedClusterInfo($clusterId);
+  if (!isset($clusterInfo["clusterStatus"])) {
+    $clusterInfo["clusterStatus"] = array();
+  }
+  $clusterInfo["clusterStatus"]["status"] = $status;
+  persistClusterInfo($clusterId, $clusterInfo);
+} 
+
+function getClusterStatus($clusterId) {
+  global $CLUSTER_STATUS_DOES_NOT_EXIST;
+  $clusterInfo = getPersistedClusterInfo($clusterId);
+  if (NULL == $clusterInfo || !isset($clusterInfo["clusterStatus"]["status"])) {
+    return $CLUSTER_STATUS_DOES_NOT_EXIST;
+  }
+  return $clusterInfo["clusterStatus"]["status"];
+}
+
+function initCluster($clusterId) {
+  $clusterDir = getClusterDir($clusterId);
+  // TODO: FIXME: All die calls below
+  if (!is_dir($clusterDir) && !mkdir($clusterDir, 0700, true)) {
+        die('Failed to create directory...');
+  }
+  $dbDir = getClusterDBDir($clusterId);
+  if (!is_dir($dbDir) && !mkdir($dbDir, 0700, true)) {
+        die('Failed to create db-directory...');
+  }
+  $installerInputDir = getInstallerInputDir($clusterId);
+  if (!is_dir($installerInputDir) && !mkdir($installerInputDir, 0700, true)) {
+        die('Failed to create installer directory...');
+  }
+}
+
+
+
+?>

+ 130 - 0
hmc/archive/php/deploy.php

@@ -0,0 +1,130 @@
+<?php
+include 'dbLib.php';
+include 'utils.php';
+include 'gsInstallerUtils.php';
+
+$clusterName = $_GET['clusterName'];
+// $clusterName = "MyCluster-12345";
+// Validate clusterName: TODO; FIXME
+//$clusterDir = getClusterDir($clusterName);
+$clusterInfo = getPersistedClusterInfo($clusterName);
+
+/*
+function generateDirs($allMountPts, $suffix) {
+  $result = "";
+  $first = true;
+  foreach ($allMountPts as $mountPt) {
+    if($first) {
+      $first = false;
+    } else {
+      $result = $result.",";
+    }
+    $result = $result.$mountPt."/".$suffix;
+  }
+  return $result;
+}
+*/
+
+//////////////////////////////// Write out the gsInstaller.properties file
+// Read the template into memory
+$templatedData = file_get_contents('/var/www/html/KickAssHDPUI/archive/ShellScripts/templates/gsInstaller.properties.in');
+// Templated variables
+$allMountPoints = $clusterInfo["sysInfo"]["mountPoints"];
+$services = $clusterInfo["services"];
+$mySqlBase = $services[$HCatName]["properties"];
+// TODO: Declare the dirs suffixes as constants
+$replacements = array(
+                     #"@HDPDeployUser@" => $clusterInfo["installInfo"]["deployUser"],
+                     "@HDPDeployUser@" => "root",
+                     "@HDPSshKey@" => getClusterDir($clusterName)."/"."user-ssh-key", // TODO: Make the name constant
+                     "@HDPEnableLzo@" => ( $services[$MiscName]["properties"]["enableLZO"]["value"] ? "yes" : "no" ),
+                     "@HDPInstallPig@" => ( $services[$PigName]["enabled"] ? "yes" : "no" ),
+                     "@HDPInstallHBase@" => ( $services[$HBaseName]["enabled"] ? "yes" : "no" ),
+                     "@HDPInstallHCatalog@" => ( $services[$HCatName]["enabled"] ? "yes" : "no" ), 
+                     "@HDPInstallTempleton@" => ( $services[$TempletonName]["enabled"] ? "yes" : "no" ),
+                     "@HDPInstallSqoop@" => ( $services[$SqoopName]["enabled"] ? "yes" : "no" ),
+                     "@HDPInstallOozie@" => ( $services[$OozieName]["enabled"] ? "yes" : "no" ), 
+                     "@HDPDataNodeDataDir@" => $services[$HDFSName]["properties"]["dataNodeDataDir"]["value"],
+                     "@HDPNameNodeDataDir@" => $services[$HDFSName]["properties"]["nameNodeDataDir"]["value"],
+                     "@HDPMapReduceLocalDir@" => $services[$MapredName]["properties"]["mapReduceLocalDir"]["value"],
+                     "@HDPZookeeperDataDir@" => $services[$ZooKeeperName]["properties"]["zooKeeperDataDir"]["value"],
+                     "@HDPOozieDbDir@" => $services[$OozieName]["properties"]["oozieDbDir"]["value"],
+                     "@HDPHCatalogMySqlDbHost@" => ( isset($mySqlBase["mysqlHost"]["value"]) ? $mySqlBase["mysqlHost"]["value"] : "" ),
+                     "@HDPHCatalogMySqlDbName@" => ( isset($mySqlBase["mysqlDB"]["value"]) ? $mySqlBase["mysqlDB"]["value"] : "" ),
+                     "@HDPHCatalogMySqlDbUser@" => ( isset($mySqlBase["mysqlUser"]["value"]) ? $mySqlBase["mysqlUser"]["value"] : "" ),
+                     "@HDPHCatalogMySqlDbPassword@" => ( isset($mySqlBase["mysqlPasswd"]["value"]) ? $mySqlBase["mysqlPasswd"]["value"] : "" ),
+                     "@HDPGSInstallLogFile@" => getGsInstallerLogPath($clusterName),
+                     "@HDPGSInstallStatusDumpFile@" => getGsInstallerStatusDumpPath($clusterName)
+                     );
+// Replace all the tags with correspond values
+$finalGsInstallerPropsContents = str_replace(array_keys($replacements), array_values($replacements), $templatedData);
+// Write out the completed file into gsInstaller-input-dir
+$finalGsInstallerPropsFile = getInstallerInputDir($clusterName)."gsInstaller.properties";
+file_put_contents($finalGsInstallerPropsFile, $finalGsInstallerPropsContents);
+//////////////////////////////// End of writing out the gsInstaller.properties file
+
+//////////////////////////////// Write out the gsCluster.properties file
+
+/* Dead code 
+// Templated variables
+// All props to be replace eventually. TODO:
+#$varsToBeReplaced = array("@HDPHadoopHeapSize@", "@HDPNameNodeHeapSize@", "@HDPFSInMemorySize@", "@HDPNameNodeOptNewSize@", "@HDPDataNodeDuReserved@", "@HDPDataNodeHeapSize@", "@HDPJobTrackerOptNewSize@", "@HDPJobTrackerOptMaxNewSize@", "@HDPJobTrackerHeapSize@", "@HDPMapRedMapTasksMax@", "@HDPMapRedReduceTasksMax@", "@HDPMapRedClusterMapMemoryMB@", "@HDPMapRedClusterReduceMemoryMB@", "@HDPMapRedClusterMaxMapMemoryMB@", "@HDPMapRedClusterMaxReduceMemoryMB@", "@HDPMapRedJobMapMemoryMB@", "@HDPMapRedJobReduceMemoryMB@", "@HDPMapRedChildJavaOptsSize@", "@HDPIoSortMB@", "@HDPIoSortSpillPercent@", "@HDPMapReduceUserLogRetainHours@", "@HDPMaxTasksPerJob@", "@HDPDFSDataNodeFailedVolumeTolerated@", "@HDPHBaseMasterHeapSize@", "@HDPHBaseRegionServerHeapSize@");
+#$varsToBeReplaced = array( "@HDPNameNodeHeapSize@", "@HDPJobTrackerHeapSize@", "@HDPHBaseMasterHeapSize@", "@HDPDataNodeHeapSize@", "@HDPHadoopHeapSize@", "@HDPMapRedChildJavaOptsSize@" );
+$valuesToReplaceWith = array($memoryOptionsSuggestions["HDPNameNodeHeapSize"], $memoryOptionsSuggestions["HDPJobTrackerHeapSize"], $memoryOptionsSuggestions["HDPHBaseMasterHeapSize"], $memoryOptionsSuggestions["HDPDataNodeHeapSize"], $memoryOptionsSuggestions["HDPHadoopHeapSize"], $memoryOptionsSuggestions["HDPMapRedChildJavaOptsSize"]);
+// Replace all the tags with correspond values
+$finalGsClusterPropsContents = str_replace($varsToBeReplaced, $valuesToReplaceWith, $templatedData);
+End dead code */
+
+// Read the template into memory
+$templatedData = file_get_contents('/var/www/html/KickAssHDPUI/ShellScripts/templates/gsCluster.properties.in');
+// get mem suggestions 
+$memoryOptionsSuggestions = $clusterInfo["sysInfo"]["memoryOptionsSuggestions"];
+
+$gsClusterProps = array();
+$gsClusterProps["@HDPNameNodeHeapSize@"] = $memoryOptionsSuggestions["HDPNameNodeHeapSize"];
+$gsClusterProps["@HDPJobTrackerHeapSize@"] = $memoryOptionsSuggestions["HDPJobTrackerHeapSize"];
+$gsClusterProps["@HDPHBaseMasterHeapSize@"] = $memoryOptionsSuggestions["HDPHBaseMasterHeapSize"];
+$gsClusterProps["@HDPDataNodeHeapSize@"] = $memoryOptionsSuggestions["HDPDataNodeHeapSize"];
+$gsClusterProps["@HDPHadoopHeapSize@"] = $memoryOptionsSuggestions["HDPHadoopHeapSize"];
+$gsClusterProps["@HDPMapRedChildJavaOptsSize@"] = $memoryOptionsSuggestions["HDPMapRedChildJavaOptsSize"];
+$gsClusterProps["@HDPHBaseRegionServerHeapSize@"] = "1024m";
+$gsClusterProps["@HDPFSInMemorySize@"] = "256";
+$gsClusterProps["@HDPNameNodeOptNewSize@"] = "640m";
+$gsClusterProps["@HDPDataNodeDuReserved@"] = "1073741824";
+$gsClusterProps["@HDPJobTrackerOptNewSize@"] = "200m";
+$gsClusterProps["@HDPJobTrackerOptMaxNewSize@"] = "200m";
+$gsClusterProps["@HDPMapRedMapTasksMax@"] = "4";
+$gsClusterProps["@HDPMapRedReduceTasksMax@"] = "2";
+$gsClusterProps["@HDPMapRedClusterMapMemoryMB@"] = "-1";
+$gsClusterProps["@HDPMapRedClusterReduceMemoryMB@"] = "-1";
+$gsClusterProps["@HDPMapRedClusterMaxMapMemoryMB@"] = "-1";
+$gsClusterProps["@HDPMapRedClusterMaxReduceMemoryMB@"] = "-1";
+$gsClusterProps["@HDPMapRedJobMapMemoryMB@"] = "-1";
+$gsClusterProps["@HDPMapRedJobReduceMemoryMB@"] = "-1";
+$gsClusterProps["@HDPIoSortMB@"] = "200m";
+$gsClusterProps["@HDPIoSortSpillPercent@"] = "0.9";
+$gsClusterProps["@HDPMapReduceUserLogRetainHours@"] = "24";
+$gsClusterProps["@HDPMaxTasksPerJob@"] = "-1";
+$gsClusterProps["@HDPDFSDataNodeFailedVolumeTolerated@"] = "0";
+ 
+$finalGsClusterPropsContents = str_replace(array_keys($gsClusterProps),
+    array_values($gsClusterProps), $templatedData);
+
+// Write out the completed file into gsInstaller-input-dir
+$finalGsClusterPropsFile = getInstallerInputDir($clusterName)."gsCluster.properties";
+file_put_contents($finalGsClusterPropsFile, $finalGsClusterPropsContents);
+//////////////////////////////// End of writing out the gsCluster.properties file
+
+// Copy monInstaller as is for now until we add templating support
+$copyDir = getInstallerInputDir($clusterName);
+system("cp -f /var/www/html/KickAssHDPUI/ShellScripts/templates/monInstaller.properties.in $copyDir/monInstaller.properties");
+
+header("Content-type: text/plain");
+print "";
+setupGsInstaller($clusterName);
+copyHostRoleFilesToRunDir($clusterName);
+setInstallStarted($clusterName);
+triggerGsInstaller($clusterName);
+
+
+?>

+ 77 - 0
hmc/archive/php/displayLogs.php

@@ -0,0 +1,77 @@
+<?php
+
+include 'dbLib.php';
+include 'utils.php';
+include 'gsInstallerUtils.php';
+
+// TODO: Hardcoded for now
+$clusterName = $_GET['clusterName'];
+//$clusterName = "MyCluster-12345";
+
+$getAll = FALSE;
+$lastN = 50;
+if (isset($_GET["lines"])) {
+  if ($_GET["lines"] == "all" ) {
+    $getAll = TRUE;
+  }
+  else if (is_numeric($_GET["lines"])) {
+    $lastN = $_GET["lines"];
+  }
+}
+
+$output = "";
+if ($getAll == TRUE) {
+  $output = getGsInstallLogs($clusterName);
+}
+else {
+  $output = getLastNLinesFromGsInstallLogs($clusterName, $lastN);
+}
+
+$gsInstallDone = isGsInstallDone($clusterName);
+
+header("Content-type: application/json");
+
+$response = array();
+
+$installstatus = getGsInstallExitStatus($clusterName);
+
+// NULL for error
+// 0 for success
+// 1 for error
+// -1 for installer running
+// -2 for not installed
+if ($installstatus === NULL) {
+   $response["installExitStatus"] = "UNKNOWN";
+} else if ($installstatus === 0) {
+   $response["installExitStatus"] = "SUCCESS";
+} else if ($installstatus === 1) {
+   $response["installExitStatus"] = "FAILURE";
+} else if ($installstatus === -1) {
+   $response["installExitStatus"] = "INSTALLING";
+} else if ($installstatus === -2) {
+   $response["installExitStatus"] = "NOTINSTALLED";
+} else {
+   $response["installExitStatus"] = "UNKNOWN";
+}
+
+if ($output === FALSE) {
+   $response["error"] = TRUE;
+   $response["logs"] = "";
+}
+else {
+   $response["error"] = FALSE;
+   $response["logs"] = $output;
+}
+
+$response["clusterName"] = $clusterName;
+$response["gsInstallDone"] = $gsInstallDone;
+
+print (json_encode($response));
+
+/*
+header("Content-type: text/plain");
+print $output;
+*/
+
+
+?>

+ 18 - 0
hmc/archive/php/displayNodeProgress.php

@@ -0,0 +1,18 @@
+<?php
+
+$logs = '';
+
+/* Generate long logs. */
+for($i = 0; $i < 100; $i++) {
+  $logs .= "1111 <br/>";
+}
+
+$jsonOutput = array( 
+    'txnId' => $txnId, 
+    'logs' => $logs );
+
+header("Content-type: application/json");
+
+print (json_encode($jsonOutput));
+
+?>

+ 18 - 0
hmc/archive/php/dummyDeploy.php

@@ -0,0 +1,18 @@
+<?php
+
+$clusterName = $_GET['clusterName'];
+
+header("Content-type: application/json");
+
+/* All we need to do is give back a new txnId. */
+$txnId = rand();
+
+error_log( 'Generated new txnId: ' . $txnId );
+
+$jsonOutput = array( 
+  'txnId' => $txnId,
+  'clusterName' => $clusterName );
+
+print (json_encode($jsonOutput));
+
+?>

+ 22 - 0
hmc/archive/php/dummyFetchTxnLogs.php

@@ -0,0 +1,22 @@
+<?php
+
+$txnId = $_GET['txnId'];
+
+define('LAST_PROGRESS_STATE_INDEX_FILE', '/tmp/rezDeployProgressStateIndex' . $txnId);
+
+$logs = '';
+
+/* Generate long logs. */
+for($i = 0; $i < 100; $i++) {
+  $logs .= "1111 <br/>";
+}
+
+$jsonOutput = array( 
+    'txnId' => $txnId, 
+    'logs' => $logs );
+
+header("Content-type: application/json");
+
+print (json_encode($jsonOutput));
+
+?>

+ 53 - 0
hmc/archive/php/dummyFetchTxnProgressReport.php

@@ -0,0 +1,53 @@
+<?php
+
+$txnId = $_GET['txnId'];
+
+define('LAST_PROGRESS_STATE_INDEX_FILE', '/tmp/rezDeployProgressStateIndex' . $txnId);
+
+function fetchLastProgressStateIndex()
+{
+  $lastProgressStateIndex = 0;
+
+  if( file_exists(LAST_PROGRESS_STATE_INDEX_FILE) )
+  {
+    $lastProgressStateIndex = trim( file_get_contents(LAST_PROGRESS_STATE_INDEX_FILE) );
+  }
+
+  return $lastProgressStateIndex;
+}
+
+function storeLastProgressStateIndex( $latestProgressStateIndex )
+{
+  file_put_contents(LAST_PROGRESS_STATE_INDEX_FILE, $latestProgressStateIndex);
+}
+
+$lastProgressStateIndex = fetchLastProgressStateIndex();
+
+$progressStates = array( 'State1', 'State2', 'State3', 'State4', 'State5' );
+$currentProgressStateIndex = $lastProgressStateIndex;
+
+/* Progress to the next state only if we haven't already reached the end. 
+ *
+ * We expect callers to stop to call this webservice once this condition is
+ * reached in any case, but let's be safe all the same.
+ */
+if( $lastProgressStateIndex < count($progressStates) )
+{
+  /* Randomize the rate of our progress, in steps of 1. */
+  $currentProgressStateIndex = (rand() % 2) ? ($lastProgressStateIndex + 1) : ($lastProgressStateIndex);
+
+  /* Update our disk cookie. */
+  storeLastProgressStateIndex( $currentProgressStateIndex );
+}
+
+$jsonOutput = array( 
+    'txnId' => $txnId, 
+    'progressStates' => $progressStates,
+    'currentProgressStateIndex' => $currentProgressStateIndex,
+    'encounteredError' => (rand() % 20) ? false : true );
+
+header("Content-type: application/json");
+
+print (json_encode($jsonOutput));
+
+?>

+ 17 - 0
hmc/archive/php/globals.inc

@@ -0,0 +1,17 @@
+<?php
+
+# Globals 
+
+$GLOBALS["CLUSTER_INFO"] = array();
+
+/*
+CLUSTER_INFO/cluster_id/services -> name, enabled, display name, masters ( name, display name, hostname ) 
+            /cluster_id/hosts/host - mem, cpu, disk info
+            /cluster_id/sys_info/mount_points
+            /
+            
+*/
+
+
+
+?>

+ 216 - 0
hmc/archive/php/gsInstallerUtils.php

@@ -0,0 +1,216 @@
+<?php
+
+$gsInstallerInstallDir = "/var/lib/gsInstaller/";
+
+/**
+ * Function to copy over gsInstaller into a working dir
+ * where we can override settings and execute the deploy
+ */
+function setupGsInstaller($clusterId) {
+  // empty work dir
+  $workDir = getClusterDir($clusterId)."gsInstaller/";
+  $retval = 0;
+  system("rm -rf $workDir/*", $retval);
+  // if ($retval != 0) {
+    // die("Could not empty $workDir, error=$retval");
+  //}
+  $retval = 0;
+  system("mkdir -p $workDir", $retval);
+  //if ($retval != 0) {
+    //die("Could not empty $workDir, error=$retval");
+  //}
+  
+  // copy gs install code into work dir
+  global $gsInstallerInstallDir;
+  system("cp -rf $gsInstallerInstallDir/* $workDir/", $retval);
+  if ($retval != 0) {
+    die("Could not copy gsInstaller into $workDir, error=$retval");
+  }  
+}
+
+function copyGsInstallPropsToRunDir($clusterId, $gsInstallPropsFile) {
+  $workDir = getClusterDir($clusterId)."gsInstaller/";
+  $retval = 0;
+  system("cp -f $gsInstallPropsFile $workDir/*", $retval);
+  if ($retval != 0) {
+    die("Could not copy $gsInstallPropsFile into $workDir, error=$retval");
+  }
+}
+
+function copyHostRoleFilesToRunDir($clusterId) {
+  $workDir = getClusterDir($clusterId)."gsInstaller/";
+  
+  $file_list = array (
+     "dashboardhost",
+     "gangliaserver",
+     "gateway",
+     "hbasemaster",
+     "hbasenodes",
+     "hcatserver",
+     "jobtracker",
+     "nagiosserver",
+     "namenode",
+     "nodes",
+     "oozieserver",
+     "snamenode",
+     "templetonnode",
+     "zknodes",
+     "gsInstaller.properties",
+     "gsCluster.properties",
+     "monInstaller.properties",
+   );
+
+  $errors = "";
+  $installerInputDir = getInstallerInputDir($clusterId);
+  
+  foreach ($file_list as $filename) {
+    $filepath = $installerInputDir.$filename;
+    $retval = 0;
+    system("cp -f $filepath $workDir/$filename", $retval);
+    if ($retval != 0) {
+      $errors .= ", could not copy $filepath to $workDir: error=$retval";
+    }
+  }
+  
+  if ($errors != "") {
+    die ("Copy of host roles files failed, $errors");
+  }
+}
+
+function triggerGsUnInstaller($clusterId) {
+  $workDir = getClusterDir($clusterId)."gsInstaller/";
+  $retval = 0;
+
+  error_log("Running gs Uninstaller");
+  $logfile = $workDir."gsUnInstall-console.out";
+  $cmd="/var/www/html/KickAssHDPUI/cpp/runscriptasroot \""
+          . " cd $workDir; "
+          . " echo \"\" > $logfile " 
+          . " echo y | sh ./gsUninstaller.sh 2>&1 >> $logfile; "
+          . " \"";
+
+  $handle = popen($cmd, "r");
+  // Do some checks on return status: TODO
+  //print $cmd;
+  pclose($handle);
+}
+
+function triggerGsInstaller($clusterId) {
+  $workDir = getClusterDir($clusterId)."gsInstaller/";
+  $retval = 0;
+
+
+  error_log("Running gs installer");
+  $logfile = $workDir."gsInstall-console.out";
+  $cmd="/var/www/html/KickAssHDPUI/cpp/runscriptasroot \""
+          . " cd $workDir; "
+          . " echo \"\" > $logfile " 
+          . " sh createUsers.sh 2>&1 >> $logfile; "
+          . " sh gsPreRequisites.sh 2>&1 >> $logfile; "
+          . " echo y | sh ./gsInstaller.sh 2>&1 >> $logfile; "
+          . " \"";
+
+  error_log("Starting gsinstaller with $cmd".date("U"));
+  $handle = popen($cmd, "r");
+  // Do some checks on return status: TODO
+  //print $cmd;
+  pclose($handle);
+
+  // shell_exec($cmd);
+  error_log("Done with gsinstaller".date("U"));
+
+  # TODO error check
+
+  # TODO run moninstaller
+
+  return $retval;
+}
+
+function getGsInstallerLogPath($clusterId) {
+  return getClusterDir($clusterId)."gsInstaller/gsInstall.log";
+}
+
+function getGsInstallerStatusDumpPath($clusterId) {
+  return getClusterDir($clusterId)."gsInstaller/gsInstallStatusDump.out";
+}
+
+function getLastNLinesFromGsInstallLogs($clusterId, $lastNlines) {
+  $cmd = "tail -".$lastNlines." ".getGsInstallerLogPath($clusterId);
+  $handle = popen($cmd, "r");
+  // TODO error check
+  $output = "";
+  while (!feof($handle)) {
+    $read = fread($handle, 2096);
+    $output .= $read;
+  }
+  pclose($handle);
+  return $output;
+}
+
+function getGsInstallLogs($clusterId) {
+  if (!file_exists(getGsInstallerLogPath($clusterId))) {
+     return FALSE;
+  }
+  return file_get_contents(getGsInstallerLogPath($clusterId));
+}
+
+function isGsInstallDone($clusterId) {
+  $retval = 0;
+  $outdump = array();
+  $psGrepOutput = exec("ps -ef | grep -i \"gsInstaller.sh\" | grep -v grep | wc -l", $outdump, $retval);
+  $output = trim($psGrepOutput);
+
+  if ($retval != 0 || $output == "0") {
+    return TRUE;
+  }
+  return FALSE;
+}
+
+// NULL for error
+// 0 for success
+// 1 for error
+// -1 for installer running
+// -2 for not installed
+function getGsInstallExitStatus($clusterId) {
+  $statusFile = getGsInstallerStatusDumpPath($clusterId);
+  if (!file_exists($statusFile)) {
+    return NULL;
+  }
+  $cmd = "grep \"^EXIT \" $statusFile";
+  $retval = "";
+  $output = array();
+  $retcode = 0;
+  $retval = exec($cmd, $output, $retcode);
+
+  $installDone = isGsInstallDone($clusterId);
+  if (!$installDone) {
+     return -1;
+  }
+
+  if (!hasInstallStarted($clusterId)) {
+     return -2;
+  }
+
+  if ($retcode != 0 && $installDone) {
+     error_log("Install done but no exit stmt in status output");
+     return NULL;
+  }
+
+  if (!defined($retval) || $retval == "") {
+    return NULL;
+  }
+
+  if (strpos($retval, "EXIT OK") == 0) {
+     return 0;
+  }
+
+  if (strpos($retval, "EXIT ERROR") == 0) {
+     return 1;
+  }
+
+  return NULL;
+}
+
+
+
+?>

+ 281 - 0
hmc/archive/php/initializeCluster.php

@@ -0,0 +1,281 @@
+<?php
+include './dbLib.php';
+include './utils.php';
+
+// Read from the input
+$requestdata = file_get_contents('php://input');
+//error_log($requestdata, 3, "/tmp/rez.log");
+$requestObj = json_decode($requestdata, true);
+
+$clusterName = $_GET['clusterName'];
+// Validate clusterName: TODO; FIXME
+$clusterDir = getClusterDir($clusterName);
+/*
+if(!is_dir($clusterDir)) {
+  print "Cluster ".$clusterName." doesn't exist";
+  exit 1;
+}
+*/
+
+$suggestNodesScriptInputDir = $clusterDir."/suggestNodesScriptInputDir/";
+$suggestNodesScriptOutputDir = $clusterDir."/suggestNodesScriptOutputDir/";
+mkdir($suggestNodesScriptInputDir); // TODO: Check error conditions
+mkdir($suggestNodesScriptOutputDir);// TODO: Check error conditions
+
+// Hard code host and identity files for now
+//$requestObj['ClusterDeployUserIdentityFile']="va_rsa";
+//$requestObj['ClusterHostsFile']="hostsFile.txt";
+
+// write the input file to the node-suggestor
+$fp = fopen($suggestNodesScriptInputDir."/data.txt", 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$requestObj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.getSshKeyFilePath($clusterName)."\n");
+fwrite($fp, 'HDPClusterHostsFile='.getHostsFilePath($clusterName)."\n");
+fclose($fp);
+
+// invoke the node-suggstor
+$cmd = "/var/www/html/KickAssHDPUI/archive/ShellScripts/suggestNodes.sh ".$suggestNodesScriptInputDir."/data.txt ".$suggestNodesScriptOutputDir;
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  #error_log($read, 3, "/tmp/errors.txt");
+}
+pclose($handle);
+
+function ReadHostNameFromFile ($fileName)
+{
+  $fp = fopen($fileName, "r");
+  $fsize = filesize($fileName);
+  if ($fsize == 0) {
+    return "";
+  }
+  $retval = fread($fp, $fsize);
+  $retval = explode(' ', $retval);
+  fclose($fp);
+  return $retval[0];
+}
+
+// Read the output from the node-suggestor
+
+$GatewaySuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/GatewaySuggest.out");
+$NameNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NameNodeSuggest.out");
+$JobTrackerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/JobTrackerSuggest.out");
+$SecondaryNameNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/SecondaryNameNodeSuggest.out");
+$HBaseMasterSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/HBaseMasterSuggest.out");
+$HCatalogServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/HCatalogServerSuggest.out");
+$OozieServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/OozieServerSuggest.out");
+$TempletonNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/TempletonNodeSuggest.out");
+$GangliaCollectorSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/GangliaCollectorSuggest.out");
+$NagiosServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NagiosServerSuggest.out");
+/// TODO: FIXME: Why is monitoring dashboard different from management console
+$DashboardSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/DashboardSuggest.out");
+$AllHosts = ReadNthWordsOfAllLinesFromFile($suggestNodesScriptOutputDir."/HostDiscovery.out", 1);
+
+/// TODO: Move to next phase
+$NameNodeMountPointsSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NameNodeMountPointsSuggest.out");
+
+$jsonOutput = array(
+            "clusterName" => $clusterName,
+            "services" => array(
+             "$MapredName" =>   array (
+                 "name" => $MapredName,
+                 "enabled" => true,
+                 "displayName" => "Mapreduce",
+                 "masters" => array(
+                                     $JobTrackerName => array (
+                                       "name" => $JobTrackerName,
+                                       "displayName" => "JobTracker",
+                                       "hostName" => $JobTrackerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "$HDFSName" =>  array (
+                 "name" => $HDFSName,
+                 "enabled" => true,
+                 "displayName" => "HDFS",
+                 "masters" => array(
+                                     $NameNodeName => array (
+                                       "name" => $NameNodeName,
+                                       "displayName" => "NameNode",
+                                       "hostName" => $NameNodeSuggestOut,
+                                       ),
+                                     $SecondaryNameNodeName => array (
+                                       "name" => $SecondaryNameNodeName,
+                                       "displayName" => "Secondary NameNode",
+                                       "hostName" => $SecondaryNameNodeSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "$PigName" => array (
+                 "name" => $PigName,
+                 "enabled" => $requestObj["InstallPig"],
+                 "displayName" => "Pig",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$HBaseName" => array (
+                 "name" => $HBaseName,
+                 "enabled" => $requestObj["InstallHBase"],
+                 "displayName" => "HBase",
+                 "masters" => array(
+                                     $HBaseMasterName => array (
+                                       "name" => $HBaseMasterName,
+                                       "displayName" => "HBase Master",
+                                       "hostName" => $HBaseMasterSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+              "$OozieName" => array (
+                 "name" => $OozieName,
+                 "enabled" => $requestObj["InstallOozie"],
+                 "displayName" => "Oozie",
+                 "masters" => array(
+                                     $OozieServerName => array (
+                                       "name" => $OozieServerName,
+                                       "displayName" => "Oozie Server",
+                                       "hostName" => $OozieServerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+              "$HCatName" => array (
+                 "name" => $HCatName,
+                 "enabled" => $requestObj["InstallHCatalog"],
+                 "displayName" => "HCatalog",
+                 "masters" => array(
+                                     $HCatServerName => array (
+                                       "name" => $HCatServerName,
+                                       "displayName" => "HCatalog Server",
+                                       "hostName" => $HCatalogServerSuggestOut,
+                                       ),
+
+                                 ),
+                 "properties" => array(),
+                ),
+              "$TempletonName" => array (
+                 "name" => $TempletonName,
+                 "enabled" => $requestObj["InstallTempleton"],
+                 "displayName" => "Templeton",
+                 "masters" => array(
+                                     $TempletonNodeName => array (
+                                       "name" => $TempletonNodeName,
+                                       "displayName" => "Templeton Node",
+                                       "hostName" => $TempletonNodeSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+            "$SqoopName" =>  array (
+                 "name" => $SqoopName,
+                 "enabled" => $requestObj["InstallSqoop"],
+                 "displayName" => "Sqoop",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$GatewayName" => array (
+                 "name" => $GatewayName,
+                 "enabled" => true,
+                 "displayName" => "Gateway",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$ZooKeeperName" => array (
+                 "name" => $ZooKeeperName,
+                 "enabled" => $requestObj["InstallHBase"], // TODO: FIXME dependencies
+                 "displayName" => "ZooKeeper",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$GangliaCollectorName" => array (
+                 "name" => $GangliaCollectorName,
+                 "enabled" => true,
+                 "displayName" => "Ganglia Collector",
+                 "masters" => array(
+                                     $GangliaCollectorName => array (
+                                       "name" => $GangliaCollectorName,
+                                       "displayName" => "Ganglia Collector",
+                                       "hostName" => $GangliaCollectorSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "$NagiosName" => array (
+                 "name" => $NagiosName,
+                 "enabled" => true,
+                 "displayName" => "Nagios",
+                 "masters" => array(
+                                     $NagiosServerName => array (
+                                       "name" => $NagiosServerName,
+                                       "displayName" => "Nagios Server",
+                                       "hostName" => $NagiosServerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "miscellaneous" => array(
+                  "properties" => array(),
+                  "masters" => array(),
+                ),
+            ),
+            "allHosts"=> $AllHosts,
+            "hosts" => array(),
+            "sysInfo" => array(
+               "mountPoints" => array(),
+              ),
+            "installInfo" => array (
+               "deployUser" => $requestObj['ClusterDeployUser']
+              ),
+           );
+
+/*
+/////////////////// Persist the services list to the DB
+$services = array();
+if($requestObj["InstallHBase"] == "true") {
+  array_push($services, $HBaseName);
+}
+if($requestObj["InstallPig"] == "true") {
+  array_push($services, $PigName);
+}
+if($requestObj["InstallHCatalog"] == "true") {
+  array_push($services, $HCatName);
+}
+if($requestObj["InstallOozie"] == "true") {
+  array_push($services, $OozieName);
+}
+if($requestObj["InstallTempleton"] == "true") {
+  array_push($services, $TempletonName);
+}
+if($requestObj["InstallSqoop"] == "true") {
+  array_push($services, $SqoopName);
+}
+storeSelectedServiceNames($services);
+/////////////////// End of persisting the services list
+*/
+
+/// Store cluster selection info
+persistClusterInfo($clusterName, $jsonOutput);
+
+global $CLUSTER_STATUS_CONFIG_IN_PROGRESS;
+setClusterStatus($clusterName, $CLUSTER_STATUS_CONFIG_IN_PROGRESS);
+
+header("Content-type: application/json");
+
+// re-work svc array for UI
+$svc_array = $jsonOutput["services"];
+$jsonOutput["services"] = array();
+
+foreach ($svc_array as $key=>$arr) {
+  $svc_arr = $arr;
+  $svc_arr["masters"] = array();
+  foreach ($arr["masters"] as $role=>$role_arr) {
+    array_push($svc_arr["masters"], $role_arr);
+  }
+  array_push($jsonOutput["services"], $svc_arr);
+}
+
+print (json_encode($jsonOutput));
+?>

+ 38 - 0
hmc/archive/php/listClusters.php

@@ -0,0 +1,38 @@
+<?php
+
+include 'dbLib.php';
+include 'gsInstallerUtils.php';
+
+$listOfClusters = array();
+if ($handle = opendir(getAllClustersDir())) {
+  while (($clusterId = readdir($handle)) !== FALSE) {
+    if ($clusterId != "." && $clusterId != "..") {
+         
+      // Return clusterId only if the deploy has started
+      // if(hasInstallStarted($clusterId)) {
+     //     array_push($listOfClusters, $clusterId);
+        $status = getClusterStatus($clusterId);
+        global $CLUSTER_STATUS_INSTALL_IN_PROGRESS;
+        global $CLUSTER_STATUS_INSTALL_DONE;
+        global $CLUSTER_STATUS_INSTALL_SUCCESSFUL;
+        global $CLUSTER_STATUS_INSTALL_UNSUCCESSFUL;
+
+        if ($status == $CLUSTER_STATUS_INSTALL_IN_PROGRESS) {
+           if (isGsInstallDone($clusterId)) {
+             setClusterStatus($clusterId, $CLUSTER_STATUS_INSTALL_DONE);
+           }
+         }
+
+        $listOfClusters[$clusterId] = getClusterStatus($clusterId);
+      //  $listOfClusters[$clusterId] = "started";//getClusterStatus($clusterId);
+      //}
+    }
+  }
+  closedir($handle);
+}
+
+header("Content-type: application/json");
+//print (json_encode($listOfClusters));
+print (json_encode($listOfClusters));
+
+?>

+ 2 - 0
hmc/archive/php/memorySuggestor-data.txt

@@ -0,0 +1,2 @@
+HDPClusterDeployUser=root
+HDPClusterDeployUserIdentityFile=/var/run/HMCDir/clusters/MyCluster-12345/user-ssh-key

+ 54 - 0
hmc/archive/php/options.php

@@ -0,0 +1,54 @@
+<?php
+include 'dbLib.php';
+include 'utils.php';
+
+// Read from the input
+$requestdata = file_get_contents('php://input');
+$obj = json_decode($requestdata, true);
+
+$clusterName = $_GET['clusterName'];
+
+// Store the final options that the user has submitted
+error_log(json_encode($obj), 0);
+storeOptions($clusterName, $obj);
+$clusterDeployUser = getClusterDeployUser($clusterName);
+$clusterDir = getClusterDir($clusterName);
+
+// write the input file to the node-suggestor
+$scriptInputDataFile = $clusterDir."memorySuggestor-data.txt";
+$fp = fopen($scriptInputDataFile, 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$clusterDeployUser."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.getSshKeyFilePath($clusterName)."\n");
+fclose($fp);
+
+$installerInputDir = getInstallerInputDir($clusterName);
+$outputFile = $clusterDir."memorySuggestor-output.txt";
+$cmd = "/var/www/html/KickAssHDPUI/archive/ShellScripts/suggestMemSize.sh ".$installerInputDir." ".$scriptInputDataFile." ".$outputFile." 0";
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+//print $cmd;
+//echo "'$handle'; " . gettype($handle) . "\n";
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  // echo $read;
+}
+pclose($handle);
+
+$keys = ReadNthWordsOfAllLinesFromFile($outputFile, 1);
+$values = ReadNthWordsOfAllLinesFromFile($outputFile, 2);
+
+$memOptionSuggestions = array();
+for ($i = 0; $i < sizeof($keys); $i++) {
+  if (isset($values[$i])) {
+    $memOptionSuggestions[$keys[$i]] = $values[$i];
+  }
+}
+// Persist it now itself. TODO: Move this to next megaConfigure page.
+storeMemoryOptionSuggestions($clusterName, $memOptionSuggestions);
+
+//print (json_encode($memOptionSuggestions));
+
+// Give the whole db
+header("Content-type: application/json");
+print (json_encode(getPersistedClusterInfo($clusterName)));
+?>

+ 24 - 0
hmc/archive/php/pluggableDisplayHeaderFooter.php

@@ -0,0 +1,24 @@
+<?php
+
+function get_header() {
+  $header = <<<HEADER
+    <img src="./logo.jpg"/>
+    <section id="headerText">Hortonworks Data Platform</section>
+HEADER;
+
+  return $header;
+}
+
+function get_footer() {
+  return "";
+}
+
+function render_header() {
+  print "<header>\n".get_header()."\n</header>\n";
+}
+
+function render_footer() {
+  print "<footer>\n".get_footer()."\n</footer>\n";
+}
+
+?>

+ 91 - 0
hmc/archive/php/serviceAdmin.php

@@ -0,0 +1,91 @@
+<?php
+
+include 'dbLib.php';
+include 'utils.php';
+include 'gsInstallerUtils.php';
+
+// TODO: Hardcoded for now
+$clusterName = $_GET['clusterName'];
+// $clusterName = "MyCluster-12345";
+
+$serviceName = $_GET['Service'];
+$action = $_GET['Action'];
+
+$clusterInfo = getPersistedClusterInfo($clusterName);
+$servicesInfo = $clusterInfo["services"];
+
+function sendBadRequestResponse($msg) {
+ header('Content-type: application/json');
+ header("HTTP/1.0 400 Bad Request");
+ $result = array();
+ $result["error"] = $msg;
+ $result["success"] = FALSE;
+ print(json_encode($result));
+}
+
+function sendErrorResponse($msg) {
+ header('Content-type: application/json');
+ header("HTTP/1.0 500 Internal Server Error");
+ $result = array();
+ $result["error"] = $msg;
+ $result["success"] = FALSE;
+ print(json_encode($result));
+}
+
+function returnSuccessResponse() {
+  header('Content-type: application/json');
+  header("HTTP/1.1 200 OK");
+  print(json_encode(array("success" => TRUE)));
+}
+
+function takeServiceAction($svc, $actionSvc, $action) {
+  global $servicesInfo;
+  global $clusterName;
+  if (!isset($servicesInfo[$svc]["enabled"])
+      || $servicesInfo[$svc]["enabled"] == false) {
+     return sendErrorResponse("Service $svc is not installed");
+  }
+
+  if (hasInstallStarted($clusterName) && !isGsInstallDone($clusterName)) {
+    return sendErrorResponse("Service $svc installation is still in progress");
+  }
+
+  $workDir = getClusterDir($clusterName)."gsInstaller/";
+  $cmd="/var/www/html/KickAssHDPUI/cpp/runscriptasroot \"cd $workDir; echo y | sh ./gsInstaller-cmdline.sh --action=$action --services=$actionSvc \"";
+
+  $handle = popen($cmd, "r");
+  // Do some checks on return status: TODO
+  // print $cmd;
+  // echo "'$handle'; " . gettype($handle) . "\n";
+  // while (!feof($handle)) {
+    // $read = fread($handle, 2096);
+    // fwrite($loghandle, $read);
+  // }
+  pclose($handle);
+
+  return returnSuccessResponse();
+
+}
+
+if ($action != "start" && $action != "stop") {
+  return sendBadRequestResponse("Invalid action : $action");
+}
+
+if ($serviceName == $HDFSName) {
+  takeServiceAction($serviceName, "hdfs", $action);
+} else if ($serviceName == $MapredName) {
+  takeServiceAction($serviceName, "mapreduce", $action);
+} else if ($serviceName == $HBaseName) {
+  takeServiceAction($serviceName, "hbase", $action);
+} else if ($serviceName == $HCatName) {
+  takeServiceAction($serviceName, "hcat", $action);
+} else if ($serviceName == $TempletonName) {
+  takeServiceAction($serviceName, "templeton", $action);
+} else if ($serviceName == $OozieName) {
+  takeServiceAction($serviceName, "oozie", $action);
+} else {
+  return sendBadRequestResponse("Invalid service : $serviceName");
+}
+
+
+?>

+ 181 - 0
hmc/archive/php/servicesStatus.php

@@ -0,0 +1,181 @@
+<?php
+
+include 'dbLib.php';
+include 'utils.php';
+include 'gsInstallerUtils.php';
+
+// TODO: Hardcoded for now
+$clusterName = $_GET['clusterName'];
+//$clusterName = "MyCluster-12345";
+// Validate clusterName: TODO; FIXME
+//$clusterDir = getClusterDir($clusterName);
+$clusterInfo = getPersistedClusterInfo($clusterName);
+$servicesInfo = $clusterInfo["services"];
+
+
+$SERVICE_CHECKS_INSTALLDIR="/var/lib/gsInstaller/service_checks/";
+$NN_SCRIPT="check_namenode_up.sh";
+$HBM_SCRIPT="check_hbasemaster_up.sh";
+$HCAT_SCRIPT="check_hcatserver_up.sh";
+$JT_SCRIPT="check_jobttracker_up.sh";
+$OOZIE_SCRIPT="check_oozieserver_up.sh";
+$TEMPLETON_SCRIPT="check_templeton_up.sh";
+$ZK_SCRIPT="check_zookeeper_cluster_up.sh";
+
+
+function convertStatusNumToString($num) {
+  $ret = "UNKNOWN ERROR";
+  switch ($num) {
+    case 0:
+      $ret = "RUNNING";
+      break;
+    case 1:
+      $ret = "RUNNING IN DEGRADED MODE";
+      break;
+    case 2:
+      $ret = "NOT RUNNING";
+      break;
+    case 3:
+      $ret = "UNKNOWN ERROR";
+      break;
+    case 4:
+      $ret = "NOT INSTALLED";
+      break;
+    case 5:
+      $ret = "INSTALLATION IN PROGRESS";
+      break;
+  }
+  return $ret;
+}
+
+// 0 ok - running
+// 1 warn
+// 2 crit
+// 3 unknown
+// 4 uninstalled
+// 5 install in progress
+function getSvcStatus($svc, $role, $script) {
+  global $servicesInfo;
+  global $clusterName;
+  if (!isset($servicesInfo[$svc]["enabled"]) 
+      || $servicesInfo[$svc]["enabled"] == false) {
+    return 4;
+  }
+  
+  if (hasInstallStarted($clusterName) && !isGsInstallDone($clusterName)) {
+    return 5;
+  }
+
+  $host = $servicesInfo[$svc]["masters"][$role]["hostName"];
+
+  global $SERVICE_CHECKS_INSTALLDIR;
+  $script_path=$SERVICE_CHECKS_INSTALLDIR.$script;
+  if (!file_exists($script_path)) {
+    error_log("Could not find check script $script_path for $svc : $role");
+    return 3;
+  }
+  $cmd=$script_path." --host $host";
+  $retval = 3;
+  //system($cmd, $retval);
+
+  $handle = popen($cmd, "r");
+  // TODO error check
+  $output = "";
+  while (!feof($handle)) {
+    $read = fread($handle, 2096);
+    $output .= $read;
+  }
+  pclose($handle);
+ 
+  error_log("Ouput for $svc check: $output");
+
+  if ($output == "") {
+     $retval = 3;
+  } else if (strpos($output, "OK:") === 0) {
+     $retval = 0;
+  } else if (strpos($output, "WARNING:") === 0) {
+     $retval = 1;
+  } else if (strpos($output, "CRITICAL:") === 0) {
+     $retval = 2;
+  }
+
+  return $retval;
+}
+
+function getHdfsStatus() {
+  global $NN_SCRIPT;
+  return getSvcStatus("hdfs", "nameNode", $NN_SCRIPT);
+}
+
+function getMapRedStatus() {
+  global $JT_SCRIPT;
+  return getSvcStatus("mapReduce", "jobTracker", $JT_SCRIPT);
+}
+
+
+function getHBaseStatus() {
+  global $HBM_SCRIPT;
+  return getSvcStatus("hBase", "hBaseMaster", $HBM_SCRIPT);
+}
+
+function getHCatStatus() {
+  global $HCAT_SCRIPT;
+  return getSvcStatus("hCatalog", "hCatServer", $HCAT_SCRIPT);
+}
+
+
+/*
+function getZKStatus() {
+  global $ZK_SCRIPT;
+  return getSvcStatus("zooKeeper", 
+}
+*/
+
+function getOozieStatus() {
+  global $OOZIE_SCRIPT;
+  return getSvcStatus("oozie", "oozieServer", $OOZIE_SCRIPT);
+}
+
+function getTempletonStatus() {
+  global $TEMPLETON_SCRIPT;
+  return getSvcStatus("templeton", "templetonNode", $TEMPLETON_SCRIPT);
+}
+
+$serviceStatus = array(
+    $servicesInfo[$HDFSName]["displayName"] => array(
+                           "description" => "The Hadoop distributed file-system",
+                           "statusNum" => getHdfsStatus(),
+                        ),
+    $servicesInfo[$MapredName]["displayName"] => array(
+                           "description" => "The Hadoop MapReduce processing platform",
+                           "statusNum" => getMapRedStatus(),
+                        ),
+    $servicesInfo[$HBaseName]["displayName"] => array(
+                           "description" => "The Hadoop Database",
+                           "statusNum" => getHBaseStatus(),
+                        ),
+    $servicesInfo[$HCatName]["displayName"] => array(
+                           "description" => "The Hadoop Catalog",
+                           "statusNum" => getHcatStatus(),
+                        ),
+    $servicesInfo[$TempletonName]["displayName"] => array(
+                           "description" => "Hadoop web-services",
+                           "statusNum" => getTempletonStatus(),
+                        ),
+    $servicesInfo[$OozieName]["displayName"] => array(
+                           "description" => "Hadoop job-workflow system",
+                           "statusNum" => getOozieStatus(),
+                        ),
+  );
+
+foreach ($serviceStatus as $key=>$status) {
+  $serviceStatus[$key]["status"] = convertStatusNumToString($serviceStatus[$key]["statusNum"]);
+}
+
+$response = array();
+$response["serviceStatus"] = $serviceStatus;
+
+header("Content-type: application/json");
+print(json_encode($response));
+
+?>

+ 280 - 0
hmc/archive/php/tmpInitializeCluster.php

@@ -0,0 +1,280 @@
+<?php
+include './dbLib.php';
+include './utils.php';
+
+// Read from the input
+$requestdata = file_get_contents('php://input');
+//error_log($requestdata, 3, "/tmp/rez.log");
+$requestObj = json_decode($requestdata, true);
+
+$clusterName = $_GET['clusterName'];
+// Validate clusterName: TODO; FIXME
+$clusterDir = getClusterDir($clusterName);
+/*
+if(!is_dir($clusterDir)) {
+  print "Cluster ".$clusterName." doesn't exist";
+  exit 1;
+}
+*/
+
+$suggestNodesScriptInputDir = $clusterDir."/suggestNodesScriptInputDir/";
+$suggestNodesScriptOutputDir = $clusterDir."/suggestNodesScriptOutputDir/";
+mkdir($suggestNodesScriptInputDir); // TODO: Check error conditions
+mkdir($suggestNodesScriptOutputDir);// TODO: Check error conditions
+
+// Hard code host and identity files for now
+//$requestObj['ClusterDeployUserIdentityFile']="va_rsa";
+//$requestObj['ClusterHostsFile']="hostsFile.txt";
+
+// write the input file to the node-suggestor
+$fp = fopen($suggestNodesScriptInputDir."/data.txt", 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$requestObj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.getSshKeyFilePath($clusterName)."\n");
+fwrite($fp, 'HDPClusterHostsFile='.getHostsFilePath($clusterName)."\n");
+fclose($fp);
+
+// invoke the node-suggstor
+$cmd = "/var/www/html/KickAssHDPUI/ShellScripts/suggestNodes.sh ".$suggestNodesScriptInputDir."/data.txt ".$suggestNodesScriptOutputDir;
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  #error_log($read, 3, "/tmp/errors.txt");
+}
+pclose($handle);
+
+function ReadHostNameFromFile ($fileName)
+{
+  $fp = fopen($fileName, "r");
+  $retval = fread($fp, filesize($fileName));
+  $retval = explode(' ', $retval);
+  fclose($fp);
+  return $retval[0];
+}
+
+// Read the output from the node-suggestor
+
+$GatewaySuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/GatewaySuggest.out");
+$NameNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NameNodeSuggest.out");
+$JobTrackerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/JobTrackerSuggest.out");
+$SecondaryNameNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/SecondaryNameNodeSuggest.out");
+$HBaseMasterSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/HBaseMasterSuggest.out");
+$HCatalogServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/HCatalogServerSuggest.out");
+$OozieServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/OozieServerSuggest.out");
+$TempletonNodeSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/TempletonNodeSuggest.out");
+$GangliaCollectorSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/GangliaCollectorSuggest.out");
+$NagiosServerSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NagiosServerSuggest.out");
+/// TODO: FIXME: Why is monitoring dashboard different from management console
+$DashboardSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/DashboardSuggest.out");
+$AllHosts = ReadNthWordsOfAllLinesFromFile($suggestNodesScriptOutputDir."/HostDiscovery.out", 1);
+
+/// TODO: Move to next phase
+$NameNodeMountPointsSuggestOut = ReadHostNameFromFile($suggestNodesScriptOutputDir."/NameNodeMountPointsSuggest.out");
+
+$jsonOutput = array(
+            "clusterName" => $clusterName,
+            "services" => array(
+             "$MapredName" =>   array (
+                 "name" => $MapredName,
+                 "enabled" => true,
+                 "displayName" => "Mapreduce",
+                 "masters" => array(
+                                     $JobTrackerName => array (
+                                       "name" => $JobTrackerName,
+                                       "displayName" => "JobTracker",
+                                       "hostName" => $JobTrackerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(
+                                       "EnableLzo" => false,
+                                      ),
+                ),
+             "$HDFSName" =>  array (
+                 "name" => $HDFSName,
+                 "enabled" => true,
+                 "displayName" => "HDFS",
+                 "masters" => array(
+                                     $NameNodeName => array (
+                                       "name" => $NameNodeName,
+                                       "displayName" => "NameNode",
+                                       "hostName" => $NameNodeSuggestOut,
+                                       ),
+                                     $SecondaryNameNodeName => array (
+                                       "name" => $SecondaryNameNodeName,
+                                       "displayName" => "Secondary NameNode",
+                                       "hostName" => $SecondaryNameNodeSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "$PigName" => array (
+                 "name" => $PigName,
+                 "enabled" => $requestObj["InstallPig"],
+                 "displayName" => "Pig",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$HBaseName" => array (
+                 "name" => $HBaseName,
+                 "enabled" => $requestObj["InstallHBase"],
+                 "displayName" => "HBase",
+                 "masters" => array(
+                                     $HBaseMasterName => array (
+                                       "name" => $HBaseMasterName,
+                                       "displayName" => "HBase Master",
+                                       "hostName" => $HBaseMasterSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+              "$OozieName" => array (
+                 "name" => $OozieName,
+                 "enabled" => $requestObj["InstallOozie"],
+                 "displayName" => "Oozie",
+                 "masters" => array(
+                                     $OozieServerName => array (
+                                       "name" => $OozieServerName,
+                                       "displayName" => "Oozie Server",
+                                       "hostName" => $OozieServerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+              "$HCatName" => array (
+                 "name" => $HCatName,
+                 "enabled" => $requestObj["InstallHCatalog"],
+                 "displayName" => "HCatalog",
+                 "masters" => array(
+                                     $HCatServerName => array (
+                                       "name" => $HCatServerName,
+                                       "displayName" => "HCatalog Server",
+                                       "hostName" => $HCatalogServerSuggestOut,
+                                       ),
+
+                                     $MySqlServerName => array (
+                                       "name" => $MySqlServerName,
+                                       "displayName" => "MySql Server",
+                                       "hostname" => "",
+                                       "dbname" => "",
+                                       "dbuser" => "",
+                                       "dbpasswd" => "",
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+              "$TempletonName" => array (
+                 "name" => $TempletonName,
+                 "enabled" => $requestObj["InstallTempleton"],
+                 "displayName" => "Templeton",
+                 "masters" => array(
+                                     $TempletonNodeName => array (
+                                       "name" => $TempletonNodeName,
+                                       "displayName" => "Templeton Node",
+                                       "hostName" => $TempletonNodeSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+            "$SqoopName" =>  array (
+                 "name" => $SqoopName,
+                 "enabled" => $requestObj["InstallSqoop"],
+                 "displayName" => "Sqoop",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$GatewayName" => array (
+                 "name" => $GatewayName,
+                 "enabled" => true,
+                 "displayName" => "Gateway",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$ZooKeeperName" => array (
+                 "name" => $ZooKeeperName,
+                 "enabled" => $requestObj["InstallHBase"], // TODO: FIXME dependencies
+                 "displayName" => "ZooKeeper",
+                 "masters" => array(),
+                 "properties" => array(),
+                ),
+             "$GangliaCollectorName" => array (
+                 "name" => $GangliaCollectorName,
+                 "enabled" => true,
+                 "displayName" => "Ganglia Collector",
+                 "masters" => array(
+                                     $GangliaCollectorName => array (
+                                       "name" => $GangliaCollectorName,
+                                       "displayName" => "Ganglia Collector",
+                                       "hostName" => $GangliaCollectorSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+             "$NagiosName" => array (
+                 "name" => $NagiosName,
+                 "enabled" => true,
+                 "displayName" => "Nagios",
+                 "masters" => array(
+                                     $NagiosServerName => array (
+                                       "name" => $NagiosServerName,
+                                       "displayName" => "Nagios Server",
+                                       "hostName" => $NagiosServerSuggestOut,
+                                       ),
+                                  ),
+                 "properties" => array(),
+                ),
+            ),
+            "allHosts"=> $AllHosts,
+            "hosts" => array(),
+            "sysInfo" => array(
+               "mountPoints" => array(),
+              ),
+            "installInfo" => array (
+               "deployUser" => $requestObj['ClusterDeployUser']
+              ),
+           );
+
+/*
+/////////////////// Persist the services list to the DB
+$services = array();
+if($requestObj["InstallHBase"] == "true") {
+  array_push($services, $HBaseName);
+}
+if($requestObj["InstallPig"] == "true") {
+  array_push($services, $PigName);
+}
+if($requestObj["InstallHCatalog"] == "true") {
+  array_push($services, $HCatName);
+}
+if($requestObj["InstallOozie"] == "true") {
+  array_push($services, $OozieName);
+}
+if($requestObj["InstallTempleton"] == "true") {
+  array_push($services, $TempletonName);
+}
+if($requestObj["InstallSqoop"] == "true") {
+  array_push($services, $SqoopName);
+}
+storeSelectedServiceNames($services);
+/////////////////// End of persisting the services list
+*/
+
+/// Store cluster selection info
+persistClusterInfo($clusterName, $jsonOutput);
+
+header("Content-type: application/json");
+
+// re-work svc array for UI
+$svc_array = $jsonOutput["services"];
+$jsonOutput["services"] = array();
+
+foreach ($svc_array as $key=>$arr) {
+  $svc_arr = $arr;
+  $svc_arr["masters"] = array();
+  foreach ($arr["masters"] as $role=>$role_arr) {
+    array_push($svc_arr["masters"], $role_arr);
+  }
+  array_push($jsonOutput["services"], $svc_arr);
+}
+
+print (json_encode($jsonOutput));
+?>

+ 45 - 0
hmc/archive/php/uploadFiles.php

@@ -0,0 +1,45 @@
+<?php
+
+// include_once 'createCluster.php';
+include_once 'dbLib.php';
+
+//$requestData = file_get_contents('php://input');
+//error_log($requestdata, 3, "/tmp/rez.log");
+//$requestObj = json_decode($requestdata, true);
+
+$clusterName = $_GET['clusterName'];
+// Validate clusterName: TODO; FIXME
+
+// initCluster($clusterName);
+
+$identityFileDestination = getSshKeyFilePath($clusterName);
+$hostsFileDestination = getHostsFilePath($clusterName);
+
+// TODO: FIXME: Change echos to return error codes.
+//echo '<pre>';
+if (move_uploaded_file($_FILES['clusterDeployUserIdentityFile']['tmp_name'], $identityFileDestination)) {
+    //echo "File is valid, and was successfully uploaded.\n";
+
+  // Set the permissions
+  chmod($identityFileDestination, 0400);// TODO: Error conditions
+} else {
+    //echo "Possible file upload attack!\n";
+}
+
+if (move_uploaded_file($_FILES['clusterHostsFile']['tmp_name'], $hostsFileDestination)) {
+    //echo "File is valid, and was successfully uploaded.\n";
+  } else {
+    //echo "Possible file upload attack!\n";
+}
+
+// TODO: FIXME: Check file lengths.
+
+$outjson = array(
+                  "errorCode"=> 0,
+ //                 "clusterName" => $clusterName,
+ //                 "finalDestination" => $identityFileDestination,
+ //                 "fileToBeMoved" => $_FILES['clusterDeployUserIdentityFile']['tmp_name'],
+                );
+header("Content-type: application/json");
+print (json_encode($outjson));
+?>

+ 24 - 0
hmc/archive/php/utils.php

@@ -0,0 +1,24 @@
+<?php
+function ReadNthWordsOfAllLinesFromFile($fileName, $num)
+{
+  $loc = $num - 1;
+  if ($loc < 0) {
+   $loc = $num;
+  }
+  $handle = fopen($fileName, "r");
+  $retValue = array();
+  if ($handle) {
+    while (($buffer = fgets($handle, 4096)) !== false) {
+      $fullLine = explode(' ', $buffer);
+      array_push($retValue, trim($fullLine[$loc]));
+    }
+     
+    if (!feof($handle)) {
+      echo "Error: unexpected fgets() fail\n"; // TODO: Fix
+    }
+  }
+  return $retValue;
+}
+
+
+?>

+ 86 - 0
hmc/archive/playground/assignHosts.php

@@ -0,0 +1,86 @@
+<?php
+
+include 'dbLib.php';
+
+$requestdata = file_get_contents('php://input');
+// $obj = json_decode($requestdata, true);
+$obj = array(
+         "clusterName"=> "MyCluster-12345",
+         "ClusterDeployUser"=> "hortonva",
+         "ClusterDeployUserIdentityFile"=> "va_rsa",
+         "ClusterHostsFile"=> "../hostsFile.txt",
+         "InstallHBase"=> "false",
+         "InstallPig"=> "false",
+         "InstallHCatalog"=> "false",
+         "InstallTempleton"=> "false",
+         "InstallOozie"=> "false",
+         "InstallSqoop"=> "false",
+         "InstallLzo"=> "false",
+         );
+
+
+$clusterName = $obj['clusterName'];
+$clusterDir = getClusterDir($clusterName);
+$commitNodesScriptInputDir = $clusterDir."/commitNodesScriptInputDir/";
+$commitNodesScriptOutputDir = $clusterDir."/commitNodesScriptOutputDir/";
+
+// Hard code host and identity files for now
+$obj['ClusterDeployUserIdentityFile']="va_rsa";
+$obj['ClusterHostsFile']="hostsFile.txt";
+
+// write the input file to the node-suggestor
+$fp = fopen($commitNodesScriptInputDir."data.txt", 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$obj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.$commitNodesScriptInputDir.'/'.$obj['ClusterDeployUserIdentityFile']."\n");
+fwrite($fp, 'HDPClusterHostsFile='.$commitNodesScriptInputDir.'/'.$obj['ClusterHostsFile']."\n");
+fwrite($fp, 'HDPNameNodeHost='.$obj['nameNode']."\n");
+fwrite($fp, 'HDPSecondaryNameNodeHost='.$obj['secondaryNameNode']."\n");
+fwrite($fp, 'HDPJobTrackerHost='.$obj['jobTracker']."\n");
+fwrite($fp, 'HDPHBaseMasterHost='.$obj['hbaseMaster']."\n");
+fwrite($fp, 'HDPHCatalogServerHost='.$obj['hcatServer']."\n");
+fwrite($fp, 'HDPGangliaCollectorHost='.$obj['gangliaCollector']."\n");
+fwrite($fp, 'HDPNagiosServerHost='.$obj['nagiosServer']."\n");
+fwrite($fp, 'HDPOozieServerHost='.$obj['oozieServer']."\n");
+fwrite($fp, 'HDPTempletonNodeHost='.$obj['templetonNode']."\n");
+fclose($fp);
+
+$cmd = "/var/www/html/KickAssHDPUI/ShellScripts/generateNodeFiles.sh ".$commitNodesScriptInputDir."data.txt ".$commitNodesScriptOutputDir;
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+//print $cmd;
+//echo "'$handle'; " . gettype($handle) . "\n";
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  error_log($read, 3, "/tmp/errors.txt");
+}
+pclose($handle);
+
+function ReadAllFirstWordOfLinesFromFile ($fileName)
+{
+  $handle = fopen($fileName, "r");
+  $retValue = array();
+  if ($handle) {
+    while (($buffer = fgets($handle, 4096)) !== false) {
+      $fullLine = explode(' ', $buffer);
+      array_push($retValue, $fullLine[0]);
+    }
+     
+    if (!feof($handle)) {
+      echo "Error: unexpected fgets() fail\n"; // TODO: Fix
+    }
+  }
+  return $retValue;
+}
+
+$AllMountPoints = ReadAllFirstWordOfLinesFromFile($commitNodesScriptOutputDir."/NameNodeMountPointsSuggest.out");
+
+$outjson = array(
+            "allMountPoints"=> $AllMountPoints,
+           );
+
+header("Content-type: application/json");
+print (json_encode($outjson));
+//var_dump($AllHosts);
+//print "hello";
+//var_dump(json_encode($outjson));
+?>

+ 71 - 0
hmc/archive/playground/configureCluster.php

@@ -0,0 +1,71 @@
+<?php
+
+$requestdata = file_get_contents('php://input');
+$obj = json_decode($requestdata, true);
+
+$clusterName = $obj['clusterName'];
+$clusterDir = "/var/run/HDPClusters/".$clusterName."/";
+$commitNodesScriptInputDir = $clusterDir."/commitNodesScriptInputDir/";
+$commitNodesScriptOutputDir = $clusterDir."/commitNodesScriptOutputDir/";
+
+// Hard code host and identity files for now
+$obj['ClusterDeployUserIdentityFile']="va_rsa";
+$obj['ClusterHostsFile']="hostsFile.txt";
+
+// write the input file to the node-suggestor
+$fp = fopen($commitNodesScriptInputDir.'data.txt', 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$obj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.$commitNodesScriptInputDir.'/'.$obj['ClusterDeployUserIdentityFile']."\n");
+fwrite($fp, 'HDPClusterHostsFile='.$commitNodesScriptInputDir.'/'.$obj['ClusterHostsFile']);
+fwrite($fp, 'HDPNameNodeHost='.$obj['nameNode']);
+fwrite($fp, 'HDPSecondaryNameNodeHost='.$obj['secondaryNameNode']);
+fwrite($fp, 'HDPJobTrackerHost='.$obj['jobTracker']);
+fwrite($fp, 'HDPHBaseMasterHost='.$obj['hbaseMaster']);
+fwrite($fp, 'HDPHCatalogServerHost='.$obj['hcatServer']);
+fwrite($fp, 'HDPGangliaCollectorHost='.$obj['gangliaCollector']);
+fwrite($fp, 'HDPNagiosServerHost='.$obj['nagiosServer']);
+fwrite($fp, 'HDPOozieServerHost='.$obj['oozieServer']);
+fwrite($fp, 'HDPTempletonNodeHost='.$obj['templetonNode']);
+fwrite($fp, 'HDPdd='.$obj['templetonNode']);
+fclose($fp);
+
+$cmd = "/var/www/html/KickAssHDPUI/ShellScripts/generateNodeFiles.sh ".$commitNodesScriptInputDir."data.txt ".$commitNodesScriptOutputDir;
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+//print $cmd;
+//echo "'$handle'; " . gettype($handle) . "\n";
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  error_log($read, 3, "/tmp/errors.txt");
+}
+pclose($handle);
+
+function ReadAllFirstWordOfLinesFromFile ($fileName)
+{
+  $handle = fopen($fileName, "r");
+  $retValue = array();
+  if ($handle) {
+    while (($buffer = fgets($handle, 4096)) !== false) {
+      $fullLine = explode(' ', $buffer);
+      array_push($retValue, $fullLine[0]);
+    }
+     
+    if (!feof($handle)) {
+      echo "Error: unexpected fgets() fail\n"; // TODO: Fix
+    }
+  }
+  return $retValue;
+}
+
+$AllMountPoints = ReadAllFirstWordOfLinesFromFile($commitNodesScriptOutputDir."/NameNodeMountPointsSuggest.out");
+
+$outjson = array(
+            "allMountPoints"=> $AllMountPoints
+           );
+
+header("Content-type: application/json");
+print (json_encode($outjson));
+//var_dump($AllHosts);
+//print "hello";
+//var_dump(json_encode($outjson));
+?>

+ 3 - 0
hmc/archive/playground/data.txt

@@ -0,0 +1,3 @@
+HDPClusterDeployUser=hortonva
+HDPClusterDeployUserIdentityFile=/var/www/html/KickAssHDPUI/php/playground/input/va_rsa
+HDPClusterHostsFile=/var/www/html/KickAssHDPUI/php/playground/input/hostsFile.txt

+ 5 - 0
hmc/archive/playground/input/hostsFile.txt

@@ -0,0 +1,5 @@
+hrt12n15
+hrt12n16
+hrt12n17
+hrt12n18
+hrt12n19

+ 27 - 0
hmc/archive/playground/input/va_rsa

@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEoQIBAAKCAQEAnqbduaoHsTbFq73P4k5szw9ChRTIepauMt+D+DKb4ubqgGSl
+xE+YL6Ll5/qXWbIDwxkBMfWAbVhf/hJr4dcb7LbzhUwJUrDG7IJw+mUxZC2pNCmC
+Xvp4NUf1Wbz43GBNXtgK6Lxa2vbVL+4Rv+9xQC1AuATtLw5BnBzUW0BJIw/kUVZx
+qxWObof+gGHE07v6CLBMFmWvvEi2TylSvhewJBHZBUiVdEd2EqboG4optZPzg8ML
++YsYCLKL5CZJoIdaNxMawIxsIWiGhYRJLAdhkJ99DpsJJSy+/t7NtFfCCNHDrd6P
+TIOjVV4jcGgMHXzYFkBz/Qbv5tgkVZFnPwQ+/wIBIwKCAQA67YWOGpUkkK/SE002
+zKwSZMDvmgFSGrW7H9HueTKWG0EoX+XMkpecqjgi9q0+kpOu3WbYCrqsRWV7oHE2
+oFrUQ/QM8Fs7+IRmeZetdgsH87PgLKzEMSVVnmJxydjG4fDaFbrouv0swhSrZw3o
+NF1DuQlo6+MRelLiNpgEotlWKeOlICQES2mI3G3c4ocuQJt8nRkWgEdJctj01ojb
+NtkLcy8lZrP3bPn64Z08H6h+ra8c0nLX7BL4cJDGRHRm6Fuu5adiAnlEFLvs5bRX
+HVj9W459hb9gQCRAj6y6hZcb4ow+qVuaOwMO48N7kzDbguFkclymwL3zqW6L+meM
+DapzAoGBAMzy36BUssjPaYCycm54uDZIgfDXb69SYjFKSt7BoMc9YsH0uclbirAq
+LtQoQ8hLo8zRYF4Up3LJmysuz0KVf2r6NjTKytJEnMRnfnD2iOnIo+YJhBOYj7jN
+CFXykablmubWEAF+p4+As7N84pihSGNnRa/vFrn7GbmcmSg7oXGLAoGBAMYrvdLU
+q25puVYFF0zefTTTJPBRJnuQdjzn1+/VqCplZUldF9PhDYdYtjGMev48Q+zHP8d4
+LPwErT1kd1d/0W6NXug8pz+vWNvbTKPofjlsoqE8/aOJei5wU6a36Ek6mdlqLfmk
+xwuY4sQc+SsF1BXbn3vW1Zj5RQYFB0+eAu7dAoGATB+yJZvNYIeNljOm2JM9G3oE
+YMUMOc4keLUxwHPOANxJQLn73RNfZgEKFEl4QxTHz7t7kKiV9290JftxjcJ/yKYU
+Ijyxu9BXfCZwyt86KvLAiKRy4rUCLrKOEUt37Yh7XQ2uLHDfJqwlfS5iyvoTkqKz
+e9x2J9JLYjLZzR12eqECgYEAwIJDXxe8eeMLz+ewPAtVDr57p59J9GBy3BRrXgLA
+njac6C6MLOlAV5gBcfYuVg6oYlsoA5lQRUZfJbINiDMF9l1yI24e0CauF2dRw8vo
+VQpyGPlra6oe60iLxobEZGTP98Y7SkhMVGihxdMArXNgT79nuiEnRCVY/oiKwl77
+iPMCgYAJ3gv8vch8Tghn1xwcM2R5Ijmp1tyC4I7GcC6NyUVDhgNGtMJ8GyFA3U7u
+pi4wGEl5WjUNr1oZxcPRph54ZfIyLk1rP6HHadBph17WjBCMZcIFFF2kPh2Eb7Xf
+gw3YEt9up3lmKKXwU3+OnMkGU8yMhHjAUwXtTfrCZjx2BXjIsg==
+-----END RSA PRIVATE KEY-----

+ 7 - 0
hmc/archive/playground/mergeTest.php

@@ -0,0 +1,7 @@
+<?php
+$array1 = array("color" => "red", 2, 4);
+$array2 = array("a" => true, "b" => true, "color" => "green", "shape" => "trapezoid", 4);
+$result = array_merge($array1, $array2);
+print_r($result);
+?>
+

+ 60 - 0
hmc/archive/playground/nodessugg.php

@@ -0,0 +1,60 @@
+<?php
+
+// write the input file to the node-suggestor
+$fp = fopen('data.txt', 'w');
+fwrite($fp, 'HDPClusterDeployUser=root');
+fwrite($fp, 'HDPClusterDeployUserIdentityFile=/var/sshkey');
+fwrite($fp, 'HDPClusterHostsFile=/var/hosts');
+
+$cmd = "../ShellScripts/suggestNodes.sh data.txt ./";
+// invoke the node-suggstor
+$handle = popen($cmd, "r");
+
+fclose($fp);
+
+function ReadFile ($fileName)
+{
+  $fp = fopen($filename, "r");
+  $retval = fread($fp, filesize($filename));
+  fclose($fp);
+  return $retval;
+}
+
+// Read the output from the node-suggestor
+
+$filename = "NameNodeSuggest.out";
+$NameNodeSuggestOut = ReadFile($filename);
+
+$filename = "NameNodeMountPointsSuggest.out";
+$NameNodeMountPointsSuggestOut = ReadFile($filename);
+
+$filename = "SecondaryNameNodeSuggest.out";
+$SecondaryNameNodeSuggestOut = ReadFile($filename);
+
+$filename = "HBaseMasterSuggest.out";
+$HBaseMasterSuggestOut = ReadFile($filename);
+
+$filename = "JobTrackerSuggest.out";
+$JobTrackerSuggestOut = ReadFile($filename);
+
+$filename = "GatewaySuggest.out";
+$GatewaySuggestOut = ReadFile($filename);
+
+$filename = "HCatalogServerSuggest.out";
+$HCatalogServerSuggestOut = ReadFile($filename);
+
+$filename = "GangliaCollectorSuggest.out";
+$GangliaCollectorSuggestOut = ReadFile($filename);
+
+$filename = "NagiosServerSuggest.out";
+$NagiosServerSuggestOut = ReadFile($filename);
+
+$filename = "DashboardSuggest.out";
+$DashboardSuggestOut = ReadFile($filename);
+
+$filename = "OozieServerSuggest.out";
+$OozieServerSuggestOut = ReadFile($filename);
+
+$filename = "TempletonNodeSuggest.out";
+$TempletonNodeSuggestOut = ReadFile($filename);
+?>

+ 1 - 0
hmc/archive/playground/output/DashboardSuggest.out

@@ -0,0 +1 @@
+hrt12n18 29135 8 x86_64

+ 1 - 0
hmc/archive/playground/output/GangliaCollectorSuggest.out

@@ -0,0 +1 @@
+hrt12n17 29751 8 x86_64

+ 1 - 0
hmc/archive/playground/output/GatewaySuggest.out

@@ -0,0 +1 @@
+hrt12n15 28874 8 x86_64

+ 1 - 0
hmc/archive/playground/output/HBaseMasterSuggest.out

@@ -0,0 +1 @@
+hrt12n19 29705 8 x86_64

+ 1 - 0
hmc/archive/playground/output/HCatalogServerSuggest.out

@@ -0,0 +1 @@
+hrt12n16 29850 8 x86_64

+ 5 - 0
hmc/archive/playground/output/HostDiscovery.out

@@ -0,0 +1,5 @@
+hrt12n15 28874 8 x86_64
+hrt12n16 29850 8 x86_64
+hrt12n17 29751 8 x86_64
+hrt12n18 29135 8 x86_64
+hrt12n19 29705 8 x86_64

+ 1 - 0
hmc/archive/playground/output/JobTrackerSuggest.out

@@ -0,0 +1 @@
+hrt12n18 29135 8 x86_64

+ 1 - 0
hmc/archive/playground/output/NagiosServerSuggest.out

@@ -0,0 +1 @@
+hrt12n19 29705 8 x86_64

+ 4 - 0
hmc/archive/playground/output/NameNodeMountPointsSuggest.out

@@ -0,0 +1,4 @@
+/grid/0
+/grid/1
+/grid/2
+/grid/3

+ 1 - 0
hmc/archive/playground/output/NameNodeSuggest.out

@@ -0,0 +1 @@
+hrt12n16 29850 8 x86_64

+ 1 - 0
hmc/archive/playground/output/OozieServerSuggest.out

@@ -0,0 +1 @@
+hrt12n15 28874 8 x86_64

+ 1 - 0
hmc/archive/playground/output/SecondaryNameNodeSuggest.out

@@ -0,0 +1 @@
+hrt12n17 29751 8 x86_64

+ 1 - 0
hmc/archive/playground/output/TempletonNodeSuggest.out

@@ -0,0 +1 @@
+hrt12n16 29850 8 x86_64

+ 120 - 0
hmc/archive/playground/readFromProps.php

@@ -0,0 +1,120 @@
+<?php
+
+$inputBaseDir = "/var/www/html/KickAssHDPUI/php/playground/input";
+$outputBaseDir = "/var/www/html/KickAssHDPUI/php/playground/output";
+
+// Read from the input
+/*
+$uploadDir = '/var/www/uploads/';
+$identifyFile = $uploadDir . basename($_FILES['ClusterDeployUserIdentityFile']['name']);
+$hostsFile = $uploadDir . basename($_FILES['ClusterHostsFile']['name']);
+echo '<pre>';
+if (move_uploaded_file($_FILES['ClusterDeployUserIdentityFile']['tmp_name'], $identifyFile)) {
+    echo "File is valid, and was successfully uploaded.\n";
+} else {
+    echo "Possible file upload attack!\n";
+}
+
+echo 'Here is some more debugging info:';
+print_r($_FILES);
+
+print "</pre>";
+*/
+
+$json = '{
+         "ClusterDeployUser": "hortonva",
+         "ClusterDeployUserIdentityFile": "va_rsa",
+         "ClusterHostsFile": "hostsFile.txt",
+         "InstallHBase": "false",
+         "InstallPig": "false",
+         "InstallHCatalog": "false",
+         "InstallTempleton": "false",
+         "InstallOozie": "false",
+         "InstallSqoop": "false",
+         "InstallLzo": "false"
+         }';
+/*
+$json = '{"foo-bar": 12345,
+        "one-more":"4567"
+        }';
+*/
+$obj = json_decode($json, true);
+//var_dump($obj);
+//print $obj['ClusterDeployUser']; // 12345
+//print $obj->{'one-more'}
+
+// write the input file to the node-suggestor
+$fp = fopen('data.txt', 'w');
+fwrite($fp, 'HDPClusterDeployUser='.$obj['ClusterDeployUser']."\n");
+fwrite($fp, 'HDPClusterDeployUserIdentityFile='.$inputBaseDir.'/'.$obj['ClusterDeployUserIdentityFile']."\n");
+fwrite($fp, 'HDPClusterHostsFile='.$inputBaseDir.'/'.$obj['ClusterHostsFile']);
+fclose($fp);
+
+$cmd = "/var/www/html/KickAssHDPUI/ShellScripts/suggestNodes.sh data.txt ".$outputBaseDir;
+//$cmd = "/bin/ls -lR /etc";
+// invoke the node-suggstor
+$handle = popen($cmd, "r");
+// Do some checks on return status: TODO
+print $cmd;
+echo "'$handle'; " . gettype($handle) . "\n";
+while (!feof($handle)) {
+  $read = fread($handle, 2096);
+  //echo $read;
+}
+pclose($handle);
+
+function ReadHostNameFromFile ($fileName)
+{
+  $fp = fopen($fileName, "r");
+  $retval = fread($fp, filesize($fileName));
+  $retval = explode(' ', $retval);
+  fclose($fp);
+  return $retval[0];
+}
+
+function ReadAllHostNamesFromFile ($fileName)
+{
+  $handle = fopen($fileName, "r");
+  $retValue = array();
+  if ($handle) {
+    while (($buffer = fgets($handle, 4096)) !== false) {
+      $fullLine = explode(' ', $buffer);
+      array_push($retValue, $fullLine[0]);
+    }
+     
+    if (!feof($handle)) {
+      echo "Error: unexpected fgets() fail\n";
+    }
+  }
+  return $retValue;
+}
+
+// Read the output from the node-suggestor
+
+$NameNodeSuggestOut = ReadHostNameFromFile($outputBaseDir."/NameNodeSuggest.out");
+$NameNodeMountPointsSuggestOut = ReadHostNameFromFile($outputBaseDir."/NameNodeMountPointsSuggest.out");
+$SecondaryNameNodeSuggestOut = ReadHostNameFromFile($outputBaseDir."/SecondaryNameNodeSuggest.out");
+$HBaseMasterSuggestOut = ReadHostNameFromFile($outputBaseDir."/HBaseMasterSuggest.out");
+$JobTrackerSuggestOut = ReadHostNameFromFile($outputBaseDir."/JobTrackerSuggest.out");
+$GatewaySuggestOut = ReadHostNameFromFile($outputBaseDir."/GatewaySuggest.out");
+$HCatalogServerSuggestOut = ReadHostNameFromFile($outputBaseDir."/HCatalogServerSuggest.out");
+$GangliaCollectorSuggestOut = ReadHostNameFromFile($outputBaseDir."/GangliaCollectorSuggest.out");
+$NagiosServerSuggestOut = ReadHostNameFromFile($outputBaseDir."/NagiosServerSuggest.out");
+$DashboardSuggestOut = ReadHostNameFromFile($outputBaseDir."/DashboardSuggest.out");
+$OozieServerSuggestOut = ReadHostNameFromFile($outputBaseDir."/OozieServerSuggest.out");
+$TempletonNodeSuggestOut = ReadHostNameFromFile($outputBaseDir."/TempletonNodeSuggest.out");
+$AllHosts = ReadAllHostNamesFromFile($outputBaseDir."/HostDiscovery.out");
+
+$outjson = '{
+            "namenode": '.$NameNodeSuggestOut.',
+            "secondarynamenode": '.$SecondaryNameNodeSuggestOut.',
+            "jobtracker": '.$JobTrackerSuggestOut.',
+            "gangliacollector": '.$GangliaCollectorSuggestOut.',
+            "nagiosserver": '.$NagiosServerSuggestOut.',
+            "all": '.$AllHosts.'
+           }';
+
+//var_dump($AllHosts);
+//print "hello";
+var_dump(json_encode($outjson));
+?>

+ 15 - 0
hmc/archive/playground/rez.php

@@ -0,0 +1,15 @@
+<?php
+
+$requestdata = file_get_contents('php://input');
+
+error_log($requestdata, 3, "/tmp/rez.log");
+
+$requestjson = json_decode($requestdata, true);
+
+header("Content-type: application/json");
+
+$x = array( 'a' => 'b', 'c' => 'd', 'e' => array(1,2,3) );
+
+print(json_encode($x));
+
+?>

+ 11 - 0
hmc/archive/playground/testing.php

@@ -0,0 +1,11 @@
+<?php
+$outjson = '{
+            "namenode": '.$namenodesuggestout.',
+            "secondarynamenode": $secondarynamenodesuggestout,
+            "jobtracker": $jobtrackersuggestout,
+            "gangliacollector": $gangliacollectorsuggestout,
+            "nagiosserver": $nagiosserversuggestout
+           }';
+
+print json_encode($outjson);
+?>

+ 25 - 0
hmc/conf/hmc.conf

@@ -0,0 +1,25 @@
+# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
+# Last Modified: 11-26-2005
+#
+# This file contains examples of entries that need
+# to be incorporated into your Apache web server
+# configuration file.  Customize the paths, etc. as
+# needed to fit your system.
+
+Alias /hmc "/usr/share/hmc"
+
+#<Directory "/usr/share/hmc">
+##  SSLRequireSSL
+#   Options None
+#   AllowOverride None
+#   Order allow,deny
+#   Allow from all
+##  Order deny,allow
+##  Deny from all
+##  Allow from 127.0.0.1
+#   AuthName "HMC Access"
+#   AuthType Basic
+#   AuthUserFile /etc/hmc/htpasswd.users
+#   Require valid-user
+#</Directory>
+#

+ 5 - 0
hmc/cpp/foo.sh

@@ -0,0 +1,5 @@
+#!/bin/bash 
+
+sleep 100s;
+
+

+ 21 - 0
hmc/cpp/runscriptasroot.c

@@ -0,0 +1,21 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int main(int argc, char** argv)
+{
+   if (argc != 2) {
+     exit(-1);
+   }
+
+   setuid(0);
+
+   pid_t pid = fork();
+
+   if ( pid == 0 ) {
+     // execute command in child
+     return system(argv[1]);
+   }
+   return 0;
+}

+ 27 - 0
hmc/css/clusters.css

@@ -0,0 +1,27 @@
+#clustersNavigationLinksDivId {
+  width: 100%;
+  text-align: center;
+  margin: 0px auto;
+  margin-bottom: 8px;
+}
+
+#clustersNavigationLinksListId {
+  margin:0;
+  padding:0;
+  text-align:center;
+  height:50px;
+}
+
+#clustersNavigationLinksListId li {
+  display: inline-block;
+  width: auto;
+  padding: 5px;
+  margin: 2px;
+  cursor: default;
+}
+
+#clustersHostRoleMappingFieldsetId {
+  margin-left: auto;
+  margin-right: auto;
+  width: 300px;
+}

+ 247 - 0
hmc/css/common.css

@@ -0,0 +1,247 @@
+header, footer, aside, nav, article, section {display: block;}
+header {
+        height:100px;
+        background-color:white;
+        font-size:300%;
+}
+
+body { 
+  font:13px/1.231 Helvetica,Arial,sans-serif;
+  *font-size:small; 
+  margin: 0 auto;
+  min-width: 1024px;
+  font-size: 75%;
+  color: #454545;
+  overflow:auto;
+}
+
+h1 {
+  font-size: 175%; 
+  font-weight: bolder; 
+  text-align: center; 
+}
+
+header img {
+        height:93px;
+        width:241px;
+        float:left;
+}
+#headerText {
+        font-weight:bold;
+        padding:30px 0 0 0;
+}
+
+header, footer {
+      text-align:center;
+      }
+
+a:link {
+  color: blue;
+}
+
+a:visited {
+  color: blue;
+}
+
+input[type="text"], input[type="checkbox"] {
+  /*
+  -webkit-box-shadow:0 0 2px #666 inset;
+  -moz-box-shadow:0 0 2px #666 inset;
+  box-shadow:0 0 2px #666 inset;
+  */
+  border: 1px solid #B2B299;
+  height:25px;
+  line-height:25px;
+  vertical-align: top;
+  horizontal-align: center;
+  /* padding: 5; */
+  text-indent: 5px;
+
+  /*
+  background-color:#F4F4F4;
+  */
+  background-color:white;
+
+  /* Color transition */
+  transition: background-color 1s linear;
+  -moz-transition: background-color 1s linear;    /* FF3.7+ */
+  -o-transition: background-color 1s linear;      /* Opera 10.5 */
+  -webkit-transition: background-color 1s linear; /* Saf3.2+, Chrome */
+}
+
+input[type="text"]:hover, input[type="text"]:focus {
+  background-color:#CBF76F;
+}
+
+select {
+  width:250px;
+  background-color:#DBDBDB;
+}
+
+#blackScreenDivId, #loadingBlackScreenDivId {
+  position:fixed;
+  background-color:black;
+  opacity:0.7;
+  height:100%;
+  width:100%;
+  top:0px;
+  left:0px;
+}
+
+#loadingImgId {
+  /*
+  margin-left: auto;
+  margin-right: auto;
+  */
+  position: fixed; 
+  left: 50%; 
+  top: 50%;
+  width: 100px;
+  height: 100px;
+  margin-top: -50px;
+  margin-left: -50px;
+}
+
+#installationWizardDivId {
+
+ /* The following three lines to auto-adjust height
+  min-height:500px;
+  height:auto !important;
+  height:500px; 
+  */
+
+  /*
+  overflow: auto;
+  */
+  margin-left:auto;
+  margin-right:auto;
+  /*max-height:500px;*/
+  border:1px; /*solid;*/
+  background-color:#FFF;
+  padding:20px;
+  width:1000px;
+}
+
+#installationSideBarDivId {
+  display:block;
+  float:left;
+}
+
+#installationMainFormsDivId {
+  /* border:1px solid; */
+  margin-top: 8px;
+  display:block;
+}
+
+#displayLogsContentDivId {
+  /* scroll box */
+  height: 500px;
+  width: 600px;
+  padding: 5px;
+  background-color: white;
+  overflow: auto;
+}
+
+table {
+  width:80%;
+  margin-left:auto;
+  margin-right:auto;
+  padding-left:20px;
+  font-size:1em;
+  cellspacing:10px;
+  cellpadding:10px;
+  /*
+  background-color:#F4F4F4;
+  */
+  border:1px solid #DBDBDB ;
+
+}
+
+caption {
+  font-weight:bold;
+  font-size:1.3em;
+  padding:10px;
+  color:green;
+}
+
+thead {
+  font-size:1.2em;
+  font-weight:bold;
+  /*
+  */
+  color:white;
+  background-color: #00CC00;
+  /*
+  color: green;
+  background-color: #33CC33;
+  background-color: #DBDBDB;
+  background-color: #BF3030;
+  */
+  border-bottom:1px solid #7A7A7A ;
+}
+
+thead tr {
+}
+
+thead tr:hover {
+}
+
+th {
+  padding:10px;
+}
+
+tr {
+  /* 
+  height:30px;
+  opacity:0.75;
+  */
+
+  /* Color transition */
+  transition: background-color 1s cubic-bezier(.09, .99, .37, .98);
+  -moz-transition: background-color 1s cubic-bezier(.09, .99, .37, .98);    /* FF3.7+ */
+  -o-transition: background-color 1s cubic-bezier(.09, .99, .37, .98) ;      /* Opera 10.5 */
+  -webkit-transition: background-color 1s cubic-bezier(.09, .99, .37, .98) ; /* Saf3.2+, Chrome */
+}
+
+tr:hover {
+  background-color: #DBDBDB;
+  /* 
+  background-color: #33CC33;
+  */
+  height:30px;
+  /* 
+  opacity:1.0;
+  */
+}
+
+td {
+  padding:10px;
+}
+
+.formElement {
+  margin:3px;
+  overflow:auto;
+  border:1px solid #F0F0E8;
+}
+
+.formElement:hover {
+  border:1px solid #B2B299;
+}
+
+.contextualHelp {
+  margin-left:10px;
+  width:300px;
+  display:inline-block;
+  visibility:hidden;
+}
+
+.formElement:hover .contextualHelp {
+  visibility:visible;
+}
+
+.pageSummary {
+  font-weight:bold;
+  margin:5px;
+  margin-bottom:15px;
+  font-size:larger;
+}

+ 161 - 0
hmc/css/common2.css

@@ -0,0 +1,161 @@
+hr {
+  clear:both;
+  color: #FFF;
+}
+
+/*
+fieldset {
+  border:1px solid;
+  border-color:#E5E5E5 #DBDBDB #D2D2D2;
+  border-radius:6px;
+  -moz-border-radius:6px;
+  -webkit-border-radius:6px;
+  box-shadow:0 1px 2px rgba(0,0,0,.3);
+  -moz-box-shadow:0 1px 2px rgba(0,0,0,.3);
+  -webkit-box-shadow:0 1px 2px rgba(0,0,0,.3);
+  background-color:#FFF;
+  padding:20px;
+}
+*/
+fieldset { 
+  padding: 1em;
+  border:1px solid #B2B299 ;
+  /*background-color:#F4F4F4;*/
+  background-color:#F0F0E8;
+}
+
+legend {
+  padding: 0.2em 0.5em;
+/*  border:1px solid #DBDBDB ;*/
+  color:green;
+  font-size:120%;
+  text-align:right;
+/*  background-color:#FFFFFF; 
+  border:1px solid #00CC00 ;
+*/
+}
+
+/*
+.submitButton {
+*/
+  /* Dead code...
+  border:1px solid;
+  border-color:#E5E5E5 #DBDBDB #D2D2D2;
+  border-radius:6px;
+  -moz-border-radius:6px;
+  -webkit-border-radius:6px;
+  box-shadow:0 1px 2px rgba(0,0,0,.3);
+  -moz-box-shadow:0 1px 2px rgba(0,0,0,.3);
+  -webkit-box-shadow:0 1px 2px rgba(0,0,0,.3);
+  background: -moz-linear-gradient(#00CC00, #99D3F7) repeat scroll 0 0 transparent;
+  */
+/*
+  background-color: #00CC00;
+  border-radius:5px;
+  border: 0px;
+  height:30px;
+  color:white;
+  float:right;
+  font-size:1.2em;
+  padding:5px;
+  margin-top:5px;
+  margin-bottom:5px;
+
+*/
+  /* Color transition */
+/*
+  transition: background-color 1s linear;
+  -moz-transition: background-color 1s linear; */   /* FF3.7+ */
+ /* -o-transition: background-color 1s linear; */     /* Opera 10.5 */
+ /* -webkit-transition: background-color 1s linear; *//* Saf3.2+, Chrome */
+/*
+}
+*/
+
+.submitButton:hover {
+  background-color:#00CC00;
+  cursor:pointer;
+  border:1px solid green;
+  color:white;
+}
+
+.submitButton {
+  -moz-box-shadow:inset 0px 1px 20px -2px #caefab;
+  -webkit-box-shadow:inset 0px 1px 20px -2px #caefab;
+  box-shadow:inset 0px 1px 20px -2px #caefab;
+  background-color: #39E639;
+  -moz-border-radius:6px;
+  -webkit-border-radius:6px;
+  border-radius:6px;
+  border:1px solid grey;
+  color:black;
+  margin-top:6px;
+  margin-bottom:6px;
+  font-family:Arial;
+  font-size:14px;
+  font-weight:bold;
+  padding:6px 20px;
+  text-decoration:none;
+  float:right;
+}
+
+/*
+.submitButton:hover {
+  background-color:rgb(50,205,50);
+}
+  */
+
+.submitButton:active {
+  position:relative;
+  top:1px;
+}
+
+input[readonly] {
+  width:300px;
+  /*
+    color:green;
+  */
+  box-shadow:none;
+  border:0px;
+  background-color:#F0F0E8;
+  vertical-align:top;
+}
+
+label {
+  clear:left;
+  float:left;
+  width:45%;
+  margin-right:0.5em;
+  padding-top:0.2em;
+  text-align:right;
+}
+
+
+/*
+ul {
+*/
+/*
+clear:left;
+  margin-left:50%;
+*/
+/*
+  float:left;
+  padding-bottom:0.8em;
+  width:45%;
+  text-align:left;
+}
+*/
+
+#formElement {
+  height: 35px;
+}
+
+/*
+label {
+  display: block;
+  width: 100px;
+  float: left;
+  margin: 2px 4px 6px 4px;
+  text-align: right;
+}
+*/

+ 267 - 0
hmc/css/common3.css

@@ -0,0 +1,267 @@
+span.installationWizardStageNumber {
+  color: rgb(157,157,157);
+  /*
+  color: white;
+  */
+  font-size: 20px;
+  font-weight: bold;
+  text-align: center;
+  width: 100%;
+  left: 1px;
+  background-color: transparent;
+  background-image: none;
+  background-repeat: repeat;
+  background-attachment: scroll;
+  background-position: 0% 0%;
+  background-clip: border-box;
+  background-origin: padding-box;
+  background-size: auto auto;
+}
+
+#installationWizardProgressBarDivId {
+  width: 100%;
+  text-align: center;
+  margin: 0px auto;
+  margin-bottom: 8px;
+}
+
+#installationWizardProgressBarListId {
+  margin:0;
+  padding:0;
+  text-align:center;
+  height:50px;
+}
+
+#installationWizardProgressBarListId li {
+  display: inline-block;
+  width: auto;
+  padding: 5px;
+  margin: 2px;
+  cursor: default;
+}
+
+.installationWizardUnvisitedStage, #installationWizardProgressBarListId li.installationWizardUnvisitedStage {
+  background-color: rgb(190,190,190);
+  color: white;
+}
+
+.installationWizardVisitedStage, #installationWizardProgressBarListId li.installationWizardVisitedStage {
+  background-color: grey;
+  color: rgb(50,205,50);
+  padding-top: 6px;
+  padding-bottom: 6px;
+  font-weight:bold;
+  font-size: 12px;
+  border-radius:4px;
+  -moz-border-radius:4px;
+  -webkit-border-radius:4px;
+  cursor: pointer;
+}
+
+.installationWizardCurrentStage, #installationWizardProgressBarListId li.installationWizardCurrentStage {
+  background-color: rgb(50,205,50);
+  color: white;
+  margin: 8px;
+  padding-top: 8px;
+  padding-bottom: 8px;
+  font-weight:bolder;
+  font-size: 14px;
+  -webkit-box-shadow: 3px 3px 3px 4px #ccc;
+  -moz-box-shadow: 3px 3px 3px 4px #ccc;
+  box-shadow: 3px 3px 3px 4px #ccc;
+  border-radius:4px;
+  -moz-border-radius:4px;
+  -webkit-border-radius:4px;
+}
+
+#txnProgressStatesListId li div {
+  height: 2em;
+  color: black;
+  border-style: solid;
+  border-width: 2px;
+
+  background-color:#F0F0E8;
+  /*
+  background-color: #c5c5c5;
+  background-color:white;
+  background-color:#F0F0E8;
+  */
+  text-align: center;
+  margin-bottom: 10px;
+  border-radius:4px;
+  -moz-border-radius:4px;
+  -webkit-border-radius:4px;
+  padding-top: 1em;
+  font-size: larger;
+}
+
+.txnProgressStateDone {
+  border-color: rgb(50,205,50);
+  background-image: url(../images/green_check.png);
+  background-repeat: no-repeat;
+  background-position: 95% center;
+  /*background-size: contain;*/
+  background-size: 24px 24px;
+}
+
+.txnProgressStateInProgress {
+  /*border-color: #FFDF00;*/
+  border-color: #FA6A0C;
+  /*text-decoration: blink;*/
+  /*color: #FFDF00;*/
+  background-image: url(../images/orange-loader.gif);
+  background-repeat: no-repeat;
+  background-position: 95% center;
+  /*background-size: contain;*/
+  background-size: 24px 24px;
+}
+
+.txnProgressStateError {
+  border-color: #F53907;
+  background-image: url(../images/red_cross.png);
+  background-repeat: no-repeat;
+  background-position: 95% center;
+  /*background-size: contain;*/
+  background-size: 24px 24px;
+}
+
+.txnProgressStatePending {
+  border-color: gray;
+  color: gray;
+}
+
+.logEntry {
+  border:1px solid #B2B299 ;
+  background-color:#F0F0E8;
+  margin:30px;
+}
+
+.logEntryHeader {
+  font-weight:bold;
+  font-size:larger;
+  background-color:#B2B299;
+  color:white;
+}
+
+.logEntryBody {
+  padding:5px;
+}
+
+.formStatusBar {
+  width: auto;
+  /*height: 2em;*/
+  border-style: solid;
+  border-width: 2px;
+  border-radius:2px;
+  -moz-border-radius:2px;
+  -webkit-border-radius:2px;
+  padding-top: 4px;
+  padding-bottom: 4px;
+  font-size: larger;
+  text-align: center;
+}
+
+.formStatusBarZeroOpacity {
+  visibility: hidden;
+  opacity: 0;
+  transition: visibility 0s 5s, opacity 3s linear;
+  -moz-transition: visibility 0s 5s, opacity 3s linear;
+}
+
+#txnProgressCoreDivId {
+  width:50%;
+  top:30%; 
+  left:0px;
+  margin-left:25%;
+
+  /* Float above all else*/
+  z-index:15;
+  position:absolute;
+
+  /* Leave some space at the bootom for long progress-lists */
+  padding-bottom:100px;
+}
+
+#txnProgressFieldSetId {
+  width:auto;
+  background-color:white;
+  border-radius:0px 0px 15px 15px;
+}
+
+.statusOk {
+  border-color: rgb(50,205,50);
+/*  color: rgb(50,205,50); */
+  background-color: #85EEA8;
+}
+
+.statusError {
+  border-color: #F53907;
+/*  color: #F53907; */
+  background-color: #F17879;
+}
+
+/* Add a scrollbar only to the body of the YUI Panel, keeping the locations of
+ * the Header and Footer fixed (and always visible).
+ */
+#informationalPanelContainerDivId .yui3-widget-bd {
+  overflow: auto;
+  background-color:#F0F0E8;
+}
+
+#informationalPanelContainerDivId .yui3-widget-hd {
+ /* background-color:#B2B299; */
+  background-color:#33CCFF;
+}
+
+#informationalPanelContainerDivId .yui3-widget-ft {
+  background-color:#F0F0E8;
+}
+
+#informationalPanelContainerDivId .yui3-widget-ft .yui3-button {
+  color:blue;
+  font-weight:normal;
+}
+
+#confirmationDataPanelBodyContent {
+  font-size:larger;
+}
+
+#manageServicesDisplayDepsOnAction {
+  margin-top:30px;
+}
+
+.loadingImg {
+  display: block;
+  margin: auto;
+}
+
+.centered {
+  position: fixed; 
+  left: 50%; 
+  top: 50%;
+}
+
+#configureClusterInputContainerDivId {
+  float:left;
+  width:40%;
+  margin-left: 10%;
+  margin-right:10px;
+}
+
+#configureClusterDisplayDivId {
+  float:left;
+  width:40%;
+  opacity: 0.7;
+  margin-left:10px;
+}
+
+.formInputError, input[type="text"].formInputError {
+  border-color: #F53907;
+  background-color: #F17879;
+}
+
+.formInputErrorReason {
+  display: inline-block;
+  margin-left: 10px;
+  color: red;
+}

+ 143 - 0
hmc/css/manageServices.css

@@ -0,0 +1,143 @@
+#serviceManagementCoreDivId {
+  width: 500px;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.serviceManagementGroup {
+  font-size:20px;
+  margin:50px;
+}
+
+.serviceManagementEntry {
+  /* Reznor's
+  margin-top: 8px;
+  margin-bottom: 8px;
+  */
+  margin-top: 10px;
+  margin-bottom: 10px;
+  padding: 10px;
+  border-style: solid;
+  border-width: 2px;
+  /* Reznor's background-color: #c5c5c5; */
+  background-color:#F0F0E8;
+  border:color:#B2B299;
+  border-radius:4px;
+  -moz-border-radius:4px;
+  -webkit-border-radius:4px;
+}
+
+.serviceManagementEntry:hover {
+  background-color: #B2B299;
+  color: white;
+}
+
+.serviceManagementEntry:hover a {
+  color: white;
+}
+
+.serviceManagementEntryStarted {
+  color: green;
+}
+
+.serviceManagementEntryStopped {
+  color:red;
+}
+
+.serviceManagementEntryInstalled {
+  color: green;
+}
+
+.serviceManagementEntryUninstalled {
+  color:red;
+  opacity: 0.3;
+
+  /* Make links within .serviceManagementEntryUninstalled not look like links. */
+  pointer-events: none;
+  cursor: text;
+}
+
+.serviceManagementEntry a {
+  color: black;
+}
+
+.serviceManagementEntryNameContainer {
+  /* Reznor's
+  font-weight: bold;
+  font-size: 20px;
+  */
+  font-size: 15px;
+}
+
+.serviceManagementEntryName {
+  display:inline-block;
+  border:0px solid black;
+  width:200px;
+ 
+/* Temporarily make links within .serviceManagementEntryName not look like links. */
+  pointer-events: none;
+  text-decoration: none;
+  cursor: text;
+}
+
+
+.serviceManagementEntryStateContainer {
+  display:inline-block;
+  font-size:15px;
+  margin-left:0px;
+  border:0px solid black;
+}
+
+.serviceManagementEntryActionsContainer {
+  float: right;
+}
+
+.serviceManagementEntryAction {
+  background-size: 24px 24px;
+  display: inline-block;
+  height: 24px;
+  width: 24px;
+  margin-left: 7px;
+  margin-right: 7px;
+}
+
+.serviceManagementEntryActionStart {
+  background-image: url(../images/start.png);
+}
+
+.serviceManagementEntryActionStop {
+  background-image: url(../images/stop.png);
+}
+
+.serviceManagementEntryActionReconfigure {
+  background-image: url(../images/reconfigure.png);
+}
+
+#serviceManagementGlobalActionsDivId {
+  width: 316px; 
+  margin-left: auto;
+  margin-right: auto; 
+}
+
+#serviceManagementGlobalActionsDivId button {
+  border-style: solid;
+  border-width: 3px;
+  background-color: #c5c5c5;
+  border-color: #ee5701;
+  border-radius:4px;
+  -moz-border-radius:4px;
+  -webkit-border-radius:4px;
+  padding: 5px;
+  text-align: center;
+  width: 150px;
+  font-weight: bold;
+  font-size: 16px;
+  margin-left: 3px;
+  margin-right: 3px;
+}
+
+#serviceManagementGlobalActionsDivId button:hover {
+  color: white;
+  background-color: gray;
+  cursor: pointer;
+}

+ 143 - 0
hmc/css/selectHosts.css

@@ -0,0 +1,143 @@
+#serviceMastersLinksDivId {
+  width:40%;
+  float:left;
+}
+
+.aServiceMasterLink {
+  display:block;
+  border: 1px solid #B2B299;
+  clear:left;
+  float: left;
+  width:100%;
+  height:35px;
+  background-color: #DBDBDB;
+  color:white;
+  margin-bottom:15px;
+}
+
+.aServiceMasterLinkVisited {
+  display:block;
+  border: 1px solid #B2B299;
+  clear:left;
+  float: left;
+  width:100%;
+  height:35px;
+  background-color: green;
+  color:white;
+  margin-bottom:15px;
+  font-weight:bold;
+}
+
+#nodeGroupsCoreDivId {
+  border: 1px solid #B2B299;
+  float:left;
+  width:100%;
+}
+
+#nodeListDynamicId {
+  border: 1px solid #B2B299;
+  text-align:center;
+  /* display:inline-block; */
+}
+
+#nodeGroupsTable {
+  margin:5px;
+  overflow:auto;
+}
+
+.nodeGroupTitle {
+  font-weight:bold;
+  font-size:1.2em;
+  padding:5px;
+  background-color:#B2B299;
+  color:white;
+}
+
+.nodeList {
+  display:block;
+  margin:5px;
+  width:40%;
+  margin-left:50%;
+}
+
+.aNodeGroup {
+  /*overflow:auto;*/
+  padding:10px;
+  width:40%;
+  float:left;
+}
+
+.slotBucket {
+  margin:5px;
+  display:block;
+  float:left;
+}
+
+.slotTitle {
+  display:block;
+}
+
+.slot {
+  border: 1px solid #B2B299;
+  min-height:50px;
+
+  /* Color transition */
+  transition: background-color 1s cubic-bezier(.09, .99, .37, .98);
+  -moz-transition: background-color 1s cubic-bezier(.09, .99, .37, .98);    /* FF3.7+ */
+  -o-transition: background-color 1s cubic-bezier(.09, .99, .37, .98) ;      /* Opera 10.5 */
+  -webkit-transition: background-color 1s cubic-bezier(.09, .99, .37, .98) ; /* Saf3.2+, Chrome */
+}
+
+.slotHover {
+  border: 1px solid #B2B299;
+  min-height:50px;
+ /* background-color: #00CC00; */
+  background-color:#F0F0E8;
+}
+
+.yui3-dd-drop-over {
+ /* background-color: #00CC00; */
+  background-color:#F0F0E8;
+}
+
+.masterDiv {
+  border: 1px solid green;
+  margin: 3px;
+  padding: 3px;
+  cursor:move;
+  /* background-color: #00CC00; */
+  background-color: rgb(50,205,50);
+  border-radius:4px 4px 4px 4px;
+  color:white;
+  font-weight:bold;
+}
+
+#selectServiceMastersSubmitButtonId {
+  clear:both;
+}
+
+.nodeAssignmentWrapper {
+  display:block;
+  padding:3px;
+
+  /* Color transition */
+  transition: background-color 0.5s cubic-bezier(.09, .99, .37, .98);
+  -moz-transition: background-color 0.5s cubic-bezier(.09, .99, .37, .98);    /* FF3.7+ */
+  -o-transition: background-color 0.5s cubic-bezier(.09, .99, .37, .98) ;      /* Opera 10.5 */
+  -webkit-transition: background-color 0.5s cubic-bezier(.09, .99, .37, .98) ; /* Saf3.2+, Chrome */
+}
+
+.nodeAssignmentWrapperHover {
+  display:block;
+  padding:3px;
+  /* background-color: #00CC00; */
+  background-color: #F0F0E8;
+}
+
+.nodeAssignment {
+  display:inline-block;
+}
+
+.nodeAssignmentHover {
+  display:inline-block;
+}

+ 448 - 0
hmc/db/schema.dump

@@ -0,0 +1,448 @@
+BEGIN TRANSACTION;
+
+CREATE TABLE  "Clusters" (
+  cluster_name TEXT, -- Cluster name
+  version TEXT, -- version of the hadoop stack installed
+  state TEXT, -- cluster state - installed, config in progress etc
+  PRIMARY KEY (cluster_name)
+);
+
+CREATE TABLE  "Services" (
+  id INTEGER,
+  service_name TEXT, -- Service name
+  description TEXT, -- Service description
+  display_name TEXT, -- Display name
+  attributes BLOB, -- Per-Service attributes stored as a JSON serialized string conforming to
+                   -- the following schema:
+                   --
+                   -- { "runnable": boolean, "mustInstall": boolean, "editable": boolean, "noDisplay": boolean }
+                   --     where:
+                   --
+                   --     "runnable": true for services like Sqoop and Pig that don't have any
+                   --                 running components, and can thus not be started/stopped.
+                   --     "mustInstall": true for services that MUST be installed on a cluster,
+                   --                    with no option for the user to say otherwise.
+                   --     "editable": false for services like ZooKeeper whose selectability
+                   --                 cannot be edited, and is instead controlled completely by
+                   --                 our internal needs.
+                   --     "noDisplay": true for services that shouldn't be displayed in the UI.
+  PRIMARY KEY (id),
+  UNIQUE (service_name)
+);
+
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "HDFS", "HDFS", '{ "runnable": true, "mustInstall": true, "editable": false, "noDisplay": false }', "Apache Hadoop Distributed File System" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "MAPREDUCE", "MapReduce", '{ "runnable": true, "mustInstall": true, "editable": false, "noDisplay": false }', "Apache Hadoop Distributed Processing Framework" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "ZOOKEEPER", "ZooKeeper", '{ "runnable": true, "mustInstall": false, "editable": false, "noDisplay": false }', "Centralized Service for Configuration Management and Distribution Synchronization" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "HBASE", "HBase", '{ "runnable": true, "mustInstall": false, "editable": true, "noDisplay": false }',  "Apache HDFS-based Non-relational Distributed Database" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "PIG", "Pig", '{ "runnable": false, "mustInstall": false, "editable": true, "noDisplay": false }',  "Platform for Analyzing Large Data Sets" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "SQOOP", "Sqoop", '{ "runnable": false, "mustInstall": false, "editable": true, "noDisplay": false }',  "Tool for transferring bulk data between Apache Hadoop and structured datastores such as relational databases" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "OOZIE", "Oozie", '{ "runnable": true, "mustInstall": false, "editable": true, "noDisplay": false }',  "Workflow/Coordination system to manage Apache Hadoop jobs" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "HIVE", "Hive", '{ "runnable": true, "mustInstall": false, "editable": true, "noDisplay": false }',  "Data Warehouse system for Apache Hadoop" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "HCATALOG", "HCatalog", '{ "runnable": false, "mustInstall": false, "editable": true, "noDisplay": false }',  "Table and Storage Management service for data created using Apache Hadoop" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "TEMPLETON", "Templeton", '{ "runnable": true, "mustInstall": false, "editable": true, "noDisplay": false }',  "Webservice APIs for Apache Hadoop" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "DASHBOARD", "Dashboard", '{ "runnable": true, "mustInstall": true, "editable": false, "noDisplay": false }',  "Monitoring Dashboard for HDP" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "NAGIOS", "Nagios", '{ "runnable": true, "mustInstall": true, "editable": false, "noDisplay": false }',  "Nagios-based Monitoring for HDP" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "GANGLIA", "Ganglia", '{ "runnable": true, "mustInstall": true, "editable": false, "noDisplay": false }',  "Ganglia-based Metrics Collection for HDP" );
+INSERT OR REPLACE INTO "Services" ( service_name, display_name, attributes, description ) VALUES
+  ( "MISCELLANEOUS", "Miscellaneous", '{ "runnable": false, "mustInstall": true, "editable": false, "noDisplay": true }',  "" );
+
+CREATE TABLE  "ServiceComponents" (
+  service_name TEXT, -- service name
+  component_name TEXT, -- component name
+  display_name TEXT, -- Component display name
+  description TEXT, -- component description
+  attributes BLOB, -- Per-ServiceComponent attributes stored as a JSON serialized string
+                   -- conforming to the following schema:
+                   --
+                   -- { "isMaster": boolean, "isClient": boolean }
+                   --     where:
+                   --
+                   --     "isMaster": true if this component plays the role of a master
+                   --                 for the service.
+                   --     "isClient": true if this component plays the role of a client
+                   --                 for the service.
+  PRIMARY KEY (component_name),
+  FOREIGN KEY (service_name) REFERENCES Services(service_name)
+);
+
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HDFS", "NAMENODE", "Namenode", '{ "isMaster": true, "isClient": false }', "Master server that manages the file system namespace and regulates access to files by clients" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HDFS", "SNAMENODE", "Secondary Namenode", '{ "isMaster": true, "isClient": false }', "Helper to the primary NameNode that is responsible for supporting periodic checkpoints of the HDFS metadata" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HDFS", "DATANODE", "Datanode", '{ "isMaster": false, "isClient": false }', "The slave for HDFS" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HDFS", "HDFS_CLIENT", "HDFS Client", '{ "isMaster": false, "isClient": true}', "Client component for HDFS" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "MAPREDUCE", "JOBTRACKER", "JobTracker", '{ "isMaster": true, "isClient": false }', "Central Master service that pushes work (MR tasks) out to available TaskTracker nodes in the cluster");
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "MAPREDUCE", "TASKTRACKER", "TaskTracker", '{ "isMaster": false, "isClient": false }', "The slave for MapReduce" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "MAPREDUCE", "MAPREDUCE_CLIENT", "MapReduce Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "ZOOKEEPER", "ZOOKEEPER_SERVER", "ZooKeeper Server", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "ZOOKEEPER", "ZOOKEEPER_CLIENT", "ZooKeeper Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HBASE", "HBASE_MASTER", "HBase Master", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HBASE", "HBASE_REGIONSERVER", "HBase Region Server", '{ "isMaster": false, "isClient": false }', "The slave for HBase" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HBASE", "HBASE_CLIENT", "HBase Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "PIG", "PIG_CLIENT", "Pig Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "SQOOP", "SQOOP_CLIENT", "Sqoop Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "OOZIE", "OOZIE_SERVER", "Oozie Server", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "OOZIE", "OOZIE_CLIENT", "Oozie Client", '{ "isMaster": false, "isClient": true }',  "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HIVE", "HIVE_MYSQL", "MySql Server for Hive", '{ "isMaster": false, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HIVE", "HIVE_SERVER", "Hive Server", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HIVE", "HIVE_CLIENT", "Hive Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "HCATALOG", "HCATALOG_CLIENT", "HCatalog Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "TEMPLETON", "TEMPLETON_SERVER", "Templeton Server", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "TEMPLETON", "TEMPLETON_CLIENT", "Templeton Client", '{ "isMaster": false, "isClient": true }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "DASHBOARD", "DASHBOARD", "Monitoring Dashboard", '{ "isMaster": false, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "NAGIOS", "NAGIOS_SERVER", "Nagios Server", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "GANGLIA", "GANGLIA_MONITOR_SERVER", "Ganglia Collector", '{ "isMaster": true, "isClient": false }', "" );
+INSERT OR REPLACE INTO "ServiceComponents" ( service_name, component_name, display_name, attributes, description ) VALUES
+  ( "GANGLIA", "GANGLIA_MONITOR", "Ganglia Slave", '{ "isMaster": false, "isClient": false }', "" );
+
+CREATE TABLE  "ServiceDependencies" (
+  from_service_name TEXT, -- service A depends on B
+  to_service_name TEXT, -- service B
+  PRIMARY KEY ( from_service_name, to_service_name ),
+  FOREIGN KEY (from_service_name) REFERENCES Services(service_name),
+  FOREIGN KEY (to_service_name) REFERENCES Services(service_name)
+);
+CREATE INDEX  svc_dep_index ON "ServiceDependencies" ( to_service_name );
+
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "MAPREDUCE" , "HDFS" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "HBASE" , "ZOOKEEPER" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "HBASE" , "HDFS" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "OOZIE" , "MAPREDUCE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "HCATALOG" , "HIVE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "HIVE" , "MAPREDUCE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "TEMPLETON" , "MAPREDUCE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "TEMPLETON" , "PIG" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "TEMPLETON" , "HIVE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "TEMPLETON" , "HCATALOG" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "TEMPLETON" , "ZOOKEEPER" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "PIG" , "MAPREDUCE" );
+INSERT OR REPLACE INTO "ServiceDependencies" ( from_service_name, to_service_name ) VALUES ( "SQOOP" , "MAPREDUCE" );
+-- todo need to add all dependencies
+
+CREATE TABLE  "ServiceComponentDependencies" (
+  from_component_name TEXT, -- component  A depends on B
+  to_component_name TEXT, -- component B
+  PRIMARY KEY ( from_component_name, to_component_name ),
+  FOREIGN KEY (from_component_name) REFERENCES ServiceComponents(component_name),
+  FOREIGN KEY (to_component_name) REFERENCES ServiceComponents(component_name)
+);
+CREATE INDEX  component_dep_index ON "ServiceComponentDependencies" ( to_component_name );
+
+INSERT OR REPLACE INTO "ServiceComponentDependencies" ( from_component_name, to_component_name ) VALUES ( "DATANODE", "NAMENODE" );
+INSERT OR REPLACE INTO "ServiceComponentDependencies" ( from_component_name, to_component_name ) VALUES ( "SNAMENODE", "NAMENODE" );
+INSERT OR REPLACE INTO "ServiceComponentDependencies" ( from_component_name, to_component_name ) VALUES ( "TASKTRACKER", "JOBTRACKER" );
+
+-- TODO add inserts for dependencies
+
+CREATE TABLE  "ServiceInfo" (
+  cluster_name TEXT, -- foreign-key cluster_name
+  service_name TEXT, -- foreign-key
+  state TEXT, -- current state of the service
+  desired_state TEXT, -- desired state of the service
+  is_enabled BOOL, -- whether service is enabled
+  PRIMARY KEY(cluster_name, service_name),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name),
+  FOREIGN KEY (service_name) REFERENCES Services(service_name)
+);
+
+CREATE TABLE  "ServiceComponentInfo" (
+  cluster_name TEXT, -- foreign-key cluster_name
+  service_name TEXT, -- foreign-key
+  component_name TEXT, -- foreign-key
+  state TEXT, -- current state of the service
+  desired_state TEXT, -- desired state of the service
+  PRIMARY KEY(cluster_name, component_name),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name),
+  FOREIGN KEY (service_name) REFERENCES Services(service_name),
+  FOREIGN KEY (component_name) REFERENCES ServiceComponents(component_name)
+);
+
+CREATE TABLE  ConfigProperties (
+  key TEXT, -- property key
+  default_value TEXT, -- default value
+  display_name TEXT, -- display name
+  description TEXT, -- description
+  service_name TEXT, -- service to which this property belongs to
+  display_type TEXT, -- display type, for frontend (vikram needs it). NODISPLAY for not showing on the frontend and DISPLAY for showing it.
+  display_attributes TEXT, -- display attributes stored as a JSON serialized string
+                   -- conforming to the following schema:
+                   --
+                   -- { "isPassword": boolean, "noDisplay": boolean, "reconfigurable": boolean, "displayType": string }
+                   --     where:
+                   --
+                   --     "isPassword": true if the value is a password field
+                   --     "noDisplay": true if the config is not meant to be displayed
+                   --     "reconfigurable": whether the value can be edited during reconfiguration
+                   --     "displayType": checkbox, multi-button checkbox, etc
+                   --     "displayValues": possible values in case of multi-value selection ( not required for single value which is covered by the default value
+
+  PRIMARY KEY (key) ,
+  FOREIGN KEY (service_name) REFERENCES Services(service_name)
+);
+
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_name_dir", "", "HDFS Name directories", "Namenode directories for HDFS to store the filesystem image", "HDFS", "TEXT", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_data_dir", "",  "HDFS Data directories", "", "HDFS", "Datanode directories for HDFS to store the data blocks", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_local_dir", "", "MapReduce local directories", "Directories for MapReduce to store intermediate data files", "MAPREDUCE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_data_dir", "", "Oozie DB directory", "Data Directory in which the Oozie DB exists", "OOZIE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_data_dir", "", "ZooKeeper directory", "Data directory for ZooKeeper", "ZOOKEEPER", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_mysql_host", "", "MySQL host", "MySQL host on which the Hive Metastore is hosted", "HIVE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_database_name", "hive", "MySQL Database Name", "MySQL Database name used as the Hive Metastore", "HIVE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_metastore_user_name", "dbusername", "MySQL user", "MySQL username to use to connect to the MySQL database", "HIVE", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hive_metastore_user_passwd", "dbpassword", "MySQL Password", "MySQL password to use to connect to the MySQL database", "HIVE", "SECRET", '{ "isPassword": true, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "java32_home", "", "Java 32 bit Home", "Path to 32-bit JAVA_HOME", "MISCELLANEOUS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "java64_home", "", "Java 64 bit Home", "Path to 64-bit JAVA_HOME", "MISCELLANEOUS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "jdk_location", "", "Jdk Url to Download 32/64 bit", "URL from where the Java JDK binary can be downloaded from", "MISCELLANEOUS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hdfs_user", "hdfs", "HDFS User Name", "User to run HDFS as", "HDFS", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_user", "mapred", "MapRed User Name", "User to run MapReduce as", "MAPREDUCE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_support_append", "true", "HDFS Append Enabled", "Whether to enable HDFS Append support", "HDFS", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": true, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_webhdfs_enabled", "false", "HDFS WebHDFS Enabled", "Whether to enable WebHDFS", "HDFS", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": true, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hadoop_logdirprefix", "/var/log/hadoop", "HADOOP Log DIR", "Directory for hadoop log files", "MISCELLANEOUS", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hadoop_piddirprefix", "/var/run/hadoop", "HADOOP PID DIR", "Directory in which the pid files for hadoop processes will be created", "MISCELLANEOUS", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "scheduler_name", "org.apache.hadoop.mapred.CapacityTaskScheduler", "MapReduce Capacity Scheduler", "The scheduler to use for scheduling of MapReduce jobs", "MAPREDUCE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": true, "displayType": "buttongroup" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hbase_log_dir", "/var/log/hbase", "HBase Log DIR", "Directory for HBASE logs", "HBASE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hbase_pid_dir", "/var/run/hbase", "HBase PID DIR", "Directory in which the pid files for HBASE processes will be created", "HBASE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hbase_user", "hbase", "HBase User Name", "User to run HBASE as", "HBASE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_log_dir", "/var/log/zookeeper", "ZooKeeper Log directory", "Directory for ZooKeeper log files", "ZOOKEEPER", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_pid_dir", "/var/run/zookeeper", "ZooKeeper PID directory", "Directory in which the pid files for zookeeper processes will be created", "ZOOKEEPER", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "zk_user", "zookeeper", "ZooKeeper User", "User to run ZooKeeper as", "ZOOKEEPER", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hcat_logdirprefix", "/var/log/hcatalog", "HCAT Log Dir", "Directory for HCatalog logs", "HCATALOG", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hcat_logdirprefix", "/var/log/hcatalog", "HCAT Log Dir", "Directory in which the pid files for hcatalog processes will be created", "HCATALOG", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hcat_user", "hcat", "HCAT User Name", "User to run HCatalog as", "HCATALOG", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "templeton_user", "templeton", "Templeton User Name", "User to run Templeton as", "TEMPLETON", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "templeton_pid_dir", "/var/run/templeton", "Templeton PID Dir", "Directory in which the pid files for templeton processes will be created", "TEMPLETON", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "templeton_log_dir", "/var/log/templeton", "Templeton Log Dir", "Directory for templeton logs", "TEMPLETON", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_log_dir", "/var/log/oozie", "Oozie Log Dir", "Directory for oozie logs", "OOZIE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_pid_dir", "/var/pid/oozie", "Oozie PID Dir", "Directory in which the pid files for oozie processes will be created", "OOZIE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "oozie_user", "oozie", "Oozie User Name", "User to run Oozie as", "OOZIE", "NODISPLAY", '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+
+-- Configurations for nagios
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "nagios_web_login", "nagiosadmin", "Nagios Admin User", "", "NAGIOS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "nagios_web_password", "admin", "Nagios Admin Password", "", "NAGIOS", "SECRET", '{ "isPassword": true, "noDisplay": false, "reconfigurable": false, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "nagios_contact", "", "Nagios Admin Contact", "", "NAGIOS", "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+--                                         gsCluster.properties keys
+
+-- maps to hadoop_heap_size in gsCluster.properties in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hadoop_heapsize", "1024", "HADOOP HEAP SIZE", "Java Heap Size for slave daemons", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to namenode_javaheap in gsCluster.properties in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "namenode_heapsize", "1024", "NameNode Heap Size", "Java Heap Size for NameNode", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to fs_inmemory_size in gsCluster.properties in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "fs_inmemory_size", "256", "Merge Mem Size", "Memory allocated for in memory FS",  "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to namenode_opt_newsize in gscluster in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "namenode_opt_newsize", "200", "Max Size of New Gen", "Maximum size for New Generation for java heap size", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to datanode_du_reserved in gscluster in bytes.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "datanode_du_reserved", "1073741824", "Reserved Space for HDFS", "Reserved space in bytes per volume", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to dt_heapsize in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dtnode_heapsize", "1024", "DataNode Heap Size", "Java Heap Size for DataNode", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to jtnode_opt_newsize in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "jtnode_opt_newsize", "200", "Default Size of New Gen", "Default size of new gen for jobtracker", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to jtnode_opt_maxnewsize in gscluster in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "jtnode_opt_maxnewsize", "200", "Max Size of New Gen", "Max size of new gen for jobtracker", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to jt_heapsize in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "jtnode_heapsize", "1024", "JobTracker Heap Size", "Java Heap  size for jobtracker", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_map_tasks_max in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_map_tasks_max", "4", "Maximum Number of MapTasks per Node", "The maximum number of map tasks that will be run simultaneously by a task tracker.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_red_tasks_max in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_red_tasks_max", "2", "Maximum Number of ReduceTasks per Node", "The maximum number of reduce tasks that will be run simultaneously by a task tracker.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_cluster_map_mem_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_map_mem_mb", "-1", "Virtual Mem for Single Map", "The size, in terms of virtual memory, of a single map slot in the Map-Reduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_cluster_red_mem_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_red_mem_mb", "-1", "Virtual Mem for Single Reduce", "The size, in terms of virtual memory, of a single reduce slot in the Map-Reduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_cluster_max_map_mem_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_map_mem_mb", "-1", "Maximum Virtual Mem for Single Map", "The maximum size, in terms of virtual memory, of a single map slot in the Map-Reduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_cluster_max_red_mem_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_cluster_max_red_mem_mb", "-1", "Maximum Virtual Mem for Single Reduce", "The maximum size, in terms of virtual memory, of a single reduce slot in the Map-Reduce framework", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_job_map_mem_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_map_mem_mb", "-1", "Virtual Memory for Single Map task for job", "Virtual Memory for Single Map task for a job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_job_map_red_mb in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_job_red_mem_mb", "-1", "Virtual Memory for Single Reduce task for job", "Virtual Memory for Single Reduce task for a job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to mapred_child_java_opts_sz in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapred_child_java_opts_sz", "768", "Java Opts for TT child processes.", "Java opts for the task tracker child processes.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to io_sort_mb in gscluster in MB
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "io_sort_mb", "200", "Buffer Memory for Sorting in MB", "The total amount of buffer memory to use while sorting files, in megabytes", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to io_sort_spill_percent in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "io_sort_spill_percent", "0.9", "Limit on Buffer", "The soft limit in either the buffer or record collection buffers", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+
+-- maps to mapreduce_userlog_retainhours in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "mapreduce_userlog_retainhours", "24", "Job Log Retention", "The maximum time, in hours, for which the user-logs are to be retained after the job completion.", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to max_tasks_per_job in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "maxtasks_per_job", "-1", "Max Tasks for a Job", "maximum number of tasks for a single job", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to dfs_datanode_failed_volume_tolerated in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "dfs_datanode_failed_volume_tolerated", "0", "DN Volumes Failure Toleration", "The number of volumes that are allowed to fail before a datanode stops offering service", "HDFS" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to tickTime in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "tickTime", "2000", "Length of Single Tick", "The length of a single tick, which is the basic time unit used by ZooKeeper, as measured in milliseconds", "ZOOKEEPER" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to initLimit in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "initLimit", "10", "Ticks to allow for sync at Init", "Amount of time, in ticks to allow followers to connect and sync to a leader", "ZOOKEEPER" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to syncLimit in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "syncLimit", "5", "Ticks to allow for sync at Runtime", "Amount of time, in ticks to allow followers to connect an", "ZOOKEEPER" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to clientPort in gscluster.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "clientPort", "2181", "Port for Running ZK Server", "Port for running ZK server", "ZOOKEEPER" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+
+-- maps to hbase_master_heapsize in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hbase_master_heapsize", "1024", "JVM Heap Size for HBase Master", "JVM heap size for HBase master", "HBASE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+-- maps to hbase_regionserver_heapsize in gscluster in MB.
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "hbase_regionserver_heapsize", "1024", "JVM Heap Size for HBase Region Servers", "JVM heap size for HBase region servers", "HBASE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "lzo_enabled", "false", "Lzo compression", "Lzo compression enabled", "MAPREDUCE" , "", '{ "isPassword": false, "noDisplay": false, "reconfigurable": true, "displayType": "text" }' );
+INSERT OR REPLACE INTO "ConfigProperties" ( key, default_value, display_name, description, service_name, display_type, display_attributes ) VALUES ( "snappy_enabled", "true", "Snappy compression", "Snappy compression enabled", "MAPREDUCE" , "NODISPLAY". '{ "isPassword": false, "noDisplay": true, "reconfigurable": false, "displayType": "text" }' );
+
+--                                        Done with gsCluster.properties
+
+CREATE TABLE  ServiceConfig (
+  cluster_name TEXT, -- foreign-key cluster_name
+  key TEXT, -- property key
+  value TEXT, -- property value
+  PRIMARY KEY (cluster_name, key),
+  FOREIGN KEY (key) REFERENCES ConfigProperties(key),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name)
+);
+
+CREATE TABLE  "Hosts" (
+  cluster_name TEXT, -- foreign-key cluster_name
+  host_name TEXT,  -- host name
+  ip TEXT,  -- ip
+  total_mem   INTEGER,  -- total mem on host - in bytes
+  cpu_count   INTEGER,  -- cpu count - no. of cores
+  os_arch TEXT, -- os arch - i386, x86_64 etc
+  os_type TEXT, -- os type - searchable - defined set of supported OS types - RHEL5, RHEL6, CENTOS5, SLES, etc.
+  os BLOB, -- os info - type, version etc - uname -a?
+  disks_info BLOB, -- disk capacity json object, keys are mount-points
+  discovery_status TEXT, -- discovery state - if we could connect properly
+  bad_health_reason TEXT, -- failure reason if any
+  attributes BLOB, -- attributes blob to store additional attributes that may be required for the host
+                   -- attributes stored currently:
+                      -- "publicFQDN" => public hostname in case of AWS ( same as hostname in other environments )
+                      -- "privateFQDN" => private hostname in case of AWS ( same as hostname in other environments )
+  PRIMARY KEY(host_name),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name),
+  UNIQUE(ip)
+);
+CREATE INDEX  host_mem_index ON "Hosts" ( total_mem );
+
+CREATE TABLE  "HostRoles" (
+  role_id INTEGER, --autoincrement primary key
+  cluster_name TEXT, --foreign key
+  host_name TEXT, --foreign key
+  component_name TEXT, -- One component of a service running on this host, like DN of HDFS
+  state TEXT, -- current state of the host
+  desired_state TEXT, -- desired state of this host
+  PRIMARY KEY (role_id),
+  UNIQUE (host_name, component_name),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name),
+  FOREIGN KEY (host_name) REFERENCES Hosts(host_name),
+  FOREIGN KEY (component_name) REFERENCES ServiceComponents(component_name)
+);
+
+CREATE TABLE "HostRoleConfig" (
+  cluster_name TEXT, --foreign key
+  host_name TEXT, --foreign key
+  component_name TEXT, -- One component of a service running on this host, like DN of HDFS
+  key TEXT, -- property key
+  value TEXT, -- property value
+  PRIMARY KEY (cluster_name, host_name, component_name, key),
+  FOREIGN KEY (key) REFERENCES ConfigProperties(key),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name),
+  FOREIGN KEY (host_name) REFERENCES Hosts(host_name),
+  FOREIGN KEY (component_name) REFERENCES ServiceComponents(component_name)
+);
+
+CREATE TABLE  "ConfigHistory" (
+  cluster_name TEXT, -- foreign-key cluster_name
+  version INTEGER, -- auto inc version
+  config BLOB, -- config blob
+  change_log BLOB, -- changelog update message for change
+  update_time INTEGER, -- unix time when change was made
+  PRIMARY KEY (version),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name)
+);
+
+CREATE TABLE  "TransactionStatus" (
+  cluster_name TEXT, -- cluster name foreign key
+  txn_id INTEGER, -- primary key auto-increment
+  create_time INTEGER, -- time when txn was created - unix time
+  status_info BLOB, -- blob containing all info pertaining to txn
+  pid_info BLOB, -- blob containing single or list of pids attached to txn
+  PRIMARY KEY (txn_id),
+  FOREIGN KEY (cluster_name) REFERENCES Clusters(cluster_name)
+);
+
+CREATE TABLE  "SubTransactionStatus" (
+  cluster_name TEXT, -- cluster name foreign key
+  txn_id INTEGER, -- txn id foreign key
+  sub_txn_id INTEGER, -- sub txn id
+  parent_sub_txn_id INTEGER, -- parent sub txn id
+  state TEXT, -- state info
+  description TEXT, -- additional description
+  progress TEXT, -- progress status of sub-txn
+  sub_txn_type TEXT, -- at what level is the txn taking place i.e cluster,svc,comp
+  op_status BLOB, -- status of operation - misc. info from puppet
+  PRIMARY KEY (cluster_name, txn_id, sub_txn_id),
+  FOREIGN KEY (txn_id) REFERENCES TransactionStatus(txn_id)
+);
+
+
+COMMIT;

+ 184 - 0
hmc/html/addNodesWizard.php

@@ -0,0 +1,184 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/selectHosts.css" media="screen"/>
+    <!-- End CSS -->
+  </head>
+
+  <body class="yui3-skin-sam">
+    <?php require "./header.html"; ?>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId"> 
+
+      <!-- Navigation bar -->
+      <div name="navigationBarDiv" id="navigationBarDivId">
+        <div name="navigationBarContentDiv" id="navigationBarContentDivId">
+        <a href="index.php">Clusters</a>
+        </div>
+      <hr/>
+      </div>
+      <!-- List of clusters
+      <div name="clustersListDiv" id="clustersListDivId">
+      </div>
+      -->
+
+      <!-- Installation Wizard -->
+      <div name="installationWizardDiv" id="installationWizardDivId" style="display:block">
+        <div name="installationWizardProgressBarDiv" id="installationWizardProgressBarDivId">
+          <ol id="installationWizardProgressBarListId">
+            <li id="addNodesStageId" class="installationWizardCurrentStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  1   
+                </span>
+                Add nodes
+              </div>
+            </li>
+            <li id="selectServicesStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  2   
+                </span>
+                Select services
+              </div>
+            </li>
+          </ol>
+        </div>
+        
+        <br/>
+                <div id="formStatusDivId" class="formStatusBar" style="display:none">
+          <div id="formStatusCoreDivId" stle="display:none">
+          </div>
+        </div>
+
+
+        <div name="installationMainFormsDiv" id="installationMainFormsDivId">
+         
+          <br/>
+              <div id="addNodesCoreDivId" style="display:block">
+
+                <fieldset>
+                  <form id="addNodesFilesFormId" enctype="multipart/form-data" method="post">
+                    <p>
+                    <label for="clusterDeployUserId">Cluster Deploy User</label>
+                    <input type="text" name="ClusterDeployUser" id="clusterDeployUserId" value="root" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterDeployUserIdentityFileId">Cluster Deploy User Identity File</label>
+                    <input type="file" name="clusterDeployUserIdentityFile" id="clusterDeployUserIdentityFileId" value="" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterHostsFileId">Cluster Hosts File</label>
+                    <input type="file" name="clusterHostsFile" id="clusterHostsFileId" value="" placeholder="">
+                    </p>
+
+                    <div id="fileUploadWrapperDivId">
+                      <iframe name="fileUploadTarget" id="fileUploadTargetId" src="about:blank" style="display:none"></iframe>
+                    </div>
+                  </form>
+                </fieldset>
+                <br/>
+                <p>
+                  <input type="button" id="addNodesSubmitButtonId" value="Add nodes" class="submitButton">
+                </p>
+              </div>
+
+              <div name="selectServicesCoreDiv" id="selectServicesCoreDivId" style="display:none">
+                <fieldset>
+                  <!--<legend>Select Services</legend>-->
+                  <form id="addNodesDataFormId">
+              <div name="selectComponentsDynamicRenderDiv" id="selectComponentsDynamicRenderDivId"></div>
+
+                    <!-- <p>
+                    <label for="installMapReduceId">MapReduce (TASKTRACKER)</label>
+                    <input type="checkbox" name="installMR" id="installMRId" value="installMapReduceValue" disabled="disabled" checked="yes">
+                    </p>
+                    <p>
+                    <label for="installHdfsId">HDFS (DATANODE)</label>
+                    <input type="checkbox" name="installHDFS" id="installHDFSId" value="installHdfsValue" disabled="disabled" checked="yes">
+                    </p> -->
+                  </form>
+                </fieldset>
+                <br/>
+                <p>
+                <input type="button" name="deployAddedNodesSubmitButton" id="deployAddedNodesSubmitButtonId" value="Deploy Nodes" class="submitButton">
+                </p>
+              </div>
+                <div name="txnProgressCoreDiv" id="txnProgressCoreDivId" style="display:none">
+
+                   <!-- Used to render informational/status messages (error, success reports and such like) -->
+                <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
+                  <div id="txnProgressStatusMessageDivId"></div>
+                  <div id="txnProgressStatusActionsDivId"></div>
+                </div>
+ 
+                  <fieldset id="txnProgressFieldSetId">
+               <!--     <legend>Display Progress</legend> -->
+                    <div id="txnProgressDynamicRenderDivId"></div>
+                  </fieldset>
+                </div>
+
+              </div>
+            </div>
+            <!-- End of installation Wizard -->
+
+            <!-- The mechanism by which we black out the screen and affix the
+                 the spotlight on a smaller portion of it. -->
+            <div id="blackScreenDivId" style="display:none"></div>
+            <!-- The image we use to let users know something is loading, and 
+                 that they should wait. -->
+            <div id="loadingDivId" style="display:none">
+              <div id="loadingBlackScreenDivId"></div>
+              <img id="loadingImgId" src="../images/loadingLarge.gif"/>
+            </div>
+
+            <!-- Placeholder for our informational YUI panel. -->
+            <div id="informationalPanelContainerDivId">
+            </div>
+
+            <hr/>
+            <?php require "./footer.html"; ?>
+
+            <!-- Javascript Scaffolding -->
+            <script type="text/javascript">
+
+            var freshInstallation = false;
+            var clusterName = "<?php echo $_GET['clusterName']; ?>";
+
+            var InstallationWizard = {
+
+              AddNodes: 
+              {},
+              AddNodesProgress:
+              {},
+              SelectComponents: 
+              {},
+              DeployProgress:
+              {}
+            };
+
+            var jsFilesToLoad = [ 
+                '../js/utils.js', 
+                '../js/txnUtils.js',
+                '../js/addNodes.js', 
+                '../js/addNodesProgress.js', 
+                '../js/selectComponents.js', 
+                '../js/deployProgress.js', 
+                '../js/addNodesWizardInit.js'
+              ];
+            </script>
+
+            <?php require "./bootstrapJs.htmli"; ?>
+            <!-- End of Javascript Scaffolding -->
+
+          </body>
+        </html> 

+ 31 - 0
hmc/html/bootstrapJs.htmli

@@ -0,0 +1,31 @@
+<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+
+<script type="text/javascript">
+
+  /* Loads the next file from the global jsFilesToLoad array (destroying it 
+   * in the process).
+   */
+  function loadNextJsFile() {
+
+    if( jsFilesToLoad.length > 0 ) {
+
+      var dynamicJsScript = document.createElement("script");
+      dynamicJsScript.type = "text/javascript";
+      dynamicJsScript.src = jsFilesToLoad.shift();
+      globalYui.log('Loading ' + dynamicJsScript.src);
+      dynamicJsScript.onload = loadNextJsFile;
+      document.getElementsByTagName("head")[0].appendChild(dynamicJsScript);
+    }
+  }
+
+  var globalYui = YUI().use( 
+    "node", "io", "dump", "json", "panel", "event", "arraysort", 
+    "array-extras", "datasource", "datasource-io", "datasource-jsonschema", 
+    "datasource-polling", "stylesheet", "dd-drop", "dd-constrain",
+    "dd-proxy", function (Y) {
+
+      /* Kick off the sequential loading. */
+      loadNextJsFile();
+
+    });
+</script>

+ 41 - 0
hmc/html/cluster.php

@@ -0,0 +1,41 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <?php require "./css_includes.html"; ?>
+  </head>
+
+  <body>
+    <?php require "./header.html"; ?>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId" class="yui3-skin-sam"> 
+
+      <!-- Navigation bar -->
+      <div name="navigationBarDiv" id="navigationBarDivId">
+        <div name="navigationBarContentDiv" id="navigationBarContentDivId">
+        <a href="index.php">Clusters</a>
+        </div>
+      <hr/>
+      </div>
+ 
+      <div name="displayServiceStatusCoreDiv" id="displayServiceStatusCoreDivId" style="display:block">
+        <div name="displayServiceStatusContentDiv" id="displayServiceStatusContentDivId" >
+        </div>
+      </div>
+    </div>
+
+    <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+    <!-- <script src="../js/global.js"></script> -->
+    <script src="../js/serviceStatus.js"></script>
+    <script>
+       getServicesStatus('<?php echo $_GET['clusterId']; ?>');
+    </script>
+
+    <?php echo("hello"); ?>
+    <?php echo("<a href='displayInstallLogs.php?clusterId=" . $_GET['clusterId'] . "'>Installation logs</a>"); ?>
+  </body>
+  <hr/>
+  <?php require "./footer.html"; ?>
+</html>
+

+ 103 - 0
hmc/html/clusters.php

@@ -0,0 +1,103 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/clusters.css" media="screen"/>
+    <!-- End CSS -->
+  </head>
+
+  <body class="yui3-skin-sam">
+    <?php require "./header.html"; ?>
+
+    <hr/>
+
+    <h1> Cluster <?php echo $_GET['clusterName']; ?> </h1>
+
+    <br/>
+
+    <div id="contentDivId"> 
+
+      <!-- The Main Event -->
+      <div id="clustersCoreDivId">
+        <div id="clustersNavigationLinksDivId">
+          <ul id="clustersNavigationLinksListId">
+            <li class="clustersNavigationLinkEntry">
+              <a href="../../hdp/dashboard/ui/home.html">
+                Monitoring Dashboard
+              </a>
+            </li>
+            <li class="clustersNavigationLinkEntry">
+              <a href="../html/manageServices.php?clusterName=<?php echo $_GET['clusterName']; ?>">
+                Start/Stop/Reconfigure Services
+              </a>
+            </li>
+            <li class="clustersNavigationLinkEntry">
+              <a href="../html/uninstallCluster.php?clusterName=<?php echo $_GET['clusterName']; ?>">
+                Uninstall
+              </a>
+            </li>
+          </ul>
+        </div>
+
+        <br/>
+
+        <div id="clustersHostRoleMappingDynamicRenderDivId">
+        </div>
+      </div>
+      <!-- End of clustersCoreDivId -->
+
+      <div id="txnProgressCoreDivId" style="display:none">
+
+        <!-- Used to render informational/status messages (error, success reports and such like) -->
+        <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
+          <div id="txnProgressStatusMessageDivId"></div>
+          <div id="txnProgressStatusActionsDivId"></div>
+        </div>
+
+        <fieldset id="txnProgressFieldSetId">
+          <div id="txnProgressDynamicRenderDivId"></div>
+        </fieldset>
+      </div>
+      <!-- End of txnProgressCoreDivId -->
+
+      <!-- The mechanism by which we black out the screen and affix the
+           the spotlight on a smaller portion of it. -->
+      <div id="blackScreenDivId" style="display:none"></div>
+      <!-- The image we use to let users know something is loading, and 
+           that they should wait. -->
+      <div id="loadingDivId"> 
+        <div id="loadingBlackScreenDivId"></div>
+        <img id="loadingImgId" src="../images/loadingLarge.gif"/>
+      </div>
+
+      <!-- Placeholder for our informational YUI panel. -->
+      <div id="informationalPanelContainerDivId"></div>
+
+    </div>
+    <!-- End of contentDivId -->
+
+    <hr/>
+    <?php require "./footer.html"; ?>
+
+    <!-- Javascript Scaffolding -->
+    <script type="text/javascript">
+      /* Minimal data required to bootstrap clusters.js. */
+      var clusterName = '<?php echo $_GET['clusterName']; ?>';
+
+      var jsFilesToLoad = [ 
+        '../js/utils.js',
+        '../js/txnUtils.js',
+        '../js/clusters.js' 
+      ];
+    </script>
+
+    <?php require "./bootstrapJs.htmli"; ?>
+    <!-- End of Javascript Scaffolding -->
+
+  </body>
+</html> 

+ 56 - 0
hmc/html/displayLogs.php

@@ -0,0 +1,56 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+  </head>
+
+  <body>
+    <header>
+    <img src="./logo.jpg"/>
+    <section id="headerText">Hortonworks Data Platform</section>
+    </header>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId" >
+
+<!--
+<div name="servicesListDiv" id="servicesListDivId">
+  <div>Service Name</div>
+  <div>Status</div>
+</div>
+-->
+
+                <div name="displayLogsCoreDiv" id="displayLogsCoreDivId" style="display:none">
+                  <div name="displayLogsContentDiv" id="displayLogsContentDivId"> 
+                  </div>
+                  <div name="installDoneDiv" id="installDoneDivId" style="display:none"> 
+                    <p>
+                    <input type="button" name="installDoneButton" id="installDoneButtonId" value="Install Completed" class="submitButton">
+                    </p>
+                  </div>
+                </div>
+
+
+<!--
+      <div name="displayLogsDiv" id="displayLogsDivId">
+        <p><b>Checking status for all services</b></p>
+      </div>
+-->
+    </div> <!-- end content div -->
+
+      <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+      <script src="../js/displayLogs.js"></script>
+
+      <script type="text/javascript">
+         YUI().use("event", function (Y) { 
+           getGsInstallLogs(Y, "MyCluster-12345");
+         });
+      </script>
+  </body>
+  <hr/>
+  <footer></footer>
+</html>
+

+ 278 - 0
hmc/html/dummyInitializeCluster.php

@@ -0,0 +1,278 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <?php require "./css_includes.html"; ?>
+  </head>
+
+  <body class="yui3-skin-sam">
+    <?php require "./header.html"; ?>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId"> 
+
+      <!-- Navigation bar -->
+      <div name="navigationBarDiv" id="navigationBarDivId">
+        <div name="navigationBarContentDiv" id="navigationBarContentDivId">
+        <a href="index.php">Clusters</a>
+        </div>
+      <hr/>
+      </div>
+      <!-- List of clusters
+      <div name="clustersListDiv" id="clustersListDivId">
+      </div>
+      -->
+
+      <!-- Installation Wizard -->
+      <div name="installationWizardDiv" id="installationWizardDivId" style="display:block">
+        <div name="installationWizardProgressBarDiv" id="installationWizardProgressBarDivId">
+          <ol id="installationWizardProgressBarListId">
+            <li id="createClusterStageId" class="installationWizardFirstStage installationWizardCurrentStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  1   
+                </span>
+                Create Cluster
+              </div>
+            </li>
+            <li id="initializeClusterStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  2   
+                </span>
+                Initialize Cluster
+              </div>
+            </li>
+            <li id="assignHostsStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  3   
+                </span>
+                Assign Hosts
+              </div>
+            </li>
+            <li id="configureClusterStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  4   
+                </span>
+                Configure Cluster
+              </div>
+            </li>
+            <li id="configureClusterAdvancedStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  5   
+                </span>
+                Configure Cluster (Advanced)
+              </div>
+            </li>
+            <li id="deployClusterStageId" class="installationWizardLastStage installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  6   
+                </span>
+                Deploy Cluster
+              </div>
+            </li>
+          </ol>
+        </div>
+        
+        <br/>
+        
+        <div name="installationMainFormsDiv" id="installationMainFormsDivId">
+
+          <!-- Used to render informational/status messages (error, success reports and such like) -->
+          <div id="displayProgressStatusDivId" style="display:none"></div>
+          
+          <br/>
+
+          <div name ="createClusterCoreDiv" id="createClusterCoreDivId" style="display:none">
+            <form id="createClusterFormId" >
+              <fieldset>
+                <legend>Create Cluster</legend>
+                <label for="clusterNameId">Enter a name for your cluster</label>
+                <input type="text" name="clusterName" id="clusterNameId" value="">
+              </fieldset>
+            </form>
+                <br/>
+                <p>
+                <input type="button" name="createClusterSubmitButton" id="createClusterSubmitButtonId" value="Create Cluster" class="submitButton">
+                </p>
+              </div>
+
+              <div name="initializeClusterCoreDiv" id="initializeClusterCoreDivId" style="display:none">
+
+                <fieldset>
+                  <legend>Hosts file and credentials</legend>
+                  <form id="initializeClusterFilesFormId" enctype="multipart/form-data" method="post">
+                    <p>
+                    <label for="clusterDeployUserId">Cluster Deploy User</label>
+                    <input type="text" name="clusterDeployUser" id="clusterDeployUserId" value="root" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterDeployUserIdentityFileId">Cluster Deploy User Identity File</label>
+                    <input type="file" name="clusterDeployUserIdentityFile" id="clusterDeployUserIdentityFileId" value="" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterHostsFileId">Cluster Hosts File</label>
+                    <input type="file" name="clusterHostsFile" id="clusterHostsFileId" value="" placeholder="">
+                    </p>
+
+                    <iframe name="fileUploadTarget" id="fileUploadTargetId" src="" style="display:none"></iframe>
+
+                  </form>
+                </fieldset>
+
+                <br/>
+
+                <fieldset>
+                  <legend>Select Services</legend>
+                  <form id="initializeClusterDataFormId">
+                    <p>
+                    <label for="installMapReduce">MapReduce</label>
+                    <input type="checkbox" name="installMR" id="installMRId" value="installMapReduceValue" disabled="disabled" checked="yes">
+                    </p>
+                    <p>
+                    <label for="installHdfs">HDFS</label>
+                    <input type="checkbox" name="installHDFS" id="installHDFSId" value="installHdfsValue" disabled="disabled" checked="yes">
+                    </p>
+                    <p>
+                    <label for="installHBaseId">HBase</label>
+                    <input type="checkbox" name="installHBase" id="installHBaseId" value="installHBaseValue">
+                    </p>
+                    <p>
+                    <label for="installHCatalogId">HCatalog</label>
+                    <input type="checkbox" name="installHCatalog" id="installHCatalogId" value="installHCatalogValue">
+                    </p>
+                    <p>
+                    <label for="installTempletonId">Templeton</label>
+                    <input type="checkbox" name="installTempleton" id="installTempletonId" value="installTempletonValue">
+                    </p>
+                    <p>
+                    <label for="installOozieId">Oozie</label>
+                    <input type="checkbox" name="installOozie" id="installOozieId" value="installOozieValue">
+                    </p>
+                    <p>
+                    <label for="installPigId">Pig</label>
+                    <input type="checkbox" name="installPig" id="installPigId" value="installPigValue">
+                    </p>
+                    <p>
+                    <label for="installSqoopId">Sqoop</label>
+                    <input type="checkbox" name="installSqoop" id="installSqoopId" value="installSqoopValue">
+                    <p>
+                  </form>
+                </fieldset>
+                <br/>
+                <p>
+                <input type="button" name="initializeClusterSubmitButton" id="initializeClusterSubmitButtonId" value="Initialize" class="submitButton">
+                </p>
+              </div>
+
+              <div name="assignHostsCoreDiv" id="assignHostsCoreDivId" style="display:none">
+                <form id="assignHostsFormId">
+                  <fieldset id="assignHostsFieldSetId">
+                    <legend>Select master hosts</legend>
+                    <div id="assignHostsDynamicRenderDivId"></div>
+                  </fieldset>
+                  <p>
+                  <input type="button" name="assignHostsSubmitButton" id="assignHostsSubmitButtonId" value="submit" class="submitButton">
+                  </p>
+                </form>
+              </div>
+
+              <div name="configureClusterCoreDiv" id="configureClusterCoreDivId" style="display:none">
+
+                <div name="configureClusterInputDiv" id="configureClusterInputDivId">
+                  <form id="configureClusterFormId">
+                    <fieldset id="configureClusterInputFieldSetId">
+                      <legend>Select mount points</legend>
+                      <div name="configureClusterMountPointsInputDiv" id="configureClusterMountPointsInputDivId">
+                        <div id="configureClusterMountPointsDynamicRenderDivId"></div>
+                        <p>
+                          <label for="customMountPoints">Custom mount points</label>
+                          <input type="text" name="customMountPoints" id="customMountPointsId" value="" placeholder="Comma-Separated List">
+                        </p>
+                      </div>  
+                      <!-- Additional <div>s for other categories of cluster configuration go here -->
+                    </fieldset>
+                    <p>
+                    <input type="button" name="configureClusterSubmitButton" id="configureClusterSubmitButtonId" value="Submit" class="submitButton">
+                    </p>
+                  </form>
+                </div>
+
+                  <br/>
+
+                  <div name="configureClusterDisplayDiv" id="configureClusterDisplayDivId">
+                    <fieldset>
+                      <legend>Effective mount points</legend>
+                      <div name="configureClusterMountPointsDisplayDiv" id="configureClusterMountPointsDisplayDivId">
+                      </div>
+                    </fieldset>
+                  </div>
+                </div>
+
+                <div name="configureClusterAdvancedCoreDiv" id="configureClusterAdvancedCoreDivId" style="display:none">
+                  <form id="configureClusterAdvancedFormId">
+                    <fieldset id="configureClusterAdvancedFieldSetId">
+                      <legend>Advanced configuration</legend>
+                      <div id="configureClusterAdvancedDynamicRenderDivId"></div>
+                    </fieldset>
+                    <p>
+                    <input type="button" name="configureClusterAdvancedSubmitButton" id="configureClusterAdvancedSubmitButtonId" value="Submit" class="submitButton">
+                    </p>
+                  </form>
+                </div>
+
+                <div name="deployCoreDiv" id="deployCoreDivId" style="display:block">
+                  <form id="deployFormId">
+                    <fieldset id="deployFieldSetId">
+                      <legend>Review your settings</legend>
+                      <div id="deployDynamicRenderDivId"></div>
+                    </fieldset>
+                    <p>
+                    <input type="button" name="deploySubmitButton" id="deploySubmitButtonId" value="Deploy" class="submitButton">
+                    </p>
+                  </form>
+                </div>
+
+                <div name="displayProgressCoreDiv" id="displayProgressCoreDivId" style="display:none">
+                  <fieldset id="displayProgressFieldSetId">
+                    <legend>Deploy Progress</legend>
+                    <div id="displayProgressDynamicRenderDivId"></div>
+                  </fieldset>
+                </div>
+
+              </div>
+            </div>
+            <!-- End of installation Wizard -->
+
+            <div id="loadingDivId">
+              <img id="loadingImgId" src="../images/loadingLarge.gif" style="display:none"/>
+            </div>
+
+            <!-- Placeholder for our informational YUI Panel. -->
+            <div id="informationalPanelContainerDivId">
+              <div class="yui3-widget-hd"></div>
+              <div class="yui3-widget-bd"></div>
+              <div class="yui3-widget-ft"></div>
+            </div>
+
+            <hr/>
+            <?php require "./footer.html"; ?>
+
+            <?php require "./js_includes.html"; ?>
+
+            <script type="text/javascript">
+
+              YUI().use("node", "io", "dump", "json", "arraysort", "panel", "event", function (Y) {
+                Y.log("starting up");
+                renderDeploy(Y, {clusterName: 'rez3'});
+              });
+
+            </script>
+          </body>
+        </html> 

+ 39 - 0
hmc/html/expandTab.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="UTF-8">
+    <title>Test</title>
+  </head>
+  <body>
+    <p>
+    Here is opening info.
+    </p>
+    <p class="supplementalInfo">
+    Here is supplemental info.
+    </p>
+    <p>
+    This approach uses Progressive Enhancement.
+    </p>
+    <p class="supplementalInfo">
+    Progressive Enhancement allows content to be accessible to all, while also
+    providing an enhanced version to those that can handle it.
+    </p>
+    <script type="text/javascript" src="http://yui.yahooapis.com/3.0.0/build/yui/yui-min.js"></script>
+    <script type="text/javascript">
+      YUI().use('node', function (Y) {
+          function toggle(n, link) {
+          var visible = (n.getStyle('display') == 'block');
+          n.setStyle('display', (visible ? 'none' : 'block'));
+          link.set('innerHTML', (visible ? 'MORE' : 'LESS'));
+          }
+          Y.all('.supplementalInfo').each(function () {
+            var n = this,
+            c = Y.Node.create('<div><a href="#">MORE</a></div>');
+            c.one('a').on('click', function (e) { e.preventDefault(); toggle(n, this); });
+            n.insert(c, 'after');
+            n.setStyle('display', 'none');
+            });
+          });
+    </script>
+  </body>
+</html>

+ 3 - 0
hmc/html/footer.html

@@ -0,0 +1,3 @@
+<!-- START FOOTER -->
+    <footer></footer>
+    <!-- END FOOTER -->

+ 8 - 0
hmc/html/header.html

@@ -0,0 +1,8 @@
+<!-- START HEADER -->
+    <header>
+      <a href="http://www.hortonworks.com">
+        <img src="./logo.jpg"/>
+      </a>
+      <section id="headerText">Hortonworks Data Platform</section>
+    </header>
+    <!-- END HEADER -->

+ 102 - 0
hmc/html/history.html

@@ -0,0 +1,102 @@
+<html>
+  <head>
+  </head>
+
+  <body>
+    <button id="THE_BUTTON">
+      Submit
+    </button>
+
+    <div id="THE_DIV"></div>
+
+    <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+    <script type="text/javascript">
+      
+      YUI().use("node", "io", "dump", "json", "history", "event", function (Y) { 
+        
+        var currentScreen = 0;
+
+        var history = new Y.History();
+
+        function isEmptyObject( theObject ) {
+
+          for( var key in theObject ) {
+            if( theObject.hasOwnProperty( key ) ) {
+              return false;
+            }
+          }
+
+          return true;
+        }
+
+        function renderDiv( screenToDisplay ) {
+          /*
+          var divData = history.get();
+
+          var screenToDisplay;
+
+          if( isEmptyObject( divData ) ) {
+            Y.log("Empty object");
+
+            screenToDisplay = currentScreen;
+          }
+          else {
+            Y.log(Y.Lang.dump(divData));
+
+            screenToDisplay = divData.screen;
+          }
+          */
+
+          Y.one('#THE_DIV').setContent('<h1>' + screenToDisplay + '</h1>');
+        }
+
+        Y.one("#THE_BUTTON").on( "click", function(e) {
+          
+          Y.log("clicked");
+
+          currentScreen++;
+
+          /* Update THE_DIV. */
+          renderDiv(currentScreen);
+
+          history.add({'screen' : currentScreen - 1 }, {'merge' : false});
+        });
+
+        history.on('change', function(e) {
+
+          Y.log(Y.Lang.dump(e.src));
+
+          if ((e.src === Y.HistoryHash.SRC_HASH) || (e.src === Y.HistoryHTML5.SRC_POPSTATE)) {
+
+            var screenToDisplay;
+
+            var divData = history.get();
+
+            if( isEmptyObject( divData ) ) {
+              Y.log("Empty object");
+
+              screenToDisplay = currentScreen;
+            }
+            else {
+              Y.log(Y.Lang.dump(divData));
+
+              screenToDisplay = divData.screen;
+            }
+
+            renderDiv(screenToDisplay);
+
+//            for( var k in e ) {
+//              if( e.hasOwnProperty(k) ) {
+//                Y.log( k + '->' + Y.Lang.dump(e[k]) );
+//              }
+//            }
+          }
+        });
+
+        /* Initial render. */
+        renderDiv( currentScreen );
+
+      });
+    </script>
+  </body>
+</html>

+ 52 - 0
hmc/html/index.php

@@ -0,0 +1,52 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <!-- End CSS -->
+  </head>
+
+  <body>
+    <?php require "./header.html"; ?>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId" class="yui3-skin-sam"> 
+
+    <!--
+      <!-- Navigation bar -->
+      <!--
+      <div name="navigationBarDiv" id="navigationBarDivId">
+        <div name="navigationBarContentDiv" id="navigationBarContentDivId">
+        Clusters
+        </div>
+      <hr/>
+      </div>
+      -->
+      <!-- List of clusters -->
+      <div name="clustersListDiv" id="clustersListDivId">
+      </div>
+
+        <br/>
+        
+        <!--
+        <div name="installationSideBarDiv" id="installationSideBarDivId">
+          <div id="createClusterSideBarId">Create cluster</div>
+          <div id="selectServicesSideBarId">Select services</div>
+          <div id="masterHostsSideBarId">Select master hosts</div>
+          <div id="mountPointsSideBarId">Select mount points</div>
+          <div id="advancedConfigSideBarId">Advanced configuration</div>
+          <div id="reviewSettingsSideBarId">Review your settings</div>
+        </div>
+        -->
+
+            <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+            <script src="../js/utils.js"></script>
+            <script src="../js/clustersList.js"></script>
+
+          </body>
+          <hr/>
+          <?php require "./footer.html"; ?>
+        </html> 

+ 337 - 0
hmc/html/initializeCluster.php

@@ -0,0 +1,337 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/selectHosts.css" media="screen"/>
+    <!-- End CSS -->
+  </head>
+
+  <body class="yui3-skin-sam">
+    <?php require "./header.html"; ?>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId"> 
+
+      <!-- Navigation bar -->
+      <div name="navigationBarDiv" id="navigationBarDivId">
+        <div name="navigationBarContentDiv" id="navigationBarContentDivId">
+        <a href="index.php">Clusters</a>
+        </div>
+      <hr/>
+      </div>
+      <!-- List of clusters
+      <div name="clustersListDiv" id="clustersListDivId">
+      </div>
+      -->
+
+      <!-- Installation Wizard -->
+      <div name="installationWizardDiv" id="installationWizardDivId" style="display:block">
+        <div name="installationWizardProgressBarDiv" id="installationWizardProgressBarDivId">
+          <ol id="installationWizardProgressBarListId">
+            <li id="createClusterStageId" class="installationWizardFirstStage installationWizardCurrentStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  1   
+                </span>
+                Create Cluster
+              </div>
+            </li>
+            <li id="addNodesStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  2   
+                </span>
+                Add Nodes
+              </div>
+            </li>
+            <li id="selectServicesStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  3   
+                </span>
+                Select Services
+              </div>
+            </li>
+            <li id="assignHostsStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  4   
+                </span>
+                Assign Hosts
+              </div>
+            </li>
+            <li id="configureClusterStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  5
+                </span>
+                Select Disk Mount Points
+              </div>
+            </li>
+            <li id="configureClusterAdvancedStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  6
+                </span>
+                Advanced Configuration
+              </div>
+            </li>
+            <li id="deployClusterStageId" class="installationWizardLastStage installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  7
+                </span>
+                Review &amp; Deploy
+              </div>
+            </li>
+          </ol>
+        </div>
+        
+        <!-- Used to render informational/status messages (error, success reports and such like) -->
+        <div id="formStatusDivId" class="formStatusBar" style="visibility:hidden">Nothing
+        </div>
+       
+        <div name="installationMainFormsDiv" id="installationMainFormsDivId">
+         
+          <div name ="createClusterCoreDiv" id="createClusterCoreDivId">
+            <form id="createClusterFormId" >
+              <fieldset>
+                <!--<legend>Create Cluster</legend>-->
+                <label for="clusterNameId">Enter a name for your cluster</label>
+                <input type="text" name="clusterName" id="clusterNameId" value="">
+              </fieldset>
+            </form>
+                <br/>
+                <p>
+                <input type="button" name="createClusterSubmitButton" id="createClusterSubmitButtonId" value="Create Cluster" class="submitButton">
+                </p>
+              </div>
+
+              <div id="addNodesCoreDivId" style="display:none">
+
+                <fieldset>
+                  <form id="addNodesFilesFormId" enctype="multipart/form-data" method="post">
+                    <div class="pageSummary">
+                      We need information about the nodes you want to use for installing Hadoop, please provide them below:
+                    </div>
+                    <p>
+                    <label for="clusterDeployUserId">Cluster Deploy User</label>
+                    <input type="text" name="ClusterDeployUser" id="clusterDeployUserId" value="root" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterDeployUserIdentityFileId">Cluster Deploy User Identity File</label>
+                    <input type="file" name="clusterDeployUserIdentityFile" id="clusterDeployUserIdentityFileId" value="" placeholder="">
+                    </p>
+                    <br/>
+                    <p>
+                    <label for="clusterHostsFileId">Cluster Hosts File</label>
+                    <input type="file" name="clusterHostsFile" id="clusterHostsFileId" value="" placeholder="">
+                    </p>
+
+                    <div id="fileUploadWrapperDivId">
+                      <iframe name="fileUploadTarget" id="fileUploadTargetId" src="about:blank" style="display:none"></iframe>
+                    </div>
+                  </form>
+                </fieldset>
+                <br/>
+                <p>
+                  <input type="button" id="addNodesSubmitButtonId" value="Add nodes" class="submitButton">
+                </p>
+              </div>
+
+              <div name="selectServicesCoreDiv" id="selectServicesCoreDivId" style="display:none">
+               <fieldset>
+                <div class="pageSummary">Select the list of services below that you wish to install on the cluster. Note that some of them may have dependencies which we will automatically select.</div>
+                <div id="selectCoreServicesListId">
+                  <ul id="selectCoreServicesListUlId">
+                    <div id="selectCoreServicesDynamicRenderDivId">
+                    </div>
+                  </ul>
+                </div>
+                <div id="selectOptionalServicesListId">
+                  <ul id="selectOptionalServicesListUlId">
+                    <div id="selectOptionalServicesDynamicRenderDivId">
+                    </div>
+                  </ul>
+                </div>
+                <div id="selectNonSelectableServicesListId">
+                  <ul id="selectNonSelectableServicesListUlId">
+                    <div id="selectNonSelectableServicesDynamicRenderDivId">
+                    </div>
+                  </ul>
+                </div>
+               </fieldset>
+
+                <br/>
+                <p>
+                  <input type="button" name="selectServicesSubmitButton" id="selectServicesSubmitButtonId" value="Select services" class="submitButton">
+                </p>
+
+              </div>
+              <!-- End of selectServicesCoreDivId -->
+
+              <div name="assignHostsCoreDiv" id="assignHostsCoreDivId" style="display:none">
+                <div id="statusDivId">
+                </div>
+
+                <div class="pageSummary"> We have categorized the given nodes into Node-groups and also suggested the locations of various service-masters. Drap and drop service-masters that you wish to change. Click on the given links if you wish to change the node assignments</div>
+                <div id="serviceMastersLinksDivId">
+                </div>
+                <div id="nodeGroupsCoreDivId">
+                </div>
+                <input type="button" name="selectServiceMastersSubmitButton" id="selectServiceMastersSubmitButtonId" value="Submit" class="submitButton">
+
+              </div>
+
+              <div name="configureClusterCoreDiv" id="configureClusterCoreDivId" style="display:none">
+
+                <div class="pageSummary">We observed that the following mount points are available on your nodes. Please confirm/modify the list, these mount points will be used for storing data in various services as shown on the right side.</div>
+                <form id="configureClusterFormId">
+                  <div id="configureClusterInputContainerDivId">
+                    <div name="configureClusterInputDiv" id="configureClusterInputDivId">
+                        <fieldset id="configureClusterInputFieldSetId">
+                          <!--<legend>Select mount points</legend>-->
+                          <div name="configureClusterMountPointsInputDiv" id="configureClusterMountPointsInputDivId">
+                            <div id="configureClusterMountPointsDynamicRenderDivId"></div>
+                            <p>
+                              <label for="customMountPoints">Custom mount points</label>
+                              <input type="text" name="customMountPoints" id="customMountPointsId" value="" placeholder="Comma-Separated List">
+                            </p>
+                          </div>  
+                          <!-- Additional <div>s for other categories of cluster configuration go here -->
+                        </fieldset>
+                    </div>
+
+                    <br/>
+
+                    <p>
+                      <input type="button" name="configureClusterSubmitButton" id="configureClusterSubmitButtonId" value="Submit" class="submitButton">
+                    </p>
+                  </div>
+
+                  <div name="configureClusterDisplayDiv" id="configureClusterDisplayDivId">
+                    <fieldset>
+                      <!--<legend>Effective mount points</legend>-->
+                      <div name="configureClusterMountPointsDisplayDiv" id="configureClusterMountPointsDisplayDivId">
+                      </div>
+                    </fieldset>
+                  </div>
+                  </form>
+                </div>
+
+                <div id="configureClusterAdvancedCoreDivId" style="display:none">
+                  <div class="pageSummary">Edit some/all of the following to affect per-service configuration. We have chimed in with reasonable defaults whereever possible.</div>
+                  <form id="configureClusterAdvancedFormId">
+                    <fieldset id="configureClusterAdvancedFieldSetId">
+                      <!--<legend>Advanced configuration</legend>-->
+                      <div id="configureClusterAdvancedDynamicRenderDivId"></div>
+                    </fieldset>
+                    <p>
+                    <input type="button" name="configureClusterAdvancedSubmitButton" id="configureClusterAdvancedSubmitButtonId" value="Submit" class="submitButton">
+                    </p>
+                  </form>
+                </div>
+
+                <div name="deployCoreDiv" id="deployCoreDivId" style="display:none">
+                  <div class="pageSummary">Please review your settings below, we are ready for a deploy! If you wish to make any changes, you can click on the installation stages above.</div>
+                  <form id="deployFormId">
+                    <fieldset id="deployFieldSetId">
+                      <!--<legend>Review your settings</legend>-->
+                      <div id="deployDynamicRenderDivId"></div>
+                    </fieldset>
+                    <p>
+                    <input type="button" name="deploySubmitButton" id="deploySubmitButtonId" value="Deploy" class="submitButton">
+                    </p>
+                  </form>
+                </div>
+
+                <div id="txnProgressCoreDivId" style="display:none">
+
+                  <!-- Used to render informational/status messages (error, success reports and such like) -->
+                  <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
+                    <div id="txnProgressStatusMessageDivId"></div>
+                    <div id="txnProgressStatusActionsDivId"></div>
+                  </div>
+ 
+                  <fieldset id="txnProgressFieldSetId">
+               <!--     <legend>Display Progress</legend> -->
+                    <div id="txnProgressDynamicRenderDivId"></div>
+                  </fieldset>
+                </div>
+
+              </div>
+            </div>
+            <!-- End of installation Wizard -->
+
+            <!-- The mechanism by which we black out the screen and affix the
+                 the spotlight on a smaller portion of it. -->
+            <div id="blackScreenDivId" style="display:none"></div>
+            <!-- The image we use to let users know something is loading, and 
+                 that they should wait. -->
+            <div id="loadingDivId" style="display:none">
+              <div id="loadingBlackScreenDivId"></div>
+              <img id="loadingImgId" src="../images/loadingLarge.gif"/>
+            </div>
+
+            <!-- Placeholder for our informational YUI panel. -->
+            <div id="informationalPanelContainerDivId">
+            </div>
+
+            <hr/>
+            <?php require "./footer.html"; ?>
+
+            <!-- Javascript Scaffolding -->
+            <script type="text/javascript">
+
+            var freshInstall = true;
+
+            var InstallationWizard = {
+
+              CreateCluster: 
+              {},
+              AddNodes: 
+              {},
+              AddNodesProgress:
+              {},
+              SelectServices: 
+              {},
+              AssignMasters: 
+              {},
+              ConfigureCluster: 
+              {},
+              ConfigureServices: 
+              {},
+              ReviewAndDeploy: 
+              {},
+              DeployProgress:
+              {}
+            };
+
+            var jsFilesToLoad = [ 
+                '../js/utils.js', 
+                '../js/txnUtils.js',
+                '../js/installationWizard.js',
+                '../js/createCluster.js', 
+                '../js/addNodes.js', 
+                '../js/addNodesProgress.js', 
+                '../js/selectServices.js', 
+                '../js/assignMasters.js', 
+                '../js/configureCluster.js', 
+                '../js/configureServicesUtils.js',
+                '../js/configureServices.js', 
+                '../js/reviewAndDeploy.js', 
+                '../js/deployProgress.js' 
+              ];
+            </script>
+
+            <?php require "./bootstrapJs.htmli"; ?>
+            <!-- End of Javascript Scaffolding -->
+
+          </body>
+        </html> 

BIN
hmc/html/logo.jpg


+ 149 - 0
hmc/html/manageServices.php

@@ -0,0 +1,149 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <!-- CSS -->
+    <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common3.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/manageServices.css" media="screen"/>
+    <!-- End CSS -->
+  </head>
+
+  <body class="yui3-skin-sam">
+    <?php require "./header.html"; ?>
+
+    <hr/>
+
+    <h1>Service Management for Cluster 
+      <a href="../html/clusters.php?clusterName=<?php echo $_GET['clusterName']; ?>" target="_blank">
+        <?php echo $_GET['clusterName']; ?>
+      </a>
+    </h1>
+
+    <br/>
+
+    <div id="contentDivId"> 
+
+      <!-- Service Management: The Main Event -->
+      <div id="serviceManagementCoreDivId">
+        <ul id="serviceManagementListId">
+          <div id="serviceManagementDynamicRenderDivId">
+            <!--
+            <li class="serviceManagementEntry serviceManagementEntryStopped">
+              <div>
+                <span class="serviceManagementEntryNameContainer">
+                  <a href="javascript:void(null)" class="serviceManagementEntryName">HDFS</a>
+                </span>
+                <div class="serviceManagementEntryActionsContainer">
+                  <a href="javascript:void(null)" title="Start" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStart"></a>
+                  <a href="javascript:void(null)" title="Stop" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStop"></a>
+                  <a href="javascript:void(null)" title="Reconfigure" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionReconfigure"></a>
+                </div>
+              </div>
+            </li>
+            <li class="serviceManagementEntry serviceManagementEntryStarted">
+              <div>
+                <span class="serviceManagementEntryNameContainer">
+                  <a href="javascript:void(null)" class="serviceManagementEntryName">MapReduce</a>
+                </span>
+                <div class="serviceManagementEntryActionsContainer">
+                  <a href="javascript:void(null)" title="Start" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStart"></a>
+                  <a href="javascript:void(null)" title="Stop" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStop"></a>
+                  <a href="javascript:void(null)" title="Reconfigure" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionReconfigure"></a>
+                </div>
+              </div>
+            </li>
+            <li class="serviceManagementEntry serviceManagementEntryStarted">
+              <div>
+                <span class="serviceManagementEntryNameContainer">
+                  <a href="javascript:void(null)" class="serviceManagementEntryName">HBase</a>
+                </span>
+                <div class="serviceManagementEntryActionsContainer">
+                  <a href="javascript:void(null)" title="Start" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStart"></a>
+                  <a href="javascript:void(null)" title="Stop" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionStop"></a>
+                  <a href="javascript:void(null)" title="Reconfigure" 
+                     class="serviceManagementEntryAction serviceManagementEntryActionReconfigure"></a>
+                </div>
+              </div>
+            </li>
+            -->
+          </div>
+        </ul>
+
+        <br/>
+
+        <div id="serviceManagementGlobalActionsDivId" style="display:none">
+          <button id="serviceManagementGlobalActionsStartAllButtonId" name="startAll">
+            Start All
+          </button>
+          <button id="serviceManagementGlobalActionsStopAllButtonId" name="stopAll">
+            Stop All
+          </button>
+        </div>
+
+        <br/>
+
+      </div>
+      <!-- End of serviceManagementCoreDivId -->
+
+      <div id="txnProgressCoreDivId" style="display:none">
+
+        <!-- Used to render informational/status messages (error, success reports and such like) -->
+        <div id="txnProgressStatusDivId" class="formStatusBar" style="display:none">
+          <div id="txnProgressStatusMessageDivId"></div>
+          <div id="txnProgressStatusActionsDivId"></div>
+        </div>
+
+        <fieldset id="txnProgressFieldSetId">
+          <div id="txnProgressDynamicRenderDivId"></div>
+        </fieldset>
+      </div>
+      <!-- End of txnProgressCoreDivId -->
+
+      <!-- The mechanism by which we black out the screen and affix the
+           the spotlight on a smaller portion of it. -->
+      <div id="blackScreenDivId" style="display:none"></div>
+      <!-- The image we use to let users know something is loading, and 
+           that they should wait. -->
+      <div id="loadingDivId" style="display:none">
+        <div id="loadingBlackScreenDivId"></div>
+        <img id="loadingImgId" src="../images/loadingLarge.gif"/>
+      </div>
+
+      <!-- Placeholder for our informational YUI panel. -->
+      <div id="informationalPanelContainerDivId"></div>
+
+    </div>
+    <!-- End of contentDivId -->
+
+    <hr/>
+    <?php require "./footer.html"; ?>
+
+    <!-- Javascript Scaffolding -->
+    <script type="text/javascript">
+      /* Minimal data required to bootstrap manageServices.js. */
+      var clusterName = '<?php echo $_GET['clusterName']; ?>';
+
+      var jsFilesToLoad = [ 
+        '../js/utils.js',
+        '../js/txnUtils.js',
+        '../js/configureServicesUtils.js',
+        '../js/manageServices.js' 
+      ];
+    </script>
+
+    <?php require "./bootstrapJs.htmli"; ?>
+    <!-- End of Javascript Scaffolding -->
+
+  </body>
+</html> 

+ 119 - 0
hmc/html/rez.html

@@ -0,0 +1,119 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/rez.css" media="screen"/>
+  </head>
+
+  <body>
+    <header>
+    <img src="./logo.jpg"/>
+    <section id="headerText">Hortonworks Data Platform</section>
+    </header>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId" > 
+      <div name="installationWizardDiv" id="installationWizardDivId">
+        <div name="installationWizardProgressBarDiv" id="installationWizardProgressBarDivId">
+          <ol id="installationWizardProgressBarListId">
+            <li id="createClusterStageId" class="installationWizardFirstStage installationWizardVisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  1   
+                </span>
+                Create Cluster
+              </div>
+            </li>
+            <li id="initializeClusterStageId" class="installationWizardVisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  2   
+                </span>
+                Initialize Cluster
+              </div>
+            </li>
+            <li id="assignHostsStageId" class="installationWizardCurrentStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  3   
+                </span>
+                Assign Hosts
+              </div>
+            </li>
+            <li id="configureClusterStageId" class="installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  4   
+                </span>
+                Configure Cluster
+              </div>
+            </li>
+            <li id="deployClusterStageId" class="installationWizardLastStage installationWizardUnvisitedStage">
+              <div>
+                <span class="installationWizardStageNumber">
+                  5   
+                </span>
+                Deploy Cluster
+              </div>
+            </li>
+          </ol>
+        </div>
+        <div name="installationMainFormsDiv" id="installationMainFormsDivId">
+
+        <input type="button" name="nextStageButton" id="nextStageButtonId" value="Next Stage" class="submitButton">
+        <!-- Test divs here -->
+
+          <div name="configureClusterCoreDiv" id="configureClusterCoreDivId" style="display:none">
+
+            <div name="configureClusterInputDiv" id="configureClusterInputDivId">
+              <form id="configureClusterFormId">
+                <fieldset id="configureClusterInputFieldSetId">
+                  <legend>Configure Cluster</legend>
+                  <h3> Select Mount Points To Use </h3>
+                  <div name="configureClusterMountPointsInputDiv" id="configureClusterMountPointsInputDivId">
+                    <p>
+                    <label for="customMountPoints">(Additional) Custom Mount Points</label>
+                    <input type="text" name="customMountPoints" id="customMountPointsId" value="" placeholder="Comma-Separated List">
+                    </p>
+                  </div>  
+                  <!-- Additional <div>s for other categories of cluster configuration go here -->
+                    <p>
+                    <input type="button" name="configureClusterSubmitButton" id="configureClusterSubmitButtonId" value="Configure Cluster" class="submitButton">
+                    </p>
+                  </fieldset>
+                </form>
+              </div>
+
+              <br/>
+
+              <div name="configureClusterDisplayDiv" id="configureClusterDisplayDivId">
+                <fieldset id="configureClusterDisplayFieldSetId">
+                  <legend>Effective Config Values</legend>
+                  <div name="configureClusterMountPointsDisplayDiv" id="configureClusterMountPointsDisplayDivId">
+                  </div>
+                </fieldset>
+              </div>
+            </div>
+
+
+        </div>
+
+
+      <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+      <script src="../js/rez.js"></script>
+      <!--
+      <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+      <script src="../js/createCluster.js"></script>
+      <script src="../js/initializeCluster.js"></script>
+      <script src="../js/assignHosts.js"></script>
+      <script src="../js/configureCluster.js"></script>
+      <script src="../js/deploy.js"></script>
+      -->
+
+    </body>
+    <hr/>
+    <footer>Hortonworks &copy; 2012</footer>
+  </html> 

+ 55 - 0
hmc/html/rez.html.old

@@ -0,0 +1,55 @@
+<html>
+  <head>
+    <title id="pageTitleId">HDP Initialize Cluster</title>
+
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+  </head>
+
+  <body>
+
+    <div name="configureClusterCoreDiv" id="configureClusterCoreDivId" style="display:none">
+
+      <div name="configureClusterInputDiv" id="configureClusterInputDivId">
+        <form id="configureClusterFormId">
+          <fieldset id="configureClusterFieldSetId">
+            <h3> Select Mount Points To Use </h3>
+            <div name="configureClusterMountPointsInputDiv" id="configureClusterMountPointsInputDivId">
+              <p>
+                <label for="customMountPointsId">(Additional) Custom Mount Points</label>
+                <input type="text" name="customMountPoints" id="customMountPointsId" value="" placeholder="Comma-Separated List">
+              </p>
+            </div>  
+            <!-- Additional <div>s for other categories of cluster configuration go here -->
+          </fieldset>
+          <p>
+            <input type="button" name="configureClusterSubmitButton" id="configureClusterSubmitButtonId" value="Configure Cluster">
+          </p>
+        </form>
+      </div>
+
+      <br/>
+
+      <div name="configureClusterDisplayDiv" id="configureClusterDisplayDivId">
+        <fieldset id="configureClusterDisplayFieldSetId">
+        <legend>Effective Config Values</legend>
+          <div name="configureClusterMountPointsDisplayDiv" id="configureClusterMountPointsDisplayDivId">
+          </div>
+        </fieldset>
+      </div>
+    </div>
+
+    <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+    <script src="../js/rezConfigureCluster.js"></script>
+    <script type="text/javascript">
+    YUI().use("node", "io", "dump", "json", "arraysort", "event", function (Y) { 
+
+        Y.one("#configureClusterCoreDivId").setStyle('display','block');
+
+        renderConfigureCluster(Y, {"mountPoints":["\/grid\/0","\/grid\/1","\/grid\/2","\/grid\/3"],"servicesInfo":[{"keyName":"nameNodeDataDir","displayName":"NameNode Data Directories","maxDirectoriesNeeded":4,"suffix":"hadoop\/hdfs\/namenode"},{"keyName":"dataNodeDataDir","displayName":"DataNode Data Directories","maxDirectoriesNeeded":4,"suffix":"hadoop\/hdfs\/data"},{"keyName":"mapReduceDataDir","displayName":"MapReduce Data Directories","maxDirectoriesNeeded":4,"suffix":"hadoop\/mapred"},{"keyName":"oozieDbDir","displayName":"Oozie DB Directory","maxDirectoriesNeeded":1,"suffix":"hadoop\/oozie"},{"keyName":"zooKeeperDataDir","displayName":"ZooKeeper Data Directory","maxDirectoriesNeeded":1,"suffix":"hadoop\/zookeeper"}]} );
+
+      });
+    </script>
+
+  </body>
+</html> 

+ 45 - 0
hmc/html/serviceStatus.html

@@ -0,0 +1,45 @@
+<html>
+  <head>
+    <title id="pageTitleId">Hortonworks Data Platform Portal</title>
+
+    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.4.1/build/cssreset/cssreset-min.css"> 
+    <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+    <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+  </head>
+
+  <body>
+    <header>
+    <img src="./logo.jpg"/>
+    <section id="headerText">Hortonworks Data Platform</section>
+    </header>
+    <hr/>
+
+    <div name="ContentDiv" id="ContentDivId" >
+
+<!--
+<div name="servicesListDiv" id="servicesListDivId">
+  <div>Service Name</div>
+  <div>Status</div>
+</div>
+-->
+
+      <div name="serviceStatusDiv" id="serviceStatusDivId">
+        <p><b>Checking status for all services</b></p>
+         
+      </div>
+
+    </div> <!-- end content div -->
+
+      <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+      <script src="../js/serviceStatus.js"></script>
+
+      <script type="text/javascript">
+         YUI().use("node", "io", "dump", "json", "arraysort", "event", function (Y) { 
+           getServiceStatus(Y, "MyCluster-12345");
+         });
+      </script>
+  </body>
+  <hr/>
+  <footer></footer>
+</html>
+

+ 49 - 0
hmc/html/summary.html

@@ -0,0 +1,49 @@
+<html>
+
+<head>
+  <title id="pageTitleId">HDP Summay for Deploy Cluster</title>
+  <link type="text/css" rel="stylesheet" href="../css/common.css" media="screen"/>
+  <link type="text/css" rel="stylesheet" href="../css/common2.css" media="screen"/>
+</head>
+
+<body>
+<div>
+  Services to be installed
+  <p><label>HBase</label><input type="text" name="HBase" readonly=readonly value=xxx></p>
+  <p><label>HCatalog</label><input type="text" name="HCatalog" readonly=readonly value=xxx></p>
+  <p><label>Templeton</label><input type="text" name="Templeton" readonly=readonly value=xxx></p>
+  <p><label>Oozie</label><input type="text" name="Oozie" readonly=readonly value=xxx></p>
+  <p><label>Pig</label><input type="text" name="Pig" readonly=readonly value=xxx></p>
+  <p><label>Sqoop</label><input type="text" name="Sqoop" readonly=readonly value=xxx></p>
+</div>
+<div>
+  Host details
+  <div>Jobtracker<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>Namenode<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>Secondary Namenode<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>HBase Master<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>HCatalog<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>Ganglia Collector<input type="text" name="" readonly=readonly value=xxx></div>
+  <div>Nagios Server<input type="text" name="" readonly=readonly value=xxx></div>
+</div>
+
+<div>
+  Confirm Mount Points
+  <div>Mount 1<input type="text" name="1 mount point" readonly=readonly value=xxx></div>
+  <div>Mount 2<input type="text" name="2 mount point" readonly=readonly value=xxx></div>
+  <div>Mount 3<input type="text" name="3 mount point" readonly=readonly value=xxx></div>
+  <div>Mount 4<input type="text" name="4 mount point" readonly=readonly value=xxx></div>
+</div>
+
+<div>
+Confirm all configuration
+  <div>Namenode Heap Size<input type="text" name="Namenode heap size" readonly=readonly value=xxx></div>
+  <div>Jobtracker Heap Size<input type="text" name="Jobtracker heap size" readonly=readonly value=xxx></div>
+  <div>HBase Master Heap Size<input type="text" name="HBase Master heap size" readonly=readonly value=xxx></div>
+  <div>Hadoop Heap Size<input type="text" name="Hadoop Heap Size" readonly=readonly value=xxx></div>
+  <div> Data Node Heap Size<input type="text" name="Data Node Heap Size" readonly=readonly value=xxx></div>
+</div>
+
+</body>
+
+</html>

+ 124 - 0
hmc/html/tempHostMapping.html

@@ -0,0 +1,124 @@
+<html>
+<head>
+  <link rel="stylesheet" type="text/css" href="../css/selectHosts.css"/>
+<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+<script type="text/javascript">
+
+var currentMaster="";
+var nodeGroups = [ "A", "B"];
+var serviceMasters = [ "NameNode", "JobTracker" , "HBaseMaster" ]
+var slotContents = {};
+var serviceLocations = {};
+
+function renderSlots(Y) {
+  for (nodeGroupIndex in nodeGroups) {
+    for (serviceMasterIndex in serviceMasters) {
+      var content= "";
+      var thisId = 'slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
+      for (master in slotContents[thisId]) {
+        content += master + "<br/>";
+      }
+      Y.one('#' + thisId).setContent(content);
+    }
+  }
+}
+
+YUI().use("node", "io", "dump", "json", "event", "stylesheet", function (Y) {
+
+  ////////////////// Render service links ///////////////////
+  var serviceMastersLinksMarkup ="";
+  for (key in serviceMasters) {
+    serviceMastersLinksMarkup += '<div id="' + serviceMasters[key] + '" class="aServiceMasterLink">' + serviceMasters[key] + '</div><br/>';
+  }
+  Y.one("#serviceMastersLinksDivId").setContent(serviceMastersLinksMarkup);
+  ////////////////// End of rendering service links ////////
+
+  ////////////////// Register click handlers for all masters ///////////////////
+  for (key in serviceMasters) {
+    var serviceLinkId = "#" + serviceMasters[key];
+    Y.one(serviceLinkId).on('click', function(e) {
+      if ( currentMaster != this.get('id')) {
+        activate(Y, this.get('id'));
+      }
+    });
+  }
+  ////////////////// End of registering click handlers for all masters ///////////////////
+
+  ////////////////// Render node groups ////////
+  var nodeGroupsMarkup = '<div id="nodeGroupsTable">';
+  for (nodeGroupIndex in nodeGroups) {
+    nodeGroupsMarkup += '<div id="' + nodeGroups[nodeGroupIndex] + '" class="aNodeGroup"> <p>Node group ' + nodeGroups[nodeGroupIndex] + '</p>';
+    
+    // Number of boxes equal to number of service-masters
+    for (serviceMasterIndex in serviceMasters) {
+      nodeGroupsMarkup += '<div id="slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex + '" class="slot"></div>';
+    } 
+    nodeGroupsMarkup += '</div>'; 
+  }
+  nodeGroupsMarkup += '</div>';
+  Y.one("#nodeGroupsDivId").setContent(nodeGroupsMarkup);
+  ////////////////// End of rendering node groups ////////
+
+  // Register click handlers for all node-slots
+  for (nodeGroupIndex in nodeGroups) {
+    for (serviceMasterIndex in serviceMasters) {
+      var slotDivId = '#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
+      Y.log("registering for " + slotDivId);
+      Y.one(slotDivId).on('click', function(e) {
+          Y.log("Clicked on " + this.get('id'));
+          //Y.log(currentMaster + " " + nodeGroups[nodeGroupIndex] + " " + serviceMasterIndex);
+          //Y.log('#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex);
+          //Y.one('#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex).setContent("hello");
+          // this.setContent(serviceMasters[currentMaster]);
+          var oldSlotId = serviceLocations[currentMaster];
+          if (oldSlotId != this.get('id')) {
+            delete slotContents[oldSlotId][currentMaster];
+            serviceLocations[currentMaster] = this.get('id');
+            if (slotContents[this.get('id')] === undefined) {
+              slotContents[this.get('id')] = {};
+            }
+            slotContents[this.get('id')][currentMaster] = [currentMaster];
+            renderSlots(Y);
+          }
+    });
+    }
+  }
+
+  ////////////////// Initialize all slots ///////////////////
+  var thisId = 'slotForGroup' + nodeGroups[0] + 0;
+  for (serviceMasterIndex in serviceMasters) {
+    if (slotContents[thisId] === undefined) {
+      slotContents[thisId] = {};
+    }
+    var masterName = serviceMasters[serviceMasterIndex];
+    slotContents[thisId][masterName] = masterName;
+    serviceLocations[masterName] = thisId;
+  }
+  renderSlots(Y);
+  ////////////////// End of initializing all slots ///////////////////
+});
+
+function activate(Y, serviceMaster) {
+  Y.log("Activated " + serviceMaster + " from " + currentMaster);
+  Y.one("#" + serviceMaster).replaceClass("aServiceMasterLink", "aServiceMasterLinkVisited");
+  if (currentMaster != "") {
+    Y.one("#" + currentMaster).replaceClass("aServiceMasterLinkVisited", "aServiceMasterLink");
+  }
+  currentMaster = serviceMaster;
+}
+
+</script>
+</head>
+
+<body>
+<div id="statusDivId">
+</div>
+
+<p>Services, Node Groups</p>
+<div id="serviceMastersLinksDivId">
+</div>
+<div id="nodeGroupsDivId">
+</div>
+
+</body>
+</html>

+ 115 - 0
hmc/html/tempHostMapping2.html

@@ -0,0 +1,115 @@
+<html>
+<head>
+  <link rel="stylesheet" type="text/css" href="../css/selectHosts.css"/>
+<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
+<script type="text/javascript">
+
+var currentMaster="";
+var nodeGroups = [ "A", "B"];
+var serviceMasters = [ "NameNode", "JobTracker" , "HBaseMaster" ]
+var slotContents = {};
+var serviceLocations = {};
+
+function renderSlots(Y) {
+  for (nodeGroupIndex in nodeGroups) {
+    for (serviceMasterIndex in serviceMasters) {
+      var content= "";
+      var thisId = 'slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
+      for (master in slotContents[thisId]) {
+        content += '<div id="' + master + '" class="masterDiv">' + master + "</div>";
+      }
+      Y.one('#' + thisId).setContent(content);
+    }
+  }
+}
+
+YUI().use("node", "io", "dump", "json", "event", 'dd-drop', 'dd-constrain', 'dd-proxy', function (Y) {
+
+  ////////////////// Render node groups ////////
+  var nodeGroupsMarkup = '<div id="nodeGroupsTable">';
+  for (nodeGroupIndex in nodeGroups) {
+    nodeGroupsMarkup += '<div id="' + nodeGroups[nodeGroupIndex] + '" class="aNodeGroup"> <p>Node group ' + nodeGroups[nodeGroupIndex] + '</p>';
+    
+    // Number of boxes equal to number of service-masters
+    for (serviceMasterIndex in serviceMasters) {
+      nodeGroupsMarkup += '<div id="slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex + '" class="slot"></div>';
+    } 
+    nodeGroupsMarkup += '</div>'; 
+  }
+  nodeGroupsMarkup += '</div>';
+  Y.one("#nodeGroupsDivId").setContent(nodeGroupsMarkup);
+  ////////////////// End of rendering node groups ////////
+
+  ////////////////// Initialize all slots ///////////////////
+  var thisId = 'slotForGroup' + nodeGroups[0] + 0;
+  for (serviceMasterIndex in serviceMasters) {
+    if (slotContents[thisId] === undefined) {
+      slotContents[thisId] = {};
+    }
+    var masterName = serviceMasters[serviceMasterIndex];
+    slotContents[thisId][masterName] = masterName;
+    serviceLocations[masterName] = thisId;
+  }
+  renderSlots(Y);
+  ////////////////// End of initializing all slots ///////////////////
+
+  for (serviceMasterIndex in serviceMasters) {
+    var dd = new Y.DD.Drag({
+      node: Y.one('#' + serviceMasters[serviceMasterIndex])
+    }).plug(Y.Plugin.DDProxy, {
+       //We don't want the node to move on end drag
+       moveOnEnd: false
+    }).plug(Y.Plugin.DDConstrained, {
+       //Keep it inside the work area
+       constrain2node: '#nodeGroupsTable'
+    });
+    //Prevent the default end event (this moves the node back to its start position)
+     dd.on('drag:end', function(e) {
+        e.preventDefault();
+     });
+     /*
+     dd.on('drag:drophit', function(e) {
+       //If we drop on a target, move to its position
+       var xy = e.drop.get('node').getXY();
+       this.get('node').setXY(xy);
+     });
+     */
+  }
+
+  for (nodeGroupIndex in nodeGroups) {
+    for (serviceMasterIndex in serviceMasters) {
+      var thisId = '#slotForGroup' + nodeGroups[nodeGroupIndex] + serviceMasterIndex;
+      var drop = new Y.DD.Drop({
+        node: thisId
+      });
+      //Listen for a drop:hit on this target
+      drop.on('drop:hit', function(e) {
+        //Now we get the drag instance that triggered the drop hit
+        var draggedItem = e.drag.get('node');
+        var dropPlace = this.get('node');
+        dropPlace.appendChild(draggedItem);
+        serviceLocations[draggedItem.get('id')] = dropPlace.get('id');
+        Y.log("Moved " + draggedItem.get('id') + " to " + dropPlace.get('id'));
+    });
+    }
+  }
+});
+
+function print() {
+  alert("hello");
+}
+
+</script>
+</head>
+
+<body>
+<div id="statusDivId">
+</div>
+
+<p>Services, Node Groups</p>
+<div id="nodeGroupsDivId">
+</div>
+<input type="button" name="selectServiceMastersSubmitButton" id="selectServiceMastersSubmitButtonId" value="Submit" class="submitButton" onclick=print()>
+
+</body>
+</html>

+ 10 - 0
hmc/html/tryRadio.html

@@ -0,0 +1,10 @@
+<html>
+  <head>
+    <title>Try Radio button</title>
+  </head>
+
+  <body>
+    <input type=radio name=r1 value="true">Enable Lzo</input>
+  </body>
+
+</html>

+ 26 - 0
hmc/html/x.html

@@ -0,0 +1,26 @@
+<html>
+  <head>
+    
+  </head>
+  <body>
+    <script type="text/javascript">
+
+    var myObject = {
+      f : foo,
+      b : bar
+    };
+
+    myObject.f();
+
+    function foo()
+    {
+      alert("foo");
+    }
+    function bar()
+    {
+      alert("bar");
+    }
+
+    </script>
+  </body>
+</html>

+ 1 - 0
hmc/html/x.txt

@@ -0,0 +1 @@
+{ "abc" : "def", "ghi" : "jkl" }

BIN
hmc/images/green_check.gif


BIN
hmc/images/green_check.png


BIN
hmc/images/green_check_large.png


BIN
hmc/images/loading.gif


BIN
hmc/images/loadingLarge.gif


BIN
hmc/images/loading_orange.gif


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä