AMBARI-18739. Perf: Create Rolling and Express Upgrade Packs. Another fix of 
concurrent cp (dlysnichenko)


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

Branch: refs/heads/branch-2.5
Commit: fc00433885a672f32acfaf5b0d14f547f270bd73
Parents: 0a243ef
Author: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Authored: Mon Jan 23 18:00:45 2017 +0200
Committer: Lisnichenko Dmitro <dlysniche...@hortonworks.com>
Committed: Mon Jan 23 18:01:22 2017 +0200

----------------------------------------------------------------------
 .../PERF/1.0/hooks/before-INSTALL/scripts/hook.py    | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fc004338/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
index 0865ef5..f030cfc 100644
--- 
a/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
+++ 
b/ambari-server/src/main/resources/stacks/PERF/1.0/hooks/before-INSTALL/scripts/hook.py
@@ -17,6 +17,8 @@ limitations under the License.
 
 """
 import os
+
+from resource_management import ExecutionFailed
 from resource_management.core.resources.system import Directory, File, Execute
 from resource_management.libraries.script import Hook
 
@@ -37,12 +39,17 @@ class BeforeInstallHook(Hook):
     cache_dir = self.extrakt_var_from_pythonpath(AMBARI_AGENT_CACHE_DIR)
     conf_select = os.path.join(cache_dir, CONF_SELECT_PY)
     dist_select = os.path.join(cache_dir, DISTRO_SELECT_PY)
-    if not os.path.exists(CONF_SELECT_DEST):
-      Execute("cp -f %s %s" % (conf_select, CONF_SELECT_DEST), user="root")
+    try:
+      Execute("cp -n %s %s" % (conf_select, CONF_SELECT_DEST), user="root")
       Execute("chmod a+x %s" % (CONF_SELECT_DEST), user="root")
-    if not os.path.exists(DISTRO_SELECT_DEST):
-      Execute("cp -f %s %s" % (dist_select, DISTRO_SELECT_DEST), user="root")
+    except ExecutionFailed:
+      pass   # Due to concurrent execution, may produce error
+
+    try:
+      Execute("cp -n %s %s" % (dist_select, DISTRO_SELECT_DEST), user="root")
       Execute("chmod a+x %s" % (DISTRO_SELECT_DEST), user="root")
+    except ExecutionFailed:
+      pass   # Due to concurrent execution, may produce error
 
   def extrakt_var_from_pythonpath(self, name):
 

Reply via email to