You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/04/27 19:16:14 UTC

[07/14] ambari git commit: AMBARI-20843. Client configs downloaded via Ambari are empty with non-root ambari-server (aonishuk)

AMBARI-20843. Client configs downloaded via Ambari are empty with non-root ambari-server (aonishuk)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 101942df479c7e572eb3c5c984eef0903b44d05c
Parents: f4877c8
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Apr 25 14:22:07 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Apr 27 15:11:59 2017 +0300

----------------------------------------------------------------------
 .../libraries/script/script.py                  |  6 +--
 .../internal/ClientConfigResourceProvider.java  | 41 ++++++++++----------
 .../stacks/2.0.6/HDFS/test_hdfs_client.py       | 10 ++---
 3 files changed, 28 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/101942df/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index a08feab..da47351 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -911,19 +911,19 @@ class Script(object):
         for filename, dict in file_dict.iteritems():
           XmlConfig(filename,
                     conf_dir=conf_tmp_dir,
-                    mode=0600,
+                    mode=0644,
                     **self.generate_configs_get_xml_file_content(filename, dict)
           )
       for file_dict in env_configs_list:
         for filename,dicts in file_dict.iteritems():
           File(os.path.join(conf_tmp_dir, filename),
-               mode=0600,
+               mode=0644,
                content=InlineTemplate(self.generate_configs_get_template_file_content(filename, dicts)))
 
       for file_dict in properties_configs_list:
         for filename, dict in file_dict.iteritems():
           PropertiesFile(os.path.join(conf_tmp_dir, filename),
-                         mode=0600,
+                         mode=0644,
                          properties=self.generate_configs_get_xml_file_dict(filename, dict)
           )
       with closing(tarfile.open(output_filename, "w:gz")) as tar:

http://git-wip-us.apache.org/repos/asf/ambari/blob/101942df/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
index e42bd45..4ad01a5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java
@@ -585,28 +585,27 @@ public class ClientConfigResourceProvider extends AbstractControllerResourceProv
     throws SystemException {
     processExecutor.shutdown();
     try {
-      if (!processExecutor.awaitTermination(timeout, TimeUnit.MILLISECONDS)) {
-        processExecutor.shutdownNow();
-        for (CommandLineThreadWrapper commandLineThreadWrapper: pythonCmdThreads) {
-          CommandLineThread commandLineThread = commandLineThreadWrapper.getCommandLineThread();
-          try {
-            Integer returnCode = commandLineThread.getReturnCode();
-            if (returnCode == null) {
-              throw new TimeoutException();
-            } else if (returnCode != 0) {
-              throw new ExecutionException(String.format("Execution of \"%s\" returned %d.", commandLineThreadWrapper.getCommandLine(), returnCode),
-                new Throwable(commandLineThreadWrapper.getLogStream().getOutput()));
-            }
-          } catch (TimeoutException e) {
-            LOG.error("Generate client configs script was killed due to timeout ", e);
-            throw new SystemException("Generate client configs script was killed due to timeout ", e);
-          } catch (ExecutionException e) {
-            LOG.error(e.getMessage(), e);
-            throw new SystemException(e.getMessage() + " " + e.getCause());
-          } finally {
-            commandLineThreadWrapper.getProcess().destroy();
+      processExecutor.awaitTermination(timeout, TimeUnit.MILLISECONDS);
+      processExecutor.shutdownNow();
+      for (CommandLineThreadWrapper commandLineThreadWrapper: pythonCmdThreads) {
+        CommandLineThread commandLineThread = commandLineThreadWrapper.getCommandLineThread();
+        try {
+          Integer returnCode = commandLineThread.getReturnCode();
+          if (returnCode == null) {
+            throw new TimeoutException();
+          } else if (returnCode != 0) {
+            throw new ExecutionException(String.format("Execution of \"%s\" returned %d.", commandLineThreadWrapper.getCommandLine(), returnCode),
+              new Throwable(commandLineThreadWrapper.getLogStream().getOutput()));
           }
-        }  
+        } catch (TimeoutException e) {
+          LOG.error("Generate client configs script was killed due to timeout ", e);
+          throw new SystemException("Generate client configs script was killed due to timeout ", e);
+        } catch (ExecutionException e) {
+          LOG.error(e.getMessage(), e);
+          throw new SystemException(e.getMessage() + " " + e.getCause());
+        } finally {
+          commandLineThreadWrapper.getProcess().destroy();
+        }
       }
     } catch (InterruptedException e) {
       Thread.currentThread().interrupt();

http://git-wip-us.apache.org/repos/asf/ambari/blob/101942df/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
index fc80849..bcd9c80 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HDFS/test_hdfs_client.py
@@ -50,25 +50,25 @@ class Test(RMFTestCase):
                               )
     self.assertResourceCalled('XmlConfig', 'hdfs-site.xml',
                               conf_dir = '/tmp/123',
-                              mode=0600,
+                              mode=0644,
                               configuration_attributes = self.getConfig()['configuration_attributes']['hdfs-site'],
                               configurations = self.getConfig()['configurations']['hdfs-site'],
                               )
     self.assertResourceCalled('File', '/tmp/123/hadoop-env.sh',
-                              mode=0600,
+                              mode=0644,
                               content = InlineTemplate(self.getConfig()['configurations']['hadoop-env']['content']),
                               )
     self.assertResourceCalled('File', '/tmp/123/log4j.properties',
-                              mode=0600,
+                              mode=0644,
                               content = InlineTemplate(self.getConfig()['configurations']['hdfs-log4j']['content']+
                                                        self.getConfig()['configurations']['yarn-log4j']['content']),
                               )
     self.assertResourceCalled('PropertiesFile', '/tmp/123/runtime.properties',
-                              mode=0600,
+                              mode=0644,
                               properties = UnknownConfigurationMock(),
     )
     self.assertResourceCalled('PropertiesFile', '/tmp/123/startup.properties',
-                              mode=0600,
+                              mode=0644,
                               properties = UnknownConfigurationMock(),
     )
     self.assertResourceCalled('Directory', '/tmp/123',