This is an automated email from the ASF dual-hosted git repository.

mpapirkovskyy pushed a commit to branch branch-2.6
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.6 by this push:
     new 6810159  AMBARI-25235. Add a sysprep configurations to run 
conf-selects only a single time. (mpapirkovskyy) (#2922)
6810159 is described below

commit 68101592bc2ea01606d920124e0cb48f348954dd
Author: Myroslav Papirkovskyi <mpapirkovs...@apache.org>
AuthorDate: Tue Apr 9 21:37:11 2019 +0300

    AMBARI-25235. Add a sysprep configurations to run conf-selects only a 
single time. (mpapirkovskyy) (#2922)
---
 .../HDP/2.0.6/hooks/after-INSTALL/scripts/params.py       |  2 ++
 .../hooks/after-INSTALL/scripts/shared_initialization.py  | 15 +++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
index 29a74e7..a1f4764 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/params.py
@@ -92,3 +92,5 @@ link_configs_lock_file = get_config_lock_file()
 stack_select_lock_file = os.path.join(tmp_dir, "stack_select_lock_file")
 
 upgrade_suspended = default("/roleParams/upgrade_suspended", False)
+sysprep_skip_conf_select = 
default("/configurations/cluster-env/sysprep_skip_conf_select", False)
+conf_select_marker_file = os.path.join(tmp_dir, "conf_select_done_marker")
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
index e28b825..f423136 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/after-INSTALL/scripts/shared_initialization.py
@@ -109,7 +109,14 @@ def link_configs(struct_out_file):
     Logger.info("Could not load 'version' from {0}".format(struct_out_file))
     return
 
-  # On parallel command execution this should be executed by a single process 
at a time.
-  with FcntlBasedProcessLock(params.link_configs_lock_file, enabled = 
params.is_parallel_execution_enabled, skip_fcntl_failures = True):
-    for package_name, directories in 
conf_select.get_package_dirs().iteritems():
-      conf_select.convert_conf_directories_to_symlinks(package_name, 
json_version, directories)
\ No newline at end of file
+  if not params.sysprep_skip_conf_select or not 
os.path.exists(params.conf_select_marker_file):
+    # On parallel command execution this should be executed by a single 
process at a time.
+    with FcntlBasedProcessLock(params.link_configs_lock_file, enabled = 
params.is_parallel_execution_enabled, skip_fcntl_failures = True):
+      for package_name, directories in 
conf_select.get_package_dirs().iteritems():
+        conf_select.convert_conf_directories_to_symlinks(package_name, 
json_version, directories)
+
+    # create a file to mark that conf-selects were already done
+    with open(params.conf_select_marker_file, "wb") as fp:
+      pass
+  else:
+    Logger.info(format("Skipping conf-select stage, since 
cluster-env/sysprep_skip_conf_select is set and mark file 
{conf_select_marker_file} exists"))
\ No newline at end of file

Reply via email to