Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.maint fc79361df -> 524a8e303


AMBARI-11018. Unable to register host with non root ssh user (aonishuky)


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

Branch: refs/heads/branch-2.0.maint
Commit: 524a8e30382ba27e8fcccbcd5315c2e61ca5d7be
Parents: fc79361
Author: Andrew Onishuk <[email protected]>
Authored: Tue May 12 13:46:28 2015 +0300
Committer: Andrew Onishuk <[email protected]>
Committed: Tue May 12 13:46:28 2015 +0300

----------------------------------------------------------------------
 ambari-server/src/main/python/bootstrap.py     | 5 ++++-
 ambari-server/src/test/python/TestBootstrap.py | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/524a8e30/ambari-server/src/main/python/bootstrap.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/bootstrap.py 
b/ambari-server/src/main/python/bootstrap.py
index 111ff46..9016e98 100755
--- a/ambari-server/src/main/python/bootstrap.py
+++ b/ambari-server/src/main/python/bootstrap.py
@@ -42,6 +42,8 @@ MAX_PARALLEL_BOOTSTRAPS = 20
 POLL_INTERVAL_SEC = 1
 DEBUG = False
 DEFAULT_AGENT_TEMP_FOLDER = "/var/lib/ambari-agent/data/tmp"
+DEFAULT_AGENT_DATA_FOLDER = "/var/lib/ambari-agent/data"
+DEFAULT_AGENT_LIB_FOLDER = "/var/lib/ambari-agent"
 PYTHON_ENV="env PYTHONPATH=$PYTHONPATH:" + DEFAULT_AGENT_TEMP_FOLDER
 
 
@@ -245,7 +247,8 @@ class Bootstrap(threading.Thread):
     params = self.shared_state
     user = params.user
 
-    command = "sudo mkdir -p {0} ; sudo chown -R {1} 
{0}".format(self.TEMP_FOLDER,quote_bash_args(params.user))
+    command = "sudo mkdir -p {0} ; sudo chown -R {1} {0} ; sudo chmod 755 {3} 
; sudo chmod 755 {2} ; sudo chmod 755 {0}".format(
+      self.TEMP_FOLDER, quote_bash_args(params.user), 
DEFAULT_AGENT_DATA_FOLDER, DEFAULT_AGENT_LIB_FOLDER)
 
     ssh = SSH(params.user, params.sshkey_file, self.host, command,
               params.bootdir, self.host_log)

http://git-wip-us.apache.org/repos/asf/ambari/blob/524a8e30/ambari-server/src/test/python/TestBootstrap.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/TestBootstrap.py 
b/ambari-server/src/test/python/TestBootstrap.py
index 373a4be..d0c4a6f 100644
--- a/ambari-server/src/test/python/TestBootstrap.py
+++ b/ambari-server/src/test/python/TestBootstrap.py
@@ -361,7 +361,10 @@ class TestBootstrap(TestCase):
     command = str(init_mock.call_args[0][3])
     self.assertEqual(command,
                      "sudo mkdir -p /var/lib/ambari-agent/data/tmp ; "
-                     "sudo chown -R root /var/lib/ambari-agent/data/tmp")
+                     "sudo chown -R root /var/lib/ambari-agent/data/tmp ; "
+                     "sudo chmod 755 /var/lib/ambari-agent ; "
+                     "sudo chmod 755 /var/lib/ambari-agent/data ; "
+                     "sudo chmod 755 /var/lib/ambari-agent/data/tmp")
 
   @patch.object(Bootstrap, "getOsCheckScript")
   @patch.object(Bootstrap, "getOsCheckScriptRemoteLocation")

Reply via email to