AMBARI-18993. Perf: Status commands return INSTALLED even if component in 
STARTED state.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 4e4a1f92b48b0de703acbb1028c29b62a99d4c02
Parents: 8278384
Author: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Authored: Sun Nov 27 19:17:58 2016 +0200
Committer: Vitaly Brodetskyi <vbrodets...@hortonworks.com>
Committed: Sun Nov 27 19:17:58 2016 +0200

----------------------------------------------------------------------
 ambari-agent/conf/unix/agent-multiplier.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4e4a1f92/ambari-agent/conf/unix/agent-multiplier.py
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/agent-multiplier.py 
b/ambari-agent/conf/unix/agent-multiplier.py
index dec79eb..7c0774c 100644
--- a/ambari-agent/conf/unix/agent-multiplier.py
+++ b/ambari-agent/conf/unix/agent-multiplier.py
@@ -59,10 +59,12 @@ class Multiplier:
     self.log_dir = "/var/log/ambari-agent"
     self.config_dir = "/etc/ambari-agent/conf"
     self.pid_file = "/var/run/ambari-agent/ambari-agent.pid"
+    self.prefix_dir = "/var/lib/ambari-agent/data"
 
     # Ambari Agent config file to use as a template
     # Will change hostname and port after copying
     self.source_config_file = "/etc/ambari-agent/conf/ambari-agent.ini"
+    self.source_version_file = "/var/lib/ambari-agent/data/version"
     self.base_ping_port = 5000
 
     self.start = 0
@@ -159,11 +161,12 @@ class Multiplier:
       host_config_dir = host_home_dir + self.config_dir
       host_pid_file = host_home_dir + self.pid_file
       host_pid_dir = os.path.dirname(host_pid_file)
+      host_prefix = host_home_dir + self.prefix_dir
 
       if self.verbose:
         print "Analyzing host %s with port %d" % (host_name, host.ping_port)
 
-      for dir in [host_home_dir, host_log_dir, host_config_dir, host_pid_dir]:
+      for dir in [host_home_dir, host_log_dir, host_config_dir, host_pid_dir, 
host_prefix]:
         if not os.path.isdir(dir):
           print "Creating dir %s" % (dir)
           os.makedirs(dir)
@@ -174,6 +177,12 @@ class Multiplier:
         print "Copying config file %s" % str(host_config_file)
         shutil.copyfile(self.source_config_file, host_config_file)
 
+      # Copy version file
+      version_file = os.path.join(host_prefix, "version")
+      if not os.path.isfile(version_file):
+        print "Copying version file %s" % str(version_file)
+        shutil.copyfile(self.source_version_file, version_file)
+
       # Create hostname.sh script to use custom FQDN for each agent.
       host_name_script = os.path.join(host_config_dir, "hostname.sh")
       self.create_host_name_script(host_name, host_name_script)
@@ -183,7 +192,8 @@ class Multiplier:
                      "hostname_script": host_name_script,
                      "public_hostname_script": host_name_script,
                      "logdir": host_log_dir,
-                     "piddir": host_pid_dir}
+                     "piddir": host_pid_dir,
+                     "prefix": host_prefix}
       self.change_config(host_config_file, config_dict)
 
       # Change /etc/hosts file by appending each hostname.

Reply via email to