Skip to content

Commit cfb5efa

Browse files
authored
Merge branch 'master' into wdt_issue_246
2 parents 6fedd52 + 54d716d commit cfb5efa

28 files changed

+663
-684
lines changed

core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<artifactId>weblogic-deploy</artifactId>
1313
<groupId>com.oracle.weblogic.lifecycle</groupId>
14-
<version>0.25-SNAPSHOT</version>
14+
<version>1.1.1-SNAPSHOT</version>
1515
<relativePath>../pom.xml</relativePath>
1616
</parent>
1717

core/src/main/java/oracle/weblogic/deploy/create/RCURunner.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class RCURunner {
4141
private static final String CREATE_REPO_SWITCH = "-createRepository";
4242
private static final String DB_TYPE_SWITCH = "-databaseType";
4343
private static final String ORACLE_DB_TYPE = "ORACLE";
44+
private static final String USER_SAME_PWD_FOR_ALL ="-useSamePasswordForAllSchemaUsers";
4445
private static final String DB_CONNECT_SWITCH = "-connectString";
4546
private static final String DB_USER_SWITCH = "-dbUser";
4647
private static final String DB_USER = "SYS";
@@ -289,6 +290,8 @@ private String[] getRcuCreateArgs() {
289290
createArgs.add(CREATE_REPO_SWITCH);
290291
createArgs.add(DB_TYPE_SWITCH);
291292
createArgs.add(ORACLE_DB_TYPE);
293+
createArgs.add(USER_SAME_PWD_FOR_ALL);
294+
createArgs.add("true");
292295
createArgs.add(DB_CONNECT_SWITCH);
293296
createArgs.add(rcuDb);
294297
if (ATP_DB) {
@@ -338,13 +341,10 @@ private List<String> getRcuCreateStdinLines(String rcuSysPass, String rcuSchemaP
338341
}
339342

340343
private List<String> getRcuStdinLines(RcuOpType rcuOpType, String rcuSysPass, String rcuSchemaPass) {
341-
int extraRcuSchemaPasswordCount = getExtraRcuSchemaPasswordCount(rcuOpType);
342-
List<String> stdinLines = new ArrayList<>(rcuSchemas.size() + extraRcuSchemaPasswordCount);
344+
List<String> stdinLines = new ArrayList<>(2);
343345
stdinLines.add(rcuSysPass);
346+
stdinLines.add(rcuSchemaPass);
344347

345-
for (int i = 0; i < rcuSchemas.size() + extraRcuSchemaPasswordCount; i++) {
346-
stdinLines.add(rcuSchemaPass);
347-
}
348348
return stdinLines;
349349
}
350350

core/src/main/python/create.py

Lines changed: 22 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sys
99
from java.io import IOException
1010
from java.lang import IllegalArgumentException
11-
from java.lang import IllegalStateException
1211
from java.lang import String
1312
from java.lang import System
1413
from oracle.weblogic.deploy.create import CreateException
@@ -39,6 +38,7 @@
3938
from wlsdeploy.tool.util import filter_helper
4039
from wlsdeploy.tool.util.alias_helper import AliasHelper
4140
from wlsdeploy.tool.validate.validator import Validator
41+
from wlsdeploy.util import cla_helper
4242
from wlsdeploy.util import getcreds
4343
from wlsdeploy.util import tool_exit
4444
from wlsdeploy.util import variables
@@ -58,7 +58,6 @@
5858
__logger = PlatformLogger('wlsdeploy.create')
5959
__wlst_mode = WlstModes.OFFLINE
6060
__version = WebLogicHelper(__logger).get_actual_weblogic_version()
61-
__tmp_model_dir = None
6261

6362
__required_arguments = [
6463
CommandLineArgUtil.ORACLE_HOME_SWITCH,
@@ -89,6 +88,7 @@ def __process_args(args):
8988
:raises CLAException: if an error occurs while validating and processing the command-line arguments
9089
"""
9190
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
91+
cla_util.set_allow_multiple_models(True)
9292
required_arg_map, optional_arg_map = cla_util.process_args(args, True)
9393
__verify_required_args_present(required_arg_map)
9494
__process_java_home_arg(optional_arg_map)
@@ -159,7 +159,6 @@ def __process_domain_location_args(optional_arg_map):
159159
:raises CLAException: if the arguments are invalid or an error occurs extracting the model from the archive
160160
"""
161161
_method_name = '__process_domain_location_args'
162-
global __tmp_model_dir
163162

164163
has_home = CommandLineArgUtil.DOMAIN_HOME_SWITCH in optional_arg_map
165164
has_parent = CommandLineArgUtil.DOMAIN_PARENT_SWITCH in optional_arg_map
@@ -176,53 +175,16 @@ def __process_domain_location_args(optional_arg_map):
176175

177176
def __process_model_args(optional_arg_map):
178177
"""
179-
Verify that either the model_file or archive_file was provided and exists.
178+
Verify that the specified model_file exists, or there is a model file in the specified archive_file.
180179
Extract the model file if only the archive_file was provided.
181180
:param optional_arg_map: the optional arguments map
182181
:raises CLAException: if the arguments are invalid or an error occurs extracting the model from the archive
183182
"""
184-
_method_name = '__process_model_args'
185-
global __tmp_model_dir
186183

187-
if CommandLineArgUtil.MODEL_FILE_SWITCH in optional_arg_map:
188-
model_file_name = optional_arg_map[CommandLineArgUtil.MODEL_FILE_SWITCH]
184+
# don't verify that the archive is valid until it is needed.
185+
# this requirement is specific to create, other tools will verify it.
189186

190-
try:
191-
FileUtils.validateExistingFile(model_file_name)
192-
except IllegalArgumentException, iae:
193-
ex = exception_helper.create_cla_exception('WLSDPLY-20006', _program_name, model_file_name,
194-
iae.getLocalizedMessage(), error=iae)
195-
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
196-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
197-
raise ex
198-
elif CommandLineArgUtil.ARCHIVE_FILE_SWITCH in optional_arg_map:
199-
archive_file_name = optional_arg_map[CommandLineArgUtil.ARCHIVE_FILE_SWITCH]
200-
201-
try:
202-
archive_file = WLSDeployArchive(archive_file_name)
203-
__tmp_model_dir = FileUtils.createTempDirectory(_program_name)
204-
tmp_model_raw_file = archive_file.extractModel(__tmp_model_dir)
205-
if not tmp_model_raw_file:
206-
ex = exception_helper.create_cla_exception('WLSDPLY-20026', _program_name, archive_file_name,
207-
CommandLineArgUtil.MODEL_FILE_SWITCH)
208-
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
209-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
210-
raise ex
211-
212-
tmp_model_file = FileUtils.fixupFileSeparatorsForJython(tmp_model_raw_file.getAbsolutePath())
213-
except (IllegalArgumentException, IllegalStateException, WLSDeployArchiveIOException), archex:
214-
ex = exception_helper.create_cla_exception('WLSDPLY-20010', _program_name, archive_file_name,
215-
archex.getLocalizedMessage(), error=archex)
216-
ex.setExitCode(CommandLineArgUtil.ARG_VALIDATION_ERROR_EXIT_CODE)
217-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
218-
raise ex
219-
optional_arg_map[CommandLineArgUtil.MODEL_FILE_SWITCH] = FileUtils.fixupFileSeparatorsForJython(tmp_model_file)
220-
else:
221-
ex = exception_helper.create_cla_exception('WLSDPLY-20015', _program_name, CommandLineArgUtil.MODEL_FILE_SWITCH,
222-
CommandLineArgUtil.ARCHIVE_FILE_SWITCH)
223-
ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
224-
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
225-
raise ex
187+
cla_helper.validate_model_present(_program_name, optional_arg_map)
226188
return
227189

228190

@@ -303,17 +265,6 @@ def __process_encryption_args(optional_arg_map):
303265
return
304266

305267

306-
def __clean_up_temp_files():
307-
"""
308-
If a temporary directory was created to extract the model from the archive, delete the directory and its contents.
309-
"""
310-
global __tmp_model_dir
311-
312-
if __tmp_model_dir is not None:
313-
FileUtils.deleteDirectory(__tmp_model_dir)
314-
__tmp_model_dir = None
315-
316-
317268
def validate_model(model_dictionary, model_context, aliases):
318269
_method_name = 'validate_model'
319270

@@ -326,12 +277,12 @@ def validate_model(model_dictionary, model_context, aliases):
326277
except ValidateException, ex:
327278
__logger.severe('WLSDPLY-20000', _program_name, ex.getLocalizedMessage(), error=ex,
328279
class_name=_class_name, method_name=_method_name)
329-
__clean_up_temp_files()
280+
cla_helper.clean_up_temp_files()
330281
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
331282

332283
if return_code == Validator.ReturnCode.STOP:
333284
__logger.severe('WLSDPLY-20001', _program_name, class_name=_class_name, method_name=_method_name)
334-
__clean_up_temp_files()
285+
cla_helper.clean_up_temp_files()
335286
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
336287

337288

@@ -365,15 +316,15 @@ def validateRCUArgsAndModel(model_context, model, alias_helper):
365316
else:
366317
__logger.severe('WLSDPLY-12411', error=None,
367318
class_name=_class_name, method_name="validateRCUArgsAndModel")
368-
__clean_up_temp_files()
319+
cla_helper.clean_up_temp_files()
369320
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
370321

371322
else:
372323
if model_context.get_domain_typedef().required_rcu():
373324
if not model_context.get_rcu_database() or not model_context.get_rcu_prefix():
374325
__logger.severe('WLSDPLY-12408', model_context.get_domain_type(), CommandLineArgUtil.RCU_DB_SWITCH,
375326
CommandLineArgUtil.RCU_PREFIX_SWITCH)
376-
__clean_up_temp_files()
327+
cla_helper.clean_up_temp_files()
377328
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
378329

379330
return has_atpdbinfo
@@ -403,19 +354,19 @@ def main(args):
403354
if exit_code != CommandLineArgUtil.HELP_EXIT_CODE:
404355
__logger.severe('WLSDPLY-20008', _program_name, ex.getLocalizedMessage(), error=ex,
405356
class_name=_class_name, method_name=_method_name)
406-
__clean_up_temp_files()
357+
cla_helper.clean_up_temp_files()
407358

408359
# create a minimal model for summary logging
409360
model_context = ModelContext(_program_name, dict())
410361
tool_exit.end(model_context, exit_code)
411362

412-
model_file = model_context.get_model_file()
363+
model_file_value = model_context.get_model_file()
413364
try:
414-
model = FileToPython(model_file, True).parse()
365+
model = cla_helper.merge_model_files(model_file_value)
415366
except TranslateException, te:
416-
__logger.severe('WLSDPLY-20009', _program_name, model_file, te.getLocalizedMessage(), error=te,
367+
__logger.severe('WLSDPLY-20009', _program_name, model_file_value, te.getLocalizedMessage(), error=te,
417368
class_name=_class_name, method_name=_method_name)
418-
__clean_up_temp_files()
369+
cla_helper.clean_up_temp_files()
419370
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
420371

421372
try:
@@ -426,7 +377,7 @@ def main(args):
426377
except VariableException, ex:
427378
__logger.severe('WLSDPLY-20004', _program_name, ex.getLocalizedMessage(), error=ex,
428379
class_name=_class_name, method_name=_method_name)
429-
__clean_up_temp_files()
380+
cla_helper.clean_up_temp_files()
430381
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
431382

432383
aliases = Aliases(model_context, wlst_mode=__wlst_mode)
@@ -460,27 +411,28 @@ def main(args):
460411
except WLSDeployArchiveIOException, ex:
461412
__logger.severe('WLSDPLY-12409', _program_name, ex.getLocalizedMessage(), error=ex,
462413
class_name=_class_name, method_name=_method_name)
463-
__clean_up_temp_files()
414+
cla_helper.clean_up_temp_files()
464415
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
465416

466417
except CreateException, ex:
467418
__logger.severe('WLSDPLY-12409', _program_name, ex.getLocalizedMessage(), error=ex,
468419
class_name=_class_name, method_name=_method_name)
469-
__clean_up_temp_files()
420+
cla_helper.clean_up_temp_files()
470421
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
471422

472423
except IOException, ex:
473424
__logger.severe('WLSDPLY-12409', _program_name, ex.getLocalizedMessage(), error=ex,
474425
class_name=_class_name, method_name=_method_name)
475-
__clean_up_temp_files()
426+
cla_helper.clean_up_temp_files()
476427
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
428+
477429
except DeployException, ex:
478430
__logger.severe('WLSDPLY-12410', _program_name, ex.getLocalizedMessage(), error=ex,
479431
class_name=_class_name, method_name=_method_name)
480-
__clean_up_temp_files()
432+
cla_helper.clean_up_temp_files()
481433
tool_exit.end(model_context, CommandLineArgUtil.PROG_ERROR_EXIT_CODE)
482434

483-
__clean_up_temp_files()
435+
cla_helper.clean_up_temp_files()
484436

485437
tool_exit.end(model_context, exit_code)
486438
return

0 commit comments

Comments
 (0)