You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/07/15 15:29:18 UTC
[2/2] ambari git commit: AMBARI-12418. Second confirmation of hosts
fails under combination of umask and non-root user (aonishuk)
AMBARI-12418. Second confirmation of hosts fails under combination of umask and non-root user (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/16912e59
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/16912e59
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/16912e59
Branch: refs/heads/branch-2.1
Commit: 16912e59e4b8ffbf46126f280ecd8753c583ea65
Parents: f4dbcba
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Wed Jul 15 16:29:08 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Wed Jul 15 16:29:08 2015 +0300
----------------------------------------------------------------------
ambari-server/src/main/python/bootstrap.py | 14 +++++++++++++-
ambari-server/src/test/python/TestBootstrap.py | 11 +++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/16912e59/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 95ad4d1..accee81 100755
--- a/ambari-server/src/main/python/bootstrap.py
+++ b/ambari-server/src/main/python/bootstrap.py
@@ -479,6 +479,9 @@ class BootstrapDefault(Bootstrap):
def getAptUpdateCommand(self):
return "sudo apt-get update -o Dir::Etc::sourcelist=\"%s/%s\" -o API::Get::List-Cleanup=\"0\" --no-list-cleanup" %\
("sources.list.d", self.AMBARI_REPO_FILENAME)
+
+ def getRepoFileChmodCommand(self):
+ return "sudo chmod 644 {0}".format(self.getRepoFile())
def copyNeededFiles(self):
# Copying the files
@@ -502,6 +505,15 @@ class BootstrapDefault(Bootstrap):
params.bootdir, self.host_log)
retcode2 = ssh.run()
self.host_log.write("\n")
+
+ # Change permissions on ambari.repo
+ self.host_log.write("==========================\n")
+ self.host_log.write("Changing permissions for ambari.repo...")
+ command = self.getRepoFileChmodCommand()
+ ssh = SSH(params.user, params.sshkey_file, self.host, command,
+ params.bootdir, self.host_log)
+ retcode4 = ssh.run()
+ self.host_log.write("\n")
# Update repo cache for ubuntu OS
if OSCheck.is_ubuntu_family():
@@ -522,7 +534,7 @@ class BootstrapDefault(Bootstrap):
retcode3 = scp.run()
self.host_log.write("\n")
- return max(retcode1["exitstatus"], retcode2["exitstatus"], retcode3["exitstatus"])
+ return max(retcode1["exitstatus"], retcode2["exitstatus"], retcode3["exitstatus"], retcode4["exitstatus"])
def getAmbariPort(self):
server_port = self.shared_state.server_port
http://git-wip-us.apache.org/repos/asf/ambari/blob/16912e59/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 9c0e78e..bfeaa2f 100644
--- a/ambari-server/src/test/python/TestBootstrap.py
+++ b/ambari-server/src/test/python/TestBootstrap.py
@@ -438,11 +438,12 @@ class TestBootstrap(TestCase):
expected1 = {"exitstatus": 42, "log": "log42", "errormsg": "errorMsg"}
expected2 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
expected3 = {"exitstatus": 1, "log": "log1", "errormsg": "errorMsg"}
+ expected4 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
scp_init_mock.return_value = None
ssh_init_mock.return_value = None
# Testing max retcode return
scp_run_mock.side_effect = [expected1, expected3]
- ssh_run_mock.side_effect = [expected2]
+ ssh_run_mock.side_effect = [expected2, expected4]
res = bootstrap_obj.copyNeededFiles()
self.assertEquals(res, expected1["exitstatus"])
input_file = str(scp_init_mock.call_args[0][3])
@@ -450,21 +451,23 @@ class TestBootstrap(TestCase):
self.assertEqual(input_file, "setupAgentFile")
self.assertEqual(remote_file, "RemoteName")
command = str(ssh_init_mock.call_args[0][3])
- self.assertEqual(command, "MoveRepoFileCommand")
+ self.assertEqual(command, "sudo chmod 644 RepoFile")
# Another order
expected1 = {"exitstatus": 0, "log": "log0", "errormsg": "errorMsg"}
expected2 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
expected3 = {"exitstatus": 1, "log": "log1", "errormsg": "errorMsg"}
+ expected4 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
scp_run_mock.side_effect = [expected1, expected3]
- ssh_run_mock.side_effect = [expected2]
+ ssh_run_mock.side_effect = [expected2, expected4]
res = bootstrap_obj.copyNeededFiles()
self.assertEquals(res, expected2["exitstatus"])
# yet another order
expected1 = {"exitstatus": 33, "log": "log33", "errormsg": "errorMsg"}
expected2 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
expected3 = {"exitstatus": 42, "log": "log42", "errormsg": "errorMsg"}
+ expected4 = {"exitstatus": 17, "log": "log17", "errormsg": "errorMsg"}
scp_run_mock.side_effect = [expected1, expected3]
- ssh_run_mock.side_effect = [expected2]
+ ssh_run_mock.side_effect = [expected2, expected4]
res = bootstrap_obj.copyNeededFiles()
self.assertEquals(res, expected3["exitstatus"])