Author: swagle
Date: Tue Apr  2 17:26:33 2013
New Revision: 1463630

URL: http://svn.apache.org/r1463630
Log:
AMBARI-1770. Hue installation fails due to manifest errors. (swagle)

Added:
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_value_from_map.rb
Modified:
    incubator/ambari/trunk/CHANGES.txt
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/params.pp
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/service.pp
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/templates/hue-ini.cfg.erb
    
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp

Modified: incubator/ambari/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1463630&r1=1463629&r2=1463630&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Apr  2 17:26:33 2013
@@ -544,6 +544,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-1770. Hue installation fails due to manifest errors. (swagle)
+
  AMBARI-1764. Unable to get all tasks from more than one request_id by one
  request (tbeerbower)
 

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/params.pp
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/params.pp?rev=1463630&r1=1463629&r2=1463630&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/params.pp
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/params.pp
 Tue Apr  2 17:26:33 2013
@@ -26,6 +26,9 @@ class hdp-hue::params() inherits hdp::pa
   $hue_conf_file = "${hdp::params::hue_conf_dir}/hue.ini"
   $hue_pid_dir = hdp_default("hue_pid_dir", "/var/run/hue")
   $hue_log_dir = hdp_default("hue_log_dir", "/var/log/hue")
+  $hue_lock_file = hdp_default("hue_lock_file", "/var/lock/subsys/hue")
+  $hue_server_user = hdp_default("hue_user", "hue")
+  $hue_server_group = hdp_default("hue_user_group", "hadoop")
 
   # Other properties - not exposed
 
@@ -34,6 +37,7 @@ class hdp-hue::params() inherits hdp::pa
   $security_enabled = $hdp::params::security_enabled
   $hue_hive_conf_dir = $hdp::params::hive_conf_dir
   $hue_pig_java_home = $hdp::params::java64_home
+  $webhcat_server_host = hdp_default("webhcat_server_host")
 
   # All non-global properties
 
@@ -42,97 +46,62 @@ class hdp-hue::params() inherits hdp::pa
 
     # Hadoop Configuration properties
 
-    $hue_hadoop_fs_defaultfs = $hue-site["fs_defaultfs"]
-    $hue_hadoop_webhdfs_url = $hue-site["webhdfs_url"]
-    $hue_hadoop_jt_host = $hue-site["jobtracker_host"]
-    $hue_hadoop_jt_port = $hue-site["jobtracker_port"]
-    $hue_hive_home_dir = $hue-site["hive_home_dir"]
-    $hue_templeton_url = $hue-site["templeton_url"]
+    $hue_hadoop_fs_defaultfs = hdp_get_value_from_map($hue-site, 
"fs_defaultfs", "")
+    $hue_hadoop_webhdfs_url = hdp_get_value_from_map($hue-site, "webhdfs_url", 
"")
+    $hue_hadoop_jt_host = hdp_get_value_from_map($hue-site, "jobtracker_host", 
hdp_default("jtnode_host"))
+    $hue_hadoop_jt_port = hdp_get_value_from_map($hue-site, "jobtracker_port", 
"50030")
+    $hue_hive_home_dir = hdp_get_value_from_map($hue-site, "hive_home_dir", 
"/usr/lib/hive")
+    $hue_templeton_url = hdp_get_value_from_map($hue-site, "templeton_url", 
"http://${webhcat_server_host}:50111/templeton/v1";)
 
     # Database Configuration properties
 
-    $hue_db_engine = $hue-site["db_engine"]
-    $hue_db_port = $hue-site["db_port"]
-    $hue_db_host = $hue-site["db_host"]
-    $hue_db_user = $hue-site["db_user"]
-    $hue_db_password = $hue-site["db_password"]
-    $hue_db_name = $hue-site["db_name"]
+    $hue_db_engine = hdp_get_value_from_map($hue-site, "db_engine", "")
+    $hue_db_port = hdp_get_value_from_map($hue-site, "db_port", "")
+    $hue_db_host = hdp_get_value_from_map($hue-site, "db_host", "")
+    $hue_db_user = hdp_get_value_from_map($hue-site, "db_user", "")
+    $hue_db_password = hdp_get_value_from_map($hue-site, "db_password", "")
+    $hue_db_name = hdp_get_value_from_map($hue-site, "db_name", "")
 
     # Hue Email Configuration properties
 
-    $hue_smtp_host = $hue-site["smtp_host"]
-    $hue_smtp_port = $hue-site["smtp_port"]
-    $hue_smtp_user = $hue-site["smtp_user"]
-    $hue_smtp_password = $hue-site["smtp_password"]
-    $hue_smtp_tls = $hue-site["tls"]
-    $hue_default_from_email = $hue-site["default_from_email"]
+    $hue_smtp_host = hdp_get_value_from_map($hue-site, "smtp_host", "")
+    $hue_smtp_port = hdp_get_value_from_map($hue-site, "smtp_port", "")
+    $hue_smtp_user = hdp_get_value_from_map($hue-site, "smtp_user", "")
+    $hue_smtp_password = hdp_get_value_from_map($hue-site, "smtp_password", "")
+    $hue_smtp_tls = hdp_get_value_from_map($hue-site, "tls", "no")
+    $hue_default_from_email = hdp_get_value_from_map($hue-site, 
"default_from_email", "[email protected]")
 
     # Hue Configuration properties
 
-    $hue_debug_messages = $hue-site["send_debug_messages"]
-    $hue_database_logging = $hue-site["database_logging"]
-    $hue_secret_key = $hue-site["secret_key"]
-    $hue_http_host = $hue-site["http_host"]
-    $hue_http_port = $hue-site["http_port"]
-    $hue_time_zone = $hue-site["time_zone"]
-    $hue_django_debug_mode = $hue-site["django_debug_mode"]
-    $hue_use_cherrypy_server = $hue-site["use_cherrypy_server"]
-    $hue_http_500_debug_mode = $hue-site["http_500_debug_mode"]
-    $hue_server_user = $hue-site["server_user"]
-    $hue_server_group = $hue-site["server_group"]
-    $hue_backend_auth_policy = $hue-site["backend_auth"]
+    $hue_debug_messages = hdp_get_value_from_map($hue-site, 
"send_debug_messages", "1")
+    $hue_database_logging = hdp_get_value_from_map($hue-site, 
"database_logging", "0")
+    $hue_secret_key = hdp_get_value_from_map($hue-site, "secret_key", 
"ThisisusedforsecurehashinginthesessionstoreSetthistoarandomstringthelongerthebetter")
+    $hue_http_host = hdp_get_value_from_map($hue-site, "http_host", "0.0.0.0")
+    $hue_http_port = hdp_get_value_from_map($hue-site, "http_port", "8000")
+    $hue_time_zone = hdp_get_value_from_map($hue-site, "time_zone", 
"America/Los_Angeles")
+    $hue_django_debug_mode = hdp_get_value_from_map($hue-site, 
"django_debug_mode", "1")
+    $hue_use_cherrypy_server = hdp_get_value_from_map($hue-site, 
"use_cherrypy_server", "false")
+    $hue_http_500_debug_mode = hdp_get_value_from_map($hue-site, 
"http_500_debug_mode", "1")
+    $hue_backend_auth_policy = hdp_get_value_from_map($hue-site, 
"backend_auth", "desktop.auth.backend.AllowAllBackend")
 
-    $hue_hadoop_yarn_host = $hue-site["resourcemanager_host"]
-    $hue_hadoop_yarn_port = $hue-site["resourcemanager_port"]
+    $hue_hadoop_yarn_host = hdp_get_value_from_map($hue-site, 
"resourcemanager_host", "")
+    $hue_hadoop_yarn_port = hdp_get_value_from_map($hue-site, 
"resourcemanager_port", "")
 
     # Shell Configuration properties
 
-    $hue_pig_shell_command = $hue-site["pig_shell_command"]
-    $hue_hbase_nice_name = $hue-site["hbase_nice_name"]
-    $hue_hbase_shell_command = $hue-site["hbase_shell_command"]
-    $hue_bash_nice_name = $hue-site["bash_nice_name"]
-    $hue_bash_shell_command = $hue-site["bash_shell_command"]
+    $hue_pig_shell_command = hdp_get_value_from_map($hue-site, 
"pig_shell_command", "/usr/bin/pig -l /dev/null")
+    $hue_hbase_nice_name = hdp_get_value_from_map($hue-site, 
"hbase_nice_name", "HBase Shell")
+    $hue_hbase_shell_command = hdp_get_value_from_map($hue-site, 
"hbase_shell_command", "/usr/bin/hbase shell")
+    $hue_bash_nice_name = hdp_get_value_from_map($hue-site, "bash_nice_name", 
"Bash (Test only!!!)")
+    $hue_bash_shell_command = hdp_get_value_from_map($hue-site, 
"bash_shell_command", "/bin/bash")
 
-    $hue_whitelist = $hue-site["whitelist"]
+    $hue_whitelist = hdp_get_value_from_map($hue-site, "whitelist", 
"(localhost|127\\.0\\.0\\.1):(${jtnode_port}|${namenode_port}|${tasktracker_port}|${datanode_port}|${jobhistory_port})")
 
     # Security Configuration properties
 
-    $hue_keytab_path = $hue-site["hue_keytab"]
-    $hue_principal = $hue-site["hue_principal"]
+    $hue_keytab_path = hdp_get_value_from_map($hue-site, "hue_keytab", 
"${keytab_path}/hue.service.keytab")
+    $hue_principal = hdp_get_value_from_map($hue-site, "hue_principal", 
"hue/_HOST@${kerberos_domain}")
 
-  } else {
-    ##TODO: Temporary intialization
-    # Hue Configuration properties
-
-    $hue_debug_messages = "1"
-    $hue_database_logging = "0"
-    $hue_secret_key = 
"ThisisusedforsecurehashinginthesessionstoreSetthistoarandomstringthelongerthebetter"
-    $hue_http_host = "0.0.0.0"
-    $hue_http_port = "8000"
-    $hue_time_zone = "America/Los_Angeles"
-    $hue_django_debug_mode = "1"
-    $hue_use_cherrypy_server = "false"
-    $hue_http_500_debug_mode = "1"
-    $hue_server_user = "sandbox"
-    $hue_server_group = "sandbox"
-    $hue_backend_auth_policy = "desktop.auth.backend.AllowAllBackend"
-
-    $hue_hadoop_jt_host = hdp_default("jtnode_host")
-    $webhcat_server_host = hdp_default("webhcat_server_host")
-    $hue_templeton_url = "http://${webhcat_server_host}:50111/templeton/v1";
-    $hue_hive_home_dir = "/usr/lib/hive"
-    $hue_hadoop_yarn_host = ""
-    $hue_hadoop_yarn_port = ""
-
-    # Shell Configuration properties
-
-    $hue_pig_shell_command = "/usr/bin/pig -l /dev/null"
-    $hue_hbase_nice_name = "HBase Shell"
-    $hue_hbase_shell_command = "/usr/bin/hbase shell"
-    $hue_bash_nice_name = "Bash (Test only!!!)"
-    $hue_bash_shell_command = "/bin/bash"
-
-    $hue_whitelist = 
"(localhost|127\\.0\\.0\\.1):(${jtnode_port}|${namenode_port}|${tasktracker_port}|${datanode_port}|${jobhistory_port})"
   }
 
 }
\ No newline at end of file

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/service.pp
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/service.pp?rev=1463630&r1=1463629&r2=1463630&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/service.pp
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/manifests/service.pp
 Tue Apr  2 17:26:33 2013
@@ -26,7 +26,7 @@ class hdp-hue::service(
   include $hdp-hue::params
 
   $hue_user = $hdp-hue::params::hue_server_user
-  $hue_start_cmd = "/etc/init.d/hue start"
+  $hue_start_cmd = "/etc/init.d/hue start --USER=${hue_user} 
--LOGDIR=${hue_log_dir} --LOCKFILE=${hue_lock_file} 
--PIDFILE=${hue_pid_dir}/supervisor.pid"
   $hue_stop_cmd = "/etc/init.d/hue stop"
 
   $pid_dir = $hdp-hue::params::hue_pid_dir

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/templates/hue-ini.cfg.erb
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/templates/hue-ini.cfg.erb?rev=1463630&r1=1463629&r2=1463630&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/templates/hue-ini.cfg.erb
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hue/templates/hue-ini.cfg.erb
 Tue Apr  2 17:26:33 2013
@@ -182,11 +182,13 @@
   # ------------------------------------------------------------------------
   [[smtp]]
 
+  <% if scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_host") != 
"" %>
     # The SMTP server information for email notification delivery
     
host=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_host")%>
     
port=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_port")%>
     
user=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_user")%>
     
password=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_password")%>
+  <% end %>
 
     # Whether to use a TLS (secure) connection when talking to the SMTP server
     tls=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_smtp_tls")%>
@@ -488,7 +490,7 @@
   ## default_user_group=default
 
 [hcatalog]
-  
templeton_url=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_templeton_url")
+  
templeton_url=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_templeton_url")%>
 
 [proxy]
 
whitelist=<%=scope.function_hdp_template_var("::hdp-hue::params::hue_whitelist")%>

Added: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_value_from_map.rb
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_value_from_map.rb?rev=1463630&view=auto
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_value_from_map.rb
 (added)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/lib/puppet/parser/functions/hdp_get_value_from_map.rb
 Tue Apr  2 17:26:33 2013
@@ -0,0 +1,37 @@
+#
+#
+# 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.
+#
+#
+module Puppet::Parser::Functions
+  newfunction(:hdp_get_value_from_map, :type => :rvalue) do |args|
+    args = function_hdp_args_as_array(args)
+    hashMap = args[0]
+    key = args[1]
+    default = args[2]
+    val = hashMap.fetch(key, default.to_s)
+    if default == true or default == false
+      casted_val = (val == "true" or val == true) # converting to boolean
+    else # default
+      casted_val = val
+    end
+    function_hdp_is_empty(val) ? (default||"") : casted_val
+  end
+end
+
+

Modified: 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
URL: 
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp?rev=1463630&r1=1463629&r2=1463630&view=diff
==============================================================================
--- 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
 (original)
+++ 
incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp/manifests/params.pp
 Tue Apr  2 17:26:33 2013
@@ -359,7 +359,7 @@ class hdp::params()
       64 => ['ambari-log4j']
     },
     hue-server => {
-      64 => ['sandbox-hue-bin-1.2.1']
+      64 => ['hue.noarch']
     }
   }
   $packages = 'bigtop' 
@@ -389,6 +389,7 @@ class hdp::params()
     $hcat_server_host = hdp_default("hcat_server_host")
     $hcat_mysql_host = hdp_default("hcat_mysql_host")
     $hue_conf_dir = "/etc/hue/conf"
+    $hive_conf_dir = "/etc/hive/conf"
 
   } elsif ($packages == 'bigtop') {  
 
@@ -613,7 +614,7 @@ class hdp::params()
     },
 
     hue-server => {
-      64 => {'ALL' => 'sandbox-hue-bin-1.2.1'}
+      64 => {'ALL' => 'hue.noarch'}
     },
 
     ambari-log4j => {


Reply via email to