This is an automated email from the ASF dual-hosted git repository.
mpapirkovskyy pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new a112364 AMBARI-25235. Add a sysprep configurations to run
conf-selects only a single time. (#2920)
a112364 is described below
commit a112364df203008048448759341e1e4ef9f97563
Author: Myroslav Papirkovskyi <[email protected]>
AuthorDate: Tue Apr 9 21:36:55 2019 +0300
AMBARI-25235. Add a sysprep configurations to run conf-selects only a
single time. (#2920)
---
.../resources/stack-hooks/after-INSTALL/scripts/params.py | 3 +++
.../after-INSTALL/scripts/shared_initialization.py | 15 +++++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git
a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
index 5b6e864..910b02c 100644
---
a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
+++
b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/params.py
@@ -28,6 +28,7 @@ from resource_management.libraries.functions import
conf_select
from resource_management.libraries.functions import stack_select
from resource_management.libraries.functions import format_jvm_option
from resource_management.libraries.functions.version import
format_stack_version, get_major_version
+from resource_management.libraries.functions.format import format
from string import lower
config = Script.get_config()
@@ -120,3 +121,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 = format("{tmp_dir}/conf_select_done_marker")
diff --git
a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/shared_initialization.py
b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/shared_initialization.py
index 8e0c2f3..ca3cdc6 100644
---
a/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/shared_initialization.py
+++
b/ambari-server/src/main/resources/stack-hooks/after-INSTALL/scripts/shared_initialization.py
@@ -135,7 +135,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