You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2015/11/25 22:23:46 UTC

ambari git commit: AMBARI-14061. Oozie/Hive "Database Name" field validation missed. (Andriy Babiichuk via Jaimin)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 d5273a57b -> bc7e0caba


AMBARI-14061. Oozie/Hive "Database Name" field validation missed. (Andriy Babiichuk via Jaimin)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bc7e0cab
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bc7e0cab
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bc7e0cab

Branch: refs/heads/branch-2.1
Commit: bc7e0caba1657d9702d7bc3567dfcdf094f0f988
Parents: d5273a5
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Wed Nov 25 13:22:26 2015 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Wed Nov 25 13:22:26 2015 -0800

----------------------------------------------------------------------
 .../HIVE/0.12.0.2.0/configuration/hive-env.xml          |  1 +
 .../HIVE/0.12.0.2.0/configuration/hive-site.xml         |  1 +
 .../OOZIE/4.0.0.2.0/configuration/oozie-site.xml        |  1 +
 .../OOZIE/4.2.0.2.3/configuration/oozie-site.xml        |  1 +
 .../BIGTOP/0.8/services/HIVE/configuration/hive-env.xml |  3 +++
 .../0.8/services/HIVE/configuration/hive-site.xml       |  3 +++
 .../0.8/services/OOZIE/configuration/oozie-site.xml     |  3 +++
 .../HDP/2.2/services/HIVE/configuration/hive-site.xml   |  1 +
 .../services/HIVE/configuration/hive-site.xml           |  3 +++
 .../services/OOZIE/configuration/oozie-site.xml         |  3 +++
 .../2.2/services/HIVE/configuration/hive-site.xml       |  1 +
 .../models/configs/objects/service_config_property.js   | 12 ++++++++++++
 ambari-web/app/utils/validator.js                       | 10 ++++++++++
 13 files changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
index 86165be..446cc6b 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-env.xml
@@ -80,6 +80,7 @@
     <value>hive</value>
     <description>Database name.</description>
     <value-attributes>
+      <type>database</type>
       <visible>false</visible>
       <editable-only-at-install>true</editable-only-at-install>
       <overridable>false</overridable>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
index de2d900..9c452d7 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/configuration/hive-site.xml
@@ -37,6 +37,7 @@ limitations under the License.
     <display-name>Database Name</display-name>
     <description>Database name used as the Hive Metastore</description>
     <value-attributes>
+      <type>database</type>
       <type>host</type>
       <overridable>false</overridable>
     </value-attributes>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-site.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-site.xml
index b2d1147..ff54f47 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-site.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/configuration/oozie-site.xml
@@ -110,6 +110,7 @@
       Oozie DataBase Name
     </description>
     <value-attributes>
+      <type>database</type>
       <overridable>false</overridable>
     </value-attributes>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml
index acf0809..6acf2e7 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.2.0.2.3/configuration/oozie-site.xml
@@ -95,6 +95,7 @@
       Oozie DataBase Name
     </description>
     <value-attributes>
+      <type>database</type>
       <overridable>false</overridable>
     </value-attributes>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-env.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-env.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-env.xml
index 9612e7d..bda34e0 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-env.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-env.xml
@@ -42,6 +42,9 @@
     <name>hive_database_name</name>
     <value>hive</value>
     <description>Database name.</description>
+    <value-attributes>
+      <type>database</type>
+    </value-attributes>
   </property>
   <property>
     <name>hive_dbroot</name>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-site.xml
index 87940a7..e72f1aa 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HIVE/configuration/hive-site.xml
@@ -30,6 +30,9 @@ limitations under the License.
     <name>ambari.hive.db.schema.name</name>
     <value>hive</value>
     <description>Database name used as the Hive Metastore</description>
+    <value-attributes>
+      <type>database</type>
+    </value-attributes>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/configuration/oozie-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/configuration/oozie-site.xml b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/configuration/oozie-site.xml
index 83ca880..eb3e5f6 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/configuration/oozie-site.xml
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/OOZIE/configuration/oozie-site.xml
@@ -108,6 +108,9 @@
     <description>
       Oozie DataBase Name
     </description>
+    <value-attributes>
+      <type>database</type>
+    </value-attributes>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
index 7715375..291a338 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/HIVE/configuration/hive-site.xml
@@ -1411,6 +1411,7 @@ limitations under the License.
     <display-name>Database Name</display-name>
     <description>Database name used as the Hive Metastore</description>
     <value-attributes>
+      <type>database</type>
       <overridable>false</overridable>
     </value-attributes>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HIVE/configuration/hive-site.xml
index c972ee5..8e0d4e1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/HIVE/configuration/hive-site.xml
@@ -29,6 +29,9 @@ limitations under the License.
     <name>ambari.hive.db.schema.name</name>
     <value>hive</value>
     <description>Database name used as the Hive Metastore</description>
+    <value-attributes>
+      <type>database</type>
+    </value-attributes>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/OOZIE/configuration/oozie-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/OOZIE/configuration/oozie-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/OOZIE/configuration/oozie-site.xml
index 0e54ad3..dbdae9a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/OOZIE/configuration/oozie-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3.GlusterFS/services/OOZIE/configuration/oozie-site.xml
@@ -115,6 +115,9 @@
     <description>
       Oozie DataBase Name
     </description>
+    <value-attributes>
+      <type>database</type>
+    </value-attributes>
   </property>
 
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml b/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml
index b44b421..cfef137 100644
--- a/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDPWIN/2.2/services/HIVE/configuration/hive-site.xml
@@ -1404,6 +1404,7 @@ limitations under the License.
     <display-name>Database Name</display-name>
     <description>Database name used as the Hive Metastore</description>
     <value-attributes>
+      <type>database</type>
       <overridable>false</overridable>
     </value-attributes>
   </property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index bca0ed2..3fb1fa5 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -483,6 +483,18 @@ App.ServiceConfigProperty = Em.Object.extend({
             isError = true;
           }
           break;
+        case 'user':
+          if (!validator.isValidUNIXUser(value)){
+            this.set('errorMessage', 'Username is not valid');
+            isError = true;
+          }
+          break;
+        case 'database':
+          if (!validator.isValidDbName(value)){
+            this.set('errorMessage', 'Database is not valid');
+            isError = true;
+          }
+          break;
         case 'multiLine':
         case 'content':
         default:

http://git-wip-us.apache.org/repos/asf/ambari/blob/bc7e0cab/ambari-web/app/utils/validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/validator.js b/ambari-web/app/utils/validator.js
index f6cb451..63c3aa6 100644
--- a/ambari-web/app/utils/validator.js
+++ b/ambari-web/app/utils/validator.js
@@ -169,6 +169,16 @@ module.exports = {
   },
 
   /**
+   * validate db name
+   * @param value
+   * @returns {boolean}
+   */
+  isValidDbName: function(value) {
+    var dbPattern = /^\S+$/;
+    return dbPattern.test(value);
+  },
+
+  /**
    * validate key of configurations
    * @param value
    * @return {Boolean}