Skip to content

Use ORACLE_HOME home environment variable #636

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions core/src/main/python/compare_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
all_removed = []
compare_msgs = sets.Set()


def __process_args(args):
"""
Process the command-line arguments.
Expand All @@ -76,13 +77,9 @@ def __process_args(args):
_method_name = '__process_args'

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args, trailing_arg_count=2)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
argument_map = cla_util.process_args(args, trailing_arg_count=2)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return ModelContext(_program_name, combined_arg_map)
return ModelContext(_program_name, argument_map)

class ModelDiffer:

Expand Down
23 changes: 10 additions & 13 deletions core/src/main/python/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,25 @@ def __process_args(args):
"""
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
cla_util.set_allow_multiple_models(True)
required_arg_map, optional_arg_map = cla_util.process_args(args, TOOL_TYPE_CREATE)
cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
__process_java_home_arg(optional_arg_map)
__process_domain_location_args(optional_arg_map)
argument_map = cla_util.process_args(args, TOOL_TYPE_CREATE)
__process_java_home_arg(argument_map)
__process_domain_location_args(argument_map)

# don't verify that the archive is valid until it is needed.
# this requirement is specific to create, other tools will verify it.
cla_helper.validate_model_present(_program_name, optional_arg_map)
cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)
cla_helper.validate_model_present(_program_name, argument_map)
cla_helper.validate_variable_file_exists(_program_name, argument_map)

#
# Verify that the domain type is a known type and load its typedef.
#
domain_typedef = model_context_helper.create_typedef(_program_name, optional_arg_map)
domain_typedef = model_context_helper.create_typedef(_program_name, argument_map)

__process_rcu_args(optional_arg_map, domain_typedef.get_domain_type(), domain_typedef)
cla_helper.process_encryption_args(optional_arg_map)
__process_opss_args(optional_arg_map)
__process_rcu_args(argument_map, domain_typedef.get_domain_type(), domain_typedef)
cla_helper.process_encryption_args(argument_map)
__process_opss_args(argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map, domain_typedef)
return model_context_helper.create_context(_program_name, argument_map, domain_typedef)


def __process_java_home_arg(optional_arg_map):
Expand Down
17 changes: 7 additions & 10 deletions core/src/main/python/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,16 @@ def __process_args(args):

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
cla_util.set_allow_multiple_models(True)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
cla_helper.validate_optional_archive(_program_name, optional_arg_map)
cla_helper.validate_model_present(_program_name, optional_arg_map)
cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)
cla_helper.validate_optional_archive(_program_name, argument_map)
cla_helper.validate_model_present(_program_name, argument_map)
cla_helper.validate_variable_file_exists(_program_name, argument_map)

__wlst_mode = cla_helper.process_online_args(optional_arg_map)
cla_helper.process_encryption_args(optional_arg_map)
__wlst_mode = cla_helper.process_online_args(argument_map)
cla_helper.process_encryption_args(argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)
return model_context_helper.create_context(_program_name, argument_map)


def __deploy(model, model_context, aliases):
Expand Down
18 changes: 7 additions & 11 deletions core/src/main/python/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ def __process_args(args):
global __wlst_mode

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
__wlst_mode = cla_helper.process_online_args(optional_arg_map)
__wlst_mode = cla_helper.process_online_args(argument_map)
__process_target_arg(argument_map)
__process_archive_filename_arg(argument_map)
__process_variable_filename_arg(argument_map)
__process_java_home(argument_map)

__process_target_arg(optional_arg_map)
__process_archive_filename_arg(required_arg_map)
__process_variable_filename_arg(optional_arg_map)
__process_java_home(optional_arg_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)
return model_context_helper.create_context(_program_name, argument_map)

def __process_target_arg(optional_arg_map):

Expand Down
18 changes: 7 additions & 11 deletions core/src/main/python/encrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from wlsdeploy.logging.platform_logger import PlatformLogger
from wlsdeploy.tool.encrypt import encryption_utils
from wlsdeploy.tool.util.alias_helper import AliasHelper
from wlsdeploy.util import cla_helper
from wlsdeploy.util import getcreds
from wlsdeploy.util import variables as variable_helper
from wlsdeploy.util.cla_utils import CommandLineArgUtil
Expand Down Expand Up @@ -63,28 +62,25 @@ def __process_args(args):
_method_name = '__process_args'

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
__validate_mode_args(optional_arg_map)
__process_passphrase_arg(optional_arg_map)
__validate_mode_args(argument_map)
__process_passphrase_arg(argument_map)

#
# Prompt for the password to encrypt if the -manual switch was specified
#
if CommandLineArgUtil.ENCRYPT_MANUAL_SWITCH in optional_arg_map and \
CommandLineArgUtil.ONE_PASS_SWITCH not in optional_arg_map:
if CommandLineArgUtil.ENCRYPT_MANUAL_SWITCH in argument_map and \
CommandLineArgUtil.ONE_PASS_SWITCH not in argument_map:
try:
pwd = getcreds.getpass('WLSDPLY-04200')
except IOException, ioe:
ex = exception_helper.create_encryption_exception('WLSDPLY-04201', ioe.getLocalizedMessage(), error=ioe)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
optional_arg_map[CommandLineArgUtil.ONE_PASS_SWITCH] = String(pwd)
argument_map[CommandLineArgUtil.ONE_PASS_SWITCH] = String(pwd)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
model_context = ModelContext(_program_name, combined_arg_map)
model_context = ModelContext(_program_name, argument_map)
return model_context


Expand Down
15 changes: 6 additions & 9 deletions core/src/main/python/extract_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ def __process_args(args):
"""
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
cla_util.set_allow_multiple_models(True)
required_arg_map, optional_arg_map = cla_util.process_args(args, TOOL_TYPE_EXTRACT)
argument_map = cla_util.process_args(args, TOOL_TYPE_EXTRACT)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
cla_helper.validate_optional_archive(_program_name, optional_arg_map)
cla_helper.validate_optional_archive(_program_name, argument_map)

# determine if the model file was passed separately or requires extraction from the archive.
cla_helper.validate_model_present(_program_name, optional_arg_map)
cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)
cla_helper.process_encryption_args(optional_arg_map)
cla_helper.validate_model_present(_program_name, argument_map)
cla_helper.validate_variable_file_exists(_program_name, argument_map)
cla_helper.process_encryption_args(argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)
return model_context_helper.create_context(_program_name, argument_map)


def __extract_resource(model, model_context, aliases):
Expand Down
11 changes: 3 additions & 8 deletions core/src/main/python/model_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,12 @@ def __process_args(args):
_method_name = '__process_args'

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args, trailing_arg_count=1)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
argument_map = cla_util.process_args(args, trailing_arg_count=1)

# zero or one output type arguments should be set
found = False
for key in __output_types:
if key in combined_arg_map:
if key in argument_map:
if found:
types_text = ', '.join(__output_types)
ex = exception_helper.create_cla_exception('WLSDPLY-10100', types_text)
Expand All @@ -70,7 +65,7 @@ def __process_args(args):
raise ex
found = True

return model_context_helper.create_context(_program_name, combined_arg_map)
return model_context_helper.create_context(_program_name, argument_map)


def print_help(model_path, model_context):
Expand Down
23 changes: 11 additions & 12 deletions core/src/main/python/prepare_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
from oracle.weblogic.deploy.util import VariableException
from oracle.weblogic.deploy.util import WebLogicDeployToolingVersion
from oracle.weblogic.deploy.validate import ValidateException

from oracle.weblogic.deploy.aliases import AliasException
from wlsdeploy.aliases import model_constants
from wlsdeploy.aliases.aliases import Aliases
from wlsdeploy.aliases.location_context import LocationContext
Expand Down Expand Up @@ -82,32 +84,29 @@ def __process_args(args, logger):
_method_name = '__process_args'

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
__process_target_arg(argument_map, logger)

__process_target_arg(optional_arg_map, required_arg_map, logger)
return ModelContext(_program_name, argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return ModelContext(_program_name, combined_arg_map)

def __process_target_arg(optional_arg_map, required_arg_map, logger):
def __process_target_arg(argument_map, logger):

_method_name = '__process_target_arg'

# if -target is specified -output_dir is required
output_dir = required_arg_map[CommandLineArgUtil.OUTPUT_DIR_SWITCH]
output_dir = argument_map[CommandLineArgUtil.OUTPUT_DIR_SWITCH]
if output_dir is None or os.path.isdir(output_dir) is False:
if not os.path.isdir(output_dir):
ex = exception_helper.create_cla_exception('WLSDPLY-01642', output_dir)
logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex

# Set the -variable_file parameter if not present with default
if CommandLineArgUtil.VARIABLE_FILE_SWITCH not in optional_arg_map:
optional_arg_map[CommandLineArgUtil.VARIABLE_FILE_SWITCH] = os.path.join(output_dir,
"k8s_variable.properties")
if CommandLineArgUtil.VARIABLE_FILE_SWITCH not in argument_map:
argument_map[CommandLineArgUtil.VARIABLE_FILE_SWITCH] = os.path.join(output_dir,
"k8s_variable.properties")

class PrepareModel:
"""
Expand Down Expand Up @@ -348,7 +347,7 @@ def __substitute_password_with_token(self, model_path, attribute_name, validatio
if tokens_length > 1:
# For AdminPassword
if model_path_tokens[0] == 'domainInfo:' and model_path_tokens[1] == '':
password_name = "@@SECRET:@@DOAMIN-UID@@-weblogic-credentials:%s@@" % (attribute_name.lower())
password_name = "@@SECRET:@@DOMAIN-UID@@-weblogic-credentials:%s@@" % (attribute_name.lower())
self.cache[attribute_name] = ''
else:
password_name = target_configuration_helper.format_as_secret(variable_name)
Expand Down
17 changes: 7 additions & 10 deletions core/src/main/python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,16 @@ def __process_args(args):

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
cla_util.set_allow_multiple_models(True)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
cla_helper.validate_optional_archive(_program_name, optional_arg_map)
cla_helper.validate_model_present(_program_name, optional_arg_map)
cla_helper.validate_variable_file_exists(_program_name, optional_arg_map)
cla_helper.validate_optional_archive(_program_name, argument_map)
cla_helper.validate_model_present(_program_name, argument_map)
cla_helper.validate_variable_file_exists(_program_name, argument_map)

__wlst_mode = cla_helper.process_online_args(optional_arg_map)
cla_helper.process_encryption_args(optional_arg_map)
__wlst_mode = cla_helper.process_online_args(argument_map)
cla_helper.process_encryption_args(argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)
return model_context_helper.create_context(_program_name, argument_map)


def __update(model, model_context, aliases):
Expand Down
26 changes: 3 additions & 23 deletions core/src/main/python/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,31 +61,11 @@ def __process_args(args):
"""
cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
cla_util.set_allow_multiple_models(True)
required_arg_map, optional_arg_map = cla_util.process_args(args)
argument_map = cla_util.process_args(args)

__verify_required_args_present(required_arg_map)
__process_model_args(optional_arg_map)
__process_model_args(argument_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)


def __verify_required_args_present(required_arg_map):
"""
Verify that the required args are present.
:param required_arg_map: the required arguments map
:raises CLAException: if one or more of the required arguments are missing
"""
_method_name = '__verify_required_args_present'

for req_arg in __required_arguments:
if req_arg not in required_arg_map:
ex = exception_helper.create_cla_exception('WLSDPLY-20005', _program_name, req_arg)
ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
return
return model_context_helper.create_context(_program_name, argument_map)


def __process_model_args(optional_arg_map):
Expand Down
18 changes: 7 additions & 11 deletions core/src/main/python/variable_inject.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,15 @@ def __process_args(args):
global __wlst_mode

cla_util = CommandLineArgUtil(_program_name, __required_arguments, __optional_arguments)
required_arg_map, optional_arg_map = cla_util.process_args(args)

cla_helper.verify_required_args_present(_program_name, __required_arguments, required_arg_map)
argument_map = cla_util.process_args(args)

# determine if the model file was passed separately or requires extraction from the archive.
cla_helper.validate_model_present(_program_name, optional_arg_map)
__process_injector_file(optional_arg_map)
__process_keywords_file(optional_arg_map)
__process_properties_file(optional_arg_map)

combined_arg_map = optional_arg_map.copy()
combined_arg_map.update(required_arg_map)
return model_context_helper.create_context(_program_name, combined_arg_map)
cla_helper.validate_model_present(_program_name, argument_map)
__process_injector_file(argument_map)
__process_keywords_file(argument_map)
__process_properties_file(argument_map)

return model_context_helper.create_context(_program_name, argument_map)


def __process_injector_file(optional_arg_map):
Expand Down
19 changes: 0 additions & 19 deletions core/src/main/python/wlsdeploy/util/cla_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,6 @@ def validate_variable_file_exists(program_name, optional_arg_map):
return


def verify_required_args_present(program_name, required_arguments, required_arg_map):
"""
Verify that the required args are present.
:param program_name: the program name, for logging
:param required_arguments: the required arguments to be checked
:param required_arg_map: the required arguments map
:raises CLAException: if one or more of the required arguments are missing
"""
_method_name = '__verify_required_args_present'

for req_arg in required_arguments:
if req_arg not in required_arg_map:
ex = exception_helper.create_cla_exception('WLSDPLY-20005', program_name, req_arg)
ex.setExitCode(CommandLineArgUtil.USAGE_ERROR_EXIT_CODE)
__logger.throwing(ex, class_name=_class_name, method_name=_method_name)
raise ex
return


def process_encryption_args(optional_arg_map):
"""
If the user is using model encryption, get the passphrase from stdin, and put it in the argument map.
Expand Down
Loading