Browse Source

AMBARI-1314. Hostname test is failing in some environments. (Nate Cole via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1440776 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 12 years ago
parent
commit
7ea25f1865

+ 5 - 0
CHANGES.txt

@@ -350,6 +350,11 @@ Trunk (unreleased changes):
 
  AMBARI-1285. Some host Ganglia metrics may be missing in some cases. (tbeerbower)
 
+ AMBARI-1310. Get rid of mvn warnings. (Arun Kumar via mahadev)
+
+ AMBARI-1314. Hostname test is failing in some environments. (Nate Cole via
+ mahadev) 
+
 AMBARI-1.2.0 branch:
 
  INCOMPATIBLE CHANGES

+ 5 - 0
ambari-agent/pom.xml

@@ -30,6 +30,7 @@
   <name>Ambari Agent</name>
   <description>Ambari Agent</description>
   <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <final.name>${project.artifactId}-${project.version}</final.name>
     <package.release>1</package.release>
     <package.prefix>/usr</package.prefix>
@@ -59,6 +60,10 @@
   </profiles>
   <build>
     <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>

+ 6 - 3
ambari-agent/src/test/python/TestHostname.py

@@ -20,7 +20,7 @@ limitations under the License.
 
 from unittest import TestCase
 import ambari_agent.hostname as hostname
-from ambari_agent.AmbariConfig import AmbariConfig
+import ambari_agent.AmbariConfig as AmbariConfig
 import socket
 import tempfile
 import shutil
@@ -33,21 +33,24 @@ class TestHostname(TestCase):
     pass
 
   def test_hostname_override(self):
-    tmpname = tempfile.mkstemp(text=True)[1]
+    fd = tempfile.mkstemp(text=True)
+    tmpname = fd[1]
+    os.close(fd[0])
     os.chmod(tmpname, os.stat(tmpname).st_mode | stat.S_IXUSR)
 
     tmpfile = file(tmpname, "w+")
 
+    config = AmbariConfig.config
     try:
       tmpfile.write("#!/bin/sh\n\necho 'test.example.com'")
       tmpfile.close()
 
-      config = AmbariConfig().getConfig()
       config.set('agent', 'hostname_script', tmpname)
 
       self.assertEquals(hostname.hostname(), 'test.example.com', "expected hostname 'test.example.com'")
     finally:
       os.remove(tmpname)
+      config.remove_option('agent', 'hostname_script')
 
     pass
 

+ 7 - 0
ambari-project/pom.xml

@@ -25,6 +25,9 @@
   <description>Apache Ambari Project POM</description>
   <name>Apache Ambari Project POM</name>
   <packaging>pom</packaging>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
   <pluginRepositories>
     <pluginRepository>
       <id>maven2-repository.dev.java.net</id>
@@ -360,6 +363,10 @@
       </plugins>
     </pluginManagement>
     <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
       <plugin>
         <groupId>org.apache.rat</groupId>
         <artifactId>apache-rat-plugin</artifactId>

+ 5 - 0
ambari-server/pom.xml

@@ -27,10 +27,15 @@
   <version>1.2.0-SNAPSHOT</version>
   <description>Ambari Server</description>
   <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <python.ver>python &gt;= 2.6</python.ver>
   </properties>
   <build>
     <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
+      </plugin>
       <plugin>
         <artifactId>maven-assembly-plugin</artifactId>
         <configuration>

+ 1 - 0
ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java

@@ -133,6 +133,7 @@ public abstract class GangliaPropertyProvider extends AbstractPropertyProvider {
   /**
    * Get the ganglia cluster name for the given resource.
    *
+   *
    * @param resource  the resource
    *
    * @return the ganglia cluster name

+ 4 - 0
pom.xml

@@ -23,6 +23,9 @@
   <name>Ambari Main</name>
   <version>1.2.0-SNAPSHOT</version>
   <description>Ambari</description>
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
   <pluginRepositories>
     <pluginRepository>
       <id>maven2-repository.dev.java.net</id>
@@ -66,6 +69,7 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
+        <version>3.0</version>
         <configuration>
             <source>1.6</source>
             <target>1.6</target>