incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject svn commit: r1488002 - in /incubator/ambari/trunk: ./ ambari-agent/ ambari-server/ ambari-server/src/main/conf/ ambari-server/src/main/resources/ ambari-server/src/main/resources/upgrade/ddl/ ambari-server/src/test/java/org/apache/ambari/server/api/ser...
Date Thu, 30 May 2013 20:47:47 GMT
Author: smohanty
Date: Thu May 30 20:47:46 2013
New Revision: 1488002

URL: http://svn.apache.org/r1488002
Log:
AMBARI-2233. Ensure version values are used appropriately throughout Ambari. (smohanty)

Modified:
    incubator/ambari/trunk/CHANGES.txt
    incubator/ambari/trunk/ambari-agent/pom.xml
    incubator/ambari/trunk/ambari-server/pom.xml
    incubator/ambari/trunk/ambari-server/src/main/conf/ambari.properties
    incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
    incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql
    incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql
    incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaServiceTest.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
    incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
    incubator/ambari/trunk/version

Modified: incubator/ambari/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Thu May 30 20:47:46 2013
@@ -907,6 +907,9 @@ Trunk (unreleased changes):
 
  BUG FIXES
 
+ AMBARI-2233. Ensure version values are used appropriately throughout
+ Ambari. (smohanty)
+
  AMBARI-2229. Oracle driver loading broken on agent side. (smohanty)
 
  AMBARI-2228. Fix MySQL and Oracle DDL scripts according to last DB

Modified: incubator/ambari/trunk/ambari-agent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-agent/pom.xml?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-agent/pom.xml (original)
+++ incubator/ambari/trunk/ambari-agent/pom.xml Thu May 30 20:47:46 2013
@@ -61,6 +61,33 @@
   <build>
     <plugins>
       <plugin>
+         <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-version</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>parse-version</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>regex-property</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>ambariVersion</name>
+              <value>${project.version}</value>
+              <regex>-SNAPSHOT</regex>
+              <replacement></replacement>
+              <failIfNoMatch>false</failIfNoMatch>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
       </plugin>
@@ -298,6 +325,7 @@
               <sources>
                 <source>
                   <location>../version</location>
+                  <filter>true</filter>
                 </source>
               </sources>
             </mapping>

Modified: incubator/ambari/trunk/ambari-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/pom.xml?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/pom.xml (original)
+++ incubator/ambari/trunk/ambari-server/pom.xml Thu May 30 20:47:46 2013
@@ -33,6 +33,58 @@
   <build>
     <plugins>
       <plugin>
+         <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <version>1.8</version>
+        <executions>
+          <execution>
+            <id>parse-version</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>parse-version</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>regex-property</id>
+            <goals>
+              <goal>regex-property</goal>
+            </goals>
+            <configuration>
+              <name>ambariVersion</name>
+              <value>${project.version}</value>
+              <regex>-SNAPSHOT</regex>
+              <replacement></replacement>
+              <failIfNoMatch>false</failIfNoMatch>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-resources-plugin</artifactId>
+        <version>2.6</version>
+        <executions>
+          <execution>
+            <id>copy-resources</id>
+            <phase>generate-test-resources</phase>
+            <goals>
+              <goal>copy-resources</goal>
+            </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/</outputDirectory>
+              <resources>
+                <resource>
+                  <directory>${basedir}/../</directory>
+                  <includes>
+                      <include>**/version</include>
+                  </includes>
+                  <filtering>true</filtering>
+                </resource>
+              </resources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <version>3.0</version>
       </plugin>
@@ -256,6 +308,7 @@
               <sources>
                 <source>
                   <location>src/main/resources/Ambari-DDL-Postgres-CREATE.sql</location>
+                  <filter>true</filter>
                 </source>
                 <source>
                   <location>src/main/resources/Ambari-DDL-Postgres-DROP.sql</location>
@@ -276,6 +329,7 @@
               <sources>
                 <source>
                   <location>src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql</location>
+                  <filter>true</filter>
                 </source>
                 <source>
                   <location>src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.Fix.sql</location>
@@ -361,6 +415,7 @@
               <sources>
                 <source>
                   <location>../version</location>
+                  <filter>true</filter>
                 </source>
               </sources>
             </mapping>
@@ -419,6 +474,12 @@
         -->
       </plugin>
     </plugins>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
   </build>
   <profiles>
   </profiles>

Modified: incubator/ambari/trunk/ambari-server/src/main/conf/ambari.properties
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/conf/ambari.properties?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/conf/ambari.properties (original)
+++ incubator/ambari/trunk/ambari-server/src/main/conf/ambari.properties Thu May 30 20:47:46
2013
@@ -16,4 +16,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 metadata.path=src/main/resources/stacks
-server.version.file=../version
\ No newline at end of file
+server.version.file=target/version

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
Thu May 30 20:47:46 2013
@@ -177,7 +177,7 @@ insert into ambari.user_roles(role_name,
 select 'admin',1;
 
 insert into ambari.metainfo(metainfo_key, metainfo_value)
-select 'version','1.3.0';
+select 'version','${ambariVersion}';
 
 COMMIT;
 

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/mysql-ddl.sql Thu May 30 20:47:46
2013
@@ -102,7 +102,7 @@ insert into ambari.user_roles(role_name,
   select 'admin',1;
 
 insert into ambari.metainfo(`metainfo_key`, `metainfo_value`)
-  select 'version','1.3.0';
+  select 'version','${ambariVersion}';
 
 
 

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql (original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/oracle-DDL.sql Thu May 30 20:47:46
2013
@@ -117,7 +117,7 @@ GRANT ALL ON metainfo TO &1;
 INSERT INTO ambari_sequences(sequence_name, value) values ('host_role_command_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, value) values ('user_id_seq', 1);
 INSERT INTO ambari_sequences(sequence_name, value) values ('cluster_id_seq', 0);
-INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '1.3.0');
+INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '${ambariVersion}');
 
 insert into Roles(role_name)
 select 'admin' from dual

Modified: incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
(original)
+++ incubator/ambari/trunk/ambari-server/src/main/resources/upgrade/ddl/Ambari-DDL-Postgres-UPGRADE-1.3.0.sql
Thu May 30 20:47:46 2013
@@ -26,8 +26,6 @@ ALTER TABLE ambari.hosts
 ALTER TABLE ambari.clusterstate
   ADD COLUMN current_stack_version VARCHAR(255) NOT NULL;
 
-CREATE TABLE ambari.metainfo ("metainfo_key" VARCHAR(255), "metainfo_value" VARCHAR, PRIMARY
KEY("metainfo_key"));
-GRANT ALL PRIVILEGES ON TABLE ambari.metainfo TO :username;
 
 CREATE TABLE ambari.hostconfigmapping (cluster_id bigint NOT NULL, host_name VARCHAR(255)
NOT NULL, type_name VARCHAR(255) NOT NULL, version_tag VARCHAR(255) NOT NULL, service_name
VARCHAR(255), create_timestamp BIGINT NOT NULL, selected INTEGER NOT NULL DEFAULT 0, user_name
VARCHAR(255) NOT NULL DEFAULT '_db', PRIMARY KEY (cluster_id, host_name, type_name, create_timestamp));
 GRANT ALL PRIVILEGES ON TABLE ambari.hostconfigmapping TO :username;
@@ -57,10 +55,48 @@ drop sequence ambari.host_role_command_t
 drop sequence ambari.users_user_id_seq;
 drop sequence ambari.clusters_cluster_id_seq;
 
+CREATE LANGUAGE plpgsql;
+
 BEGIN;
 
-insert into ambari.metainfo(metainfo_key, metainfo_value)
-select 'version','1.3.0';
+CREATE OR REPLACE FUNCTION create_or_update_metainfo_table(ambariVersion VARCHAR, userName
TEXT) RETURNS text AS
+$$
+DECLARE
+    version VARCHAR(255) := 'version';
+    fqtn text := 'ambari.metainfo';
+BEGIN
+    IF NOT EXISTS (SELECT * FROM pg_tables WHERE tablename = 'metainfo') THEN
+        EXECUTE 'CREATE TABLE '
+        || fqtn
+        || ' (metainfo_key VARCHAR(255), metainfo_value VARCHAR, PRIMARY KEY(metainfo_key));';
+        EXECUTE 'GRANT ALL PRIVILEGES ON TABLE '
+        || fqtn
+        || ' TO '
+        || $2
+        || ';';
+        EXECUTE 'INSERT INTO '
+        || fqtn
+        || '(metainfo_key, metainfo_value) select '
+        || quote_literal(version)
+        || ','
+        || quote_literal($1)
+        || ';';
+        RETURN 'INFO: metainfo was created';
+    ELSE
+        EXECUTE 'UPDATE '
+        || fqtn
+        || ' SET metainfo_value = '
+        || quote_literal($1)
+        || ' WHERE metainfo_key = '
+        || quote_literal(version)
+        || ';';
+        RETURN 'INFO: metainfo was updated';
+    END IF;
+END;
+$$
+LANGUAGE 'plpgsql';
+
+SELECT create_or_update_metainfo_table('${ambariVersion}',:username);
 
 COMMIT;
 
@@ -69,8 +105,6 @@ UPDATE ambari.hostcomponentstate SET cur
 
 -- service to cluster level config mappings move. idempotent update
 
-CREATE LANGUAGE plpgsql;
-
 CREATE OR REPLACE FUNCTION update_clusterconfigmapping()
   RETURNS void AS
 $_$

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaInfoTest.java
Thu May 30 20:47:46 2013
@@ -82,7 +82,7 @@ public class AmbariMetaInfoTest {
   public void before() throws Exception {
     File stackRoot = new File("src/test/resources/stacks");
    LOG.info("Stacks file " + stackRoot.getAbsolutePath());
-    metaInfo = new AmbariMetaInfo(stackRoot, new File("../version"));
+    metaInfo = new AmbariMetaInfo(stackRoot, new File("target/version"));
     try {
       metaInfo.init();
     } catch(Exception e) {
@@ -280,7 +280,7 @@ public class AmbariMetaInfoTest {
     File stackRoot = new File("src/test/resources/stacks");
     File stackRootTmp = new File(buildDir + "/ambari-metaInfo"); stackRootTmp.mkdir();
     FileUtils.copyDirectory(stackRoot, stackRootTmp);
-    AmbariMetaInfo ambariMetaInfo = new AmbariMetaInfo(stackRootTmp, new File("../version"));
+    AmbariMetaInfo ambariMetaInfo = new AmbariMetaInfo(stackRootTmp, new File("target/version"));
     File f1, f2, f3;
     f1 = new File(stackRootTmp.getAbsolutePath() + "/001.svn"); f1.createNewFile();
     f2 = new File(stackRootTmp.getAbsolutePath() + "/abcd.svn/001.svn"); f2.mkdirs(); f2.createNewFile();

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaServiceTest.java?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaServiceTest.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/api/services/AmbariMetaServiceTest.java
Thu May 30 20:47:46 2013
@@ -67,7 +67,7 @@ public class AmbariMetaServiceTest exten
     AmbariMetaInfo ambariMetaInfo;
     
     public MockModule() throws Exception {
-      this.ambariMetaInfo = new AmbariMetaInfo(stackRoot, new File("../version"));
+      this.ambariMetaInfo = new AmbariMetaInfo(stackRoot, new File("target/version"));
     }
 
     @Override
@@ -108,4 +108,4 @@ public class AmbariMetaServiceTest exten
     ServiceInfo info = mapper.readValue(output, ServiceInfo.class);
     Assert.assertEquals("HDFS", info.getName());
   }
-}
\ No newline at end of file
+}

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
Thu May 30 20:47:46 2013
@@ -1479,7 +1479,7 @@ public class AmbariManagementControllerI
         properties.setProperty(Configuration.METADETA_DIR_PATH,
             "src/main/resources/stacks");
         properties.setProperty(Configuration.SERVER_VERSION_FILE,
-                "../version");
+                "target/version");
         properties.setProperty(Configuration.OS_VERSION_KEY,
             "centos5");
         try {

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/orm/InMemoryDefaultTestModule.java
Thu May 30 20:47:46 2013
@@ -33,7 +33,7 @@ public class InMemoryDefaultTestModule e
     properties.setProperty(Configuration.METADETA_DIR_PATH,
         "src/test/resources/stacks");
     properties.setProperty(Configuration.SERVER_VERSION_FILE,
-            "../version");
+            "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
         "centos5");
     try {

Modified: incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
(original)
+++ incubator/ambari/trunk/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationTestModule.java
Thu May 30 20:47:46 2013
@@ -35,7 +35,7 @@ public class AuthorizationTestModule ext
     properties.setProperty(Configuration.METADETA_DIR_PATH,
         "src/test/resources/stacks");
     properties.setProperty(Configuration.SERVER_VERSION_FILE,
-        "../version");
+        "target/version");
     properties.setProperty(Configuration.OS_VERSION_KEY,
         "centos5");
 

Modified: incubator/ambari/trunk/version
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/version?rev=1488002&r1=1488001&r2=1488002&view=diff
==============================================================================
--- incubator/ambari/trunk/version (original)
+++ incubator/ambari/trunk/version Thu May 30 20:47:46 2013
@@ -1 +1 @@
-1.3.0
\ No newline at end of file
+${ambariVersion}



Mime
View raw message