Skip to content

Commit 4743a7b

Browse files
authored
Merge pull request #235 from oracle/versionapp-fix
Versionapp fix
2 parents 06d212e + 9c7cc97 commit 4743a7b

File tree

1 file changed

+40
-23
lines changed

1 file changed

+40
-23
lines changed

core/src/main/python/wlsdeploy/tool/deploy/applications_deployer.py

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,40 @@
44
"""
55
import copy
66
import javaos as os
7-
from sets import Set
8-
7+
from java.io import ByteArrayOutputStream
98
from java.io import File
10-
from java.io import IOException
119
from java.io import FileNotFoundException
12-
from java.util.zip import ZipException
10+
from java.io import IOException
11+
from java.lang import IllegalStateException
1312
from java.security import NoSuchAlgorithmException
1413
from java.util.jar import JarFile
15-
from java.util.jar import Manifest
16-
from java.lang import IllegalStateException
17-
from java.io import ByteArrayOutputStream
18-
19-
import oracle.weblogic.deploy.util.FileUtils as FileUtils
20-
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
21-
14+
from java.util.zip import ZipException
15+
from sets import Set
2216
from wlsdeploy.aliases.location_context import LocationContext
23-
from wlsdeploy.aliases.wlst_modes import WlstModes
24-
from wlsdeploy.exception import exception_helper
25-
from wlsdeploy.tool.deploy import deployer_utils
26-
from wlsdeploy.tool.deploy.deployer import Deployer
27-
from wlsdeploy.util import dictionary_utils
28-
from wlsdeploy.util import string_utils
29-
3017
from wlsdeploy.aliases.model_constants import ABSOLUTE_SOURCE_PATH
31-
from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
3218
from wlsdeploy.aliases.model_constants import APPLICATION
19+
from wlsdeploy.aliases.model_constants import APP_DEPLOYMENTS
3320
from wlsdeploy.aliases.model_constants import DEPLOYMENT_ORDER
3421
from wlsdeploy.aliases.model_constants import LIBRARY
3522
from wlsdeploy.aliases.model_constants import PARTITION
3623
from wlsdeploy.aliases.model_constants import PLAN_PATH
3724
from wlsdeploy.aliases.model_constants import PLAN_STAGE_MODE
25+
from wlsdeploy.aliases.model_constants import RESOURCES
3826
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP
3927
from wlsdeploy.aliases.model_constants import RESOURCE_GROUP_TEMPLATE
40-
from wlsdeploy.aliases.model_constants import RESOURCES
4128
from wlsdeploy.aliases.model_constants import SECURITY_DD_MODEL
4229
from wlsdeploy.aliases.model_constants import SOURCE_PATH
4330
from wlsdeploy.aliases.model_constants import TARGET
4431
from wlsdeploy.aliases.model_constants import TARGETS
32+
from wlsdeploy.aliases.wlst_modes import WlstModes
33+
from wlsdeploy.exception import exception_helper
34+
from wlsdeploy.tool.deploy import deployer_utils
35+
from wlsdeploy.tool.deploy.deployer import Deployer
36+
from wlsdeploy.util import dictionary_utils
37+
from wlsdeploy.util import string_utils
38+
39+
import oracle.weblogic.deploy.util.FileUtils as FileUtils
40+
import oracle.weblogic.deploy.util.PyOrderedDict as OrderedDict
4541

4642

4743
class ApplicationsDeployer(Deployer):
@@ -158,6 +154,27 @@ def __add_applications(self):
158154

159155
application = \
160156
copy.deepcopy(dictionary_utils.get_dictionary_element(applications, application_name))
157+
158+
app_source_path = dictionary_utils.get_element(application, SOURCE_PATH)
159+
if string_utils.is_empty(app_source_path):
160+
ex = exception_helper.create_deploy_exception('WLSDPLY-09302', application_name, SOURCE_PATH)
161+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
162+
raise ex
163+
164+
if deployer_utils.is_path_into_archive(app_source_path):
165+
if self.archive_helper is not None:
166+
self.archive_helper.extract_file(app_source_path)
167+
else:
168+
ex = exception_helper.create_deploy_exception('WLSDPLY-09303', application_name)
169+
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
170+
raise ex
171+
full_source_path = File(File(self.model_context.get_domain_home()), app_source_path).getAbsolutePath()
172+
else:
173+
full_source_path = File(self.model_context.replace_token_string(app_source_path)).getAbsolutePath()
174+
175+
application_name = \
176+
self.__get_deployable_library_versioned_name(full_source_path, application_name)
177+
161178
quoted_application_name = self.wlst_helper.get_quoted_name_for_wlst(application_name)
162179
application_location.add_name_token(application_token, quoted_application_name)
163180

@@ -732,9 +749,9 @@ def __deploy_app_online(self, application_name, source_path, targets, plan=None,
732749
self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name)
733750
raise ex
734751

735-
if options is not None and 'libraryModule' in options and string_utils.to_boolean(options['libraryModule']):
736-
computed_name = self.__get_deployable_library_versioned_name(source_path, application_name)
737-
application_name = computed_name
752+
# if options is not None and 'libraryModule' in options and string_utils.to_boolean(options['libraryModule']):
753+
computed_name = self.__get_deployable_library_versioned_name(source_path, application_name)
754+
application_name = computed_name
738755

739756
# build the dictionary of named arguments to pass to the deploy_application method
740757
args = list()

0 commit comments

Comments
 (0)