incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject svn commit: r1487620 - in /incubator/ambari/trunk: CHANGES.txt ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
Date Wed, 29 May 2013 19:58:02 GMT
Author: swagle
Date: Wed May 29 19:58:02 2013
New Revision: 1487620

URL: http://svn.apache.org/r1487620
Log:
AMBARI-2221. Simplify JDBC driver setup process. (swagle)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
    incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1487620&r1=1487619&r2=1487620&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Wed May 29 19:58:02 2013
@@ -904,6 +904,8 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2221. Simplify JDBC driver setup process. (swagle)
+
  AMBARI-2220. Update deployed log4j conf for Hbase deployments from Ambari. 
  (swagle)
 

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp?rev=1487620&r1=1487619&r2=1487620&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
(original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-hive/manifests/jdbc-connector.pp
Wed May 29 19:58:02 2013
@@ -24,8 +24,13 @@ class hdp-hive::jdbc-connector()
 
   $jdbc_jar_name = $hdp-hive::params::jdbc_jar_name
   
+  
+  $java_share_dir = "/usr/share/java"
+  $driver_curl_target = "${java_share_dir}/${jdbc_jar_name}"  
   $hive_lib = $hdp-hive::params::hive_lib
   $target = "${hive_lib}/${jdbc_jar_name}"
+  $jdk_location = $hdp::params::jdk_location
+  $driver_curl_source = "${jdk_location}${jdbc_jar_name}"
   
   anchor { 'hdp-hive::jdbc-connector::begin':}
 
@@ -41,18 +46,18 @@ class hdp-hive::jdbc-connector()
        creates => $target,
        path    => ["/bin","/usr/bin/"],
        require => Hdp::Package['mysql-connector-java'],
-       notify  =>  Anchor['hdp-hive::jdbc-connector::end'],
+       before  =>  Anchor['hdp-hive::jdbc-connector::end'],
    }
   } elsif ($hive_jdbc_driver == "oracle.jdbc.driver.OracleDriver") {
-   hdp::exec { 'hive mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}':
-       command => "mkdir -p ${artifact_dir} ;  cp /usr/share/java/${jdbc_jar_name}  ${target}",
+   hdp::exec { 'hive mkdir -p ${artifact_dir} ; curl -f --retry 10 ${driver_curl_source}
-o ${driver_curl_target} &&  cp ${driver_curl_target} ${target}':
+       command => "mkdir -p ${artifact_dir} ; curl -f --retry 10 ${driver_curl_source}
-o ${driver_curl_target} &&  cp ${driver_curl_target} ${target}",
        unless  => "test -f ${target}",
        path    => ["/bin","/usr/bin/"],
-       notify  =>  Anchor['hdp-hive::jdbc-connector::end'],
+       before  =>  Anchor['hdp-hive::jdbc-connector::end'],
      }  
   }
 
 
    anchor { 'hdp-hive::jdbc-connector::end':}
-
+   
 }

Modified: incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp?rev=1487620&r1=1487619&r2=1487620&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
(original)
+++ incubator/ambari/trunk/ambari-agent/src/main/puppet/modules/hdp-oozie/manifests/service.pp
Wed May 29 19:58:02 2013
@@ -39,11 +39,21 @@ class hdp-oozie::service(
   $oozie_keytab = $hdp-oozie::params::oozie_service_keytab
   $oozie_principal = $configuration['oozie-site']['oozie.service.HadoopAccessorService.kerberos.principal']
   
+  $oracle_driver_jar_name = "ojdbc6.jar"
+  $java_share_dir = "/usr/share/java"
+  
+  $artifact_dir = $hdp::params::artifact_dir
+  $driver_location = $hdp::params::jdk_location
+  $driver_curl_target = "${java_share_dir}/${oracle_driver_jar_name}"
+  $curl_cmd = "curl -f --retry 10 ${driver_location}${oracle_driver_jar_name} -o ${driver_curl_target}"
+  
   $jdbc_driver_name = $configuration['oozie-site']['oozie.service.JPAService.jdbc.driver']
   if ($jdbc_driver_name == "com.mysql.jdbc.Driver"){
-    $jdbc_driver_jar = "/usr/share/java/mysql-connector-java.jar"
+    $jdbc_driver_jar = "${java_share_dir}/mysql-connector-java.jar"
+    $jdbc_driver_jar_target = "${libext_dir}/mysql-connector-java.jar"
   } elsif($jdbc_driver_name == "oracle.jdbc.driver.OracleDriver") {
-      $jdbc_driver_jar = "/usr/share/java/ojdbc6.jar"
+      $jdbc_driver_jar = "${java_share_dir}/${oracle_driver_jar_name}"
+      $jdbc_driver_jar_target = "${libext_dir}/${oracle_driver_jar_name}"
   }
   
   
@@ -55,22 +65,33 @@ class hdp-oozie::service(
   }
   
   if ($lzo_enabled == true) {
-    $lzo_jar_suffix = "-jars /usr/lib/hadoop/lib/hadoop-lzo-0.5.0.jar"
+    $lzo_jar_suffix = "/usr/lib/hadoop/lib/hadoop-lzo-0.5.0.jar"
   } else {
-    $lzo_jar_suffix = ""
+    $lzo_jar_suffix = undef
   }
 
-     
-        
+  if (($lzo_enabled == true) or ($jdbc_driver_name != undef)){
+    $jar_option = "-jars"         
+  } else {
+    $jar_option = ""
+  }
+
+  if (($lzo_enabled != undef) and ($jdbc_driver_name != undef)){
+    $jar_path = "${lzo_jar_suffix}:${jdbc_driver_jar}"        
+  } else {
+    $jar_path = "${lzo_jar_suffix}${jdbc_driver_jar}"
+  }
+
+              
   $cmd1 = "cd /usr/lib/oozie && tar -xvf oozie-sharelib.tar.gz"
   $cmd2 =  "cd /usr/lib/oozie && mkdir -p ${oozie_tmp}"
   $cmd3 =  "cd /usr/lib/oozie && chown ${user}:${hdp::params::user_group} ${oozie_tmp}"

      
   $cmd4 = $jdbc_driver_name ? {
-        /(com.mysql.jdbc.Driver|oracle.jdbc.driver.OracleDriver)/ => "cd ${oozie_tmp}
&& /usr/lib/oozie/bin/oozie-setup.sh -hadoop 0.20.200 $jar_location -jars $jdbc_driver_jar
-extjs $ext_js_path $lzo_jar_suffix",
-        default            => "cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-setup.sh
-hadoop 0.20.200 $jar_location -extjs $ext_js_path $lzo_jar_suffix",
+        /(com.mysql.jdbc.Driver|oracle.jdbc.driver.OracleDriver)/ => "cd ${oozie_tmp}
&& /usr/lib/oozie/bin/oozie-setup.sh -hadoop 0.20.200 $jar_location -extjs $ext_js_path
$jar_option $jar_path && cp $jdbc_driver_jar $jdbc_driver_jar_target",
+        default            => "cd ${oozie_tmp} && /usr/lib/oozie/bin/oozie-setup.sh
-hadoop 0.20.200 $jar_location -extjs $ext_js_path $jar_option $jar_path",
   }
-  $cmd5 =  "cd ${oozie_tmp} && /usr/lib/oozie/bin/ooziedb.sh create -sqlfile oozie.sql
-run ; echo 0"
+  $cmd5 =  "cd ${oozie_tmp} && /usr/lib/oozie/bin/ooziedb.sh create -sqlfile oozie.sql
-run "
   $cmd6 =  "su - ${user} -c '${kinit_if_needed}; hadoop dfs -put /usr/lib/oozie/share ${oozie_hdfs_user_dir}
; hadoop dfs -chmod -R 755 ${oozie_hdfs_user_dir}/share'"
   #$cmd7 = "/usr/lib/oozie/bin/oozie-start.sh"
 
@@ -93,13 +114,15 @@ class hdp-oozie::service(
   hdp-oozie::service::directory { $hdp-oozie::params::oozie_data_dir : }
   hdp-oozie::service::directory { $hdp-oozie::params::oozie_lib_dir : }
   hdp-oozie::service::directory { $hdp-oozie::params::oozie_webapps_dir : }
+  hdp-oozie::service::directory { $hdp-oozie::params::libext_dir : }
+  hdp-oozie::service::jdbc-connector-java { $hdp-oozie::params::libext_dir : }
 
   anchor{'hdp-oozie::service::begin':} -> Hdp-oozie::Service::Directory<||> ->
anchor{'hdp-oozie::service::end':}
   
   if ($ensure == 'installed_and_configured') {
     hdp-oozie::service::exec_sh{$sh_cmds:}
     hdp-oozie::service::exec_user{$user_cmds:}
-    Hdp-oozie::Service::Directory<||> -> Hdp-oozie::Service::Exec_sh[$cmd1] ->
Hdp-oozie::Service::Exec_sh[$cmd2] ->Hdp-oozie::Service::Exec_sh[$cmd3] -> Hdp-oozie::Service::Exec_user[$cmd4]
->Hdp-oozie::Service::Exec_user[$cmd5] -> Anchor['hdp-oozie::service::end']
+    Anchor['hdp-oozie::service::begin'] -> Hdp-oozie::Service::Jdbc-connector-java[$hdp-oozie::params::libext_dir]
-> Hdp-oozie::Service::Directory<||> -> Hdp-oozie::Service::Exec_sh[$cmd1] ->
Hdp-oozie::Service::Exec_sh[$cmd2] ->Hdp-oozie::Service::Exec_sh[$cmd3] -> Hdp-oozie::Service::Exec_user[$cmd4]
->Hdp-oozie::Service::Exec_user[$cmd5] -> Anchor['hdp-oozie::service::end']
   } elsif ($ensure == 'running') {
     hdp::exec { "exec $cmd6" :
       command => $cmd6,
@@ -121,6 +144,19 @@ class hdp-oozie::service(
   }
 }
 
+define hdp-oozie::service::jdbc-connector-java()
+{
+  if ($jdbc_driver_name == "com.mysql.jdbc.Driver"){
+   hdp::package { 'mysql-connector-java' : }
+  } elsif($jdbc_driver_name == "oracle.jdbc.driver.OracleDriver") {
+    exec{ "${curl_cmd} ${name}":
+      command => $curl_cmd,
+      path    => ["/bin","/usr/bin/"],
+      unless  => "test -e ${java_share_dir}/${oracle_driver_jar_name}",
+    } 
+  }                       
+}                      
+                      
 define hdp-oozie::service::directory()
 {
   hdp::directory_recursive_create { $name: 



Mime
View raw message