Repository: incubator-slider Updated Branches: refs/heads/develop 8b36b056b -> 644e135c6
SLIDER-208. Ongoing: keep Jenkins builds working Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/644e135c Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/644e135c Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/644e135c Branch: refs/heads/develop Commit: 644e135c6d92ef67faefd122c794630337d751e3 Parents: 8b36b05 Author: Sumit Mohanty <[email protected]> Authored: Thu Oct 23 22:16:51 2014 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Thu Oct 23 22:16:51 2014 -0700 ---------------------------------------------------------------------- slider-agent/src/main/python/agent/CustomServiceOrchestrator.py | 2 +- .../src/test/python/agent/TestCustomServiceOrchestrator.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/644e135c/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py b/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py index 1a88bb5..3932287 100644 --- a/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py +++ b/slider-agent/src/main/python/agent/CustomServiceOrchestrator.py @@ -233,7 +233,7 @@ class CustomServiceOrchestrator(): task_id = command['taskId'] file_path = os.path.realpath(posixpath.join(self.tmp_dir, "command-{0}.json".format(task_id))) # Json may contain passwords, that's why we need proper permissions - if os.path.isfile(file_path): + if os.path.isfile(file_path) and os.path.exists(file_path): os.unlink(file_path) self.finalize_command(command, store_command, allocated_ports) http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/644e135c/slider-agent/src/test/python/agent/TestCustomServiceOrchestrator.py ---------------------------------------------------------------------- diff --git a/slider-agent/src/test/python/agent/TestCustomServiceOrchestrator.py b/slider-agent/src/test/python/agent/TestCustomServiceOrchestrator.py index 7135e5b..6ada7fa 100644 --- a/slider-agent/src/test/python/agent/TestCustomServiceOrchestrator.py +++ b/slider-agent/src/test/python/agent/TestCustomServiceOrchestrator.py @@ -50,8 +50,7 @@ class TestCustomServiceOrchestrator(TestCase): @patch("hostname.public_hostname") @patch("os.path.isfile") - @patch("os.unlink") - def test_dump_command_to_json(self, unlink_mock, + def test_dump_command_to_json(self, isfile_mock, hostname_mock): hostname_mock.return_value = "test.hst" command = { @@ -108,7 +107,6 @@ class TestCustomServiceOrchestrator(TestCase): self.assertEquals(command['public_hostname'], "test.hst") self.assertEquals(command['hostname'], "test.hst") self.assertEquals(command['appmaster_hostname'], "test.hst") - self.assertTrue(unlink_mock.called) @patch.object(CustomServiceOrchestrator, "resolve_script_path")
