Skip to content

Commit d14e55b

Browse files
authored
Fix target file generation regression (#910)
* Fix not generating variable files when target without -variable_file in the cli * Fix regression * fix copy logic
1 parent 645360c commit d14e55b

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

core/src/main/python/discover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def main(args):
533533
aliases = Aliases(model_context, wlst_mode=__wlst_mode, exception_type=ExceptionType.DISCOVER)
534534
model = None
535535
credential_injector = None
536-
if model_context.get_variable_file() is not None:
536+
if model_context.get_variable_file() is not None or model_context.get_target() is not None:
537537
credential_injector = CredentialInjector(_program_name, dict(), model_context,
538538
WebLogicHelper(__logger).get_actual_weblogic_version())
539539

core/src/main/python/wlsdeploy/util/target_configuration_helper.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ def process_target_arguments(argument_map):
9191
__logger.throwing(ex, class_name=__class_name, method_name=_method_name)
9292
raise ex
9393

94+
# Set the -variable_file parameter if not present with default
95+
# if CommandLineArgUtil.VARIABLE_FILE_SWITCH not in argument_map:
96+
# path = os.path.join(output_dir, target_name + "_variable.properties")
97+
# argument_map[CommandLineArgUtil.VARIABLE_FILE_SWITCH] = path
98+
9499

95100
def _prepare_k8s_secrets(model_context, token_dictionary, model_dictionary):
96101

core/src/main/python/wlsdeploy/util/variables.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,22 @@ def get_default_variable_file_name(model_context):
125125
:return: location and file name of variable properties file.
126126
"""
127127
_method_name = 'get_default_variable_file_name'
128-
extract_file_name = model_context.get_model_file()
129-
if not extract_file_name:
130-
extract_file_name = model_context.get_archive_file_name()
131-
default_variable_file = path_utils.get_filename_no_ext_from_path(extract_file_name)
128+
129+
if model_context.get_target() is not None:
130+
default_variable_file = os.path.join(model_context.get_output_dir(), model_context.get_target() +
131+
"_variable.properties")
132+
else:
133+
extract_file_name = model_context.get_model_file()
134+
if not extract_file_name:
135+
extract_file_name = model_context.get_archive_file_name()
136+
default_variable_file = path_utils.get_filename_no_ext_from_path(extract_file_name)
137+
138+
if default_variable_file:
139+
default_variable_file = os.path.join(path_utils.get_pathname_from_path(extract_file_name),
140+
default_variable_file + '.properties')
132141
if default_variable_file:
133-
default_variable_file = os.path.join(path_utils.get_pathname_from_path(extract_file_name),
134-
default_variable_file + '.properties')
135142
_logger.finer('WLSDPLY-01736', default_variable_file, class_name=_class_name, method_name=_method_name)
143+
136144
return default_variable_file
137145

138146

0 commit comments

Comments
 (0)