ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject git commit: AMBARI-3995. Pluggable services: few changes to command-??.json (dlysnichenko)
Date Thu, 05 Dec 2013 18:32:54 GMT
Updated Branches:
  refs/heads/trunk bdb466979 -> 3f2d61e17


AMBARI-3995. Pluggable services: few changes to command-??.json (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 3f2d61e1710e12126cfff9fd1cf42c6cf223be5f
Parents: bdb4669
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Thu Dec 5 20:31:25 2013 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Thu Dec 5 20:32:31 2013 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/CustomServiceOrchestrator.py  | 6 ++++++
 .../test/python/ambari_agent/TestCustomServiceOrchestrator.py  | 6 +++++-
 .../java/org/apache/ambari/server/state/ServiceOsSpecific.java | 6 ++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2d61e1/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 6c86858..9e7989c 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -27,6 +27,7 @@ from FileCache import FileCache
 from AgentException import AgentException
 from PythonExecutor import PythonExecutor
 from AmbariConfig import AmbariConfig
+import hostname
 
 
 logger = logging.getLogger()
@@ -95,6 +96,11 @@ class CustomServiceOrchestrator():
     """
     Converts command to json file and returns file path
     """
+    # Perform few modifications to stay compatible with the way in which
+    # site.pp files are generated by manifestGenerator.py
+    public_fqdn = hostname.public_hostname()
+    command['public_hostname'] = public_fqdn
+    # Now, dump the json file
     task_id = command['taskId']
     file_path = os.path.join(self.tmp_dir, "command-{0}.json".format(task_id))
     # Command json contains passwords, that's why we need proper permissions

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2d61e1/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index 724dd5f..8a6ef07 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -52,7 +52,9 @@ class TestCustomServiceOrchestrator(TestCase):
     self.config.set('agent', 'cache_dir', "/cachedir")
 
 
-  def test_dump_command_to_json(self):
+  @patch("hostname.public_hostname")
+  def test_dump_command_to_json(self, hostname_mock):
+    hostname_mock.return_value = "test.hst"
     command = {
       'commandType': 'EXECUTION_COMMAND',
       'role': u'DATANODE',
@@ -73,6 +75,8 @@ class TestCustomServiceOrchestrator(TestCase):
     self.assertTrue(os.path.getsize(file) > 0)
     self.assertEqual(oct(os.stat(file).st_mode & 0777), '0600')
     os.unlink(file)
+    # Testing side effect of dump_command_to_json
+    self.assertEquals(command['public_hostname'], "test.hst")
 
 
   @patch("os.path.exists")

http://git-wip-us.apache.org/repos/asf/ambari/blob/3f2d61e1/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceOsSpecific.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceOsSpecific.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceOsSpecific.java
index 9e6ec2e..f494d4d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceOsSpecific.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceOsSpecific.java
@@ -21,6 +21,7 @@ import javax.xml.bind.annotation.*;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.google.gson.annotations.SerializedName;
 /**
  * Represents service os-specific details (like repositories and packages). 
  * Represents <code>osSpecific</code>
@@ -58,9 +59,14 @@ public class ServiceOsSpecific {
    */
   @XmlAccessorType(XmlAccessType.FIELD)
   public static class Repo {
+
+    @SerializedName("baseUrl")
     private String baseurl;
+    @SerializedName("mirrorsList")
     private String mirrorslist;
+    @SerializedName("repoId")
     private String repoid;
+    @SerializedName("repoName")
     private String reponame;
 
     private Repo() {


Mime
View raw message