|
3 | 3 | Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
|
4 | 4 | """
|
5 | 5 | import copy
|
6 |
| -import os |
7 |
| -import shutil |
8 | 6 |
|
9 | 7 | from wlsdeploy.aliases.location_context import LocationContext
|
10 | 8 | from wlsdeploy.aliases.model_constants import APPLICATION
|
@@ -157,97 +155,6 @@ def __delete_existing_deployment(self, existing_deployment_names_list, deploymen
|
157 | 155 |
|
158 | 156 | self.logger.exiting(class_name=self._class_name, method_name=_method_name)
|
159 | 157 |
|
160 |
| - # FIXME: duplicate code in online and offline |
161 |
| - def _extract_deployment_from_archive(self, deployment_name, deployment_type, deployment_dict): |
162 |
| - _method_name = '_extract_deployment_from_archive' |
163 |
| - self.logger.entering(deployment_name, deployment_type, deployment_dict, |
164 |
| - class_name=self._class_name, method_name=_method_name) |
165 |
| - |
166 |
| - source_path = dictionary_utils.get_element(deployment_dict, SOURCE_PATH) |
167 |
| - combined_path_path = self._get_combined_model_plan_path(deployment_dict) |
168 |
| - if deployer_utils.is_path_into_archive(source_path) or deployer_utils.is_path_into_archive(combined_path_path): |
169 |
| - if self.archive_helper is not None: |
170 |
| - self._extract_app_or_lib_from_archive(deployment_name, deployment_type, deployment_dict) |
171 |
| - else: |
172 |
| - ex = exception_helper.create_deploy_exception('WLSDPLY-09303', deployment_type, deployment_name) |
173 |
| - self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name) |
174 |
| - raise ex |
175 |
| - |
176 |
| - def _extract_app_or_lib_from_archive(self, model_name, model_type, model_dict): |
177 |
| - """ |
178 |
| - Extract deployment contents from the archive. |
179 |
| -
|
180 |
| - :param model_name: the element name (my-app, etc.), used for logging |
181 |
| - :param model_type: the model type (Application, etc.), used for logging |
182 |
| - :param model_dict: the model dictionary |
183 |
| - """ |
184 |
| - _method_name = '_extract_app_or_lib_from_archive' |
185 |
| - self.logger.entering(model_name, model_type, model_dict, |
186 |
| - class_name=self._class_name, method_name=_method_name) |
187 |
| - |
188 |
| - is_structured_app = False |
189 |
| - structured_app_dir = None |
190 |
| - if model_type == APPLICATION: |
191 |
| - is_structured_app, structured_app_dir = self._is_structured_app(model_dict) |
192 |
| - |
193 |
| - if is_structured_app: |
194 |
| - # is_structured_app() only returns true if both the app and the plan have similar paths. |
195 |
| - # Since the caller already verified the app or plan was in the archive, it is safe to assume |
196 |
| - # both are in the archive. |
197 |
| - if self.archive_helper.contains_path(structured_app_dir): |
198 |
| - # |
199 |
| - # When extracting a directory, delete the old directory if it already exists so that the |
200 |
| - # extracted directory is exactly what is in the archive file. |
201 |
| - # |
202 |
| - existing_directory_path = \ |
203 |
| - self.path_helper.local_join(self.model_context.get_domain_home(), structured_app_dir) |
204 |
| - if os.path.isdir(existing_directory_path): |
205 |
| - shutil.rmtree(existing_directory_path) |
206 |
| - self.archive_helper.extract_directory(structured_app_dir) |
207 |
| - else: |
208 |
| - ex = exception_helper.create_deploy_exception('WLSDPLY-09330', |
209 |
| - model_type, model_name, structured_app_dir) |
210 |
| - self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name) |
211 |
| - raise ex |
212 |
| - else: |
213 |
| - model_source_path = dictionary_utils.get_element(model_dict, SOURCE_PATH) |
214 |
| - plan_file_to_extract = self._get_combined_model_plan_path(model_dict) |
215 |
| - |
216 |
| - if not string_utils.is_empty(model_source_path) and \ |
217 |
| - (model_source_path.endswith('/') or model_source_path.endswith('\\')): |
218 |
| - # model may have trailing slash on exploded source path |
219 |
| - source_path_to_extract = model_source_path[:-1] |
220 |
| - else: |
221 |
| - source_path_to_extract = model_source_path |
222 |
| - |
223 |
| - # The caller only verified that either the app or the plan was in the archive; therefore, |
224 |
| - # we have to validate each one before trying to extract. |
225 |
| - if self.archive_helper.is_path_into_archive(source_path_to_extract): |
226 |
| - # source path may be a single file (jar, war, etc.) or an exploded directory |
227 |
| - if self.archive_helper.contains_file(source_path_to_extract): |
228 |
| - self.archive_helper.extract_file(source_path_to_extract) |
229 |
| - elif self.archive_helper.contains_path(source_path_to_extract): |
230 |
| - # |
231 |
| - # When extracting a directory, delete the old directory if it already exists so that the |
232 |
| - # extracted directory is exactly what is in the archive file. |
233 |
| - # |
234 |
| - existing_directory_path = \ |
235 |
| - self.path_helper.local_join(self.model_context.get_domain_home(), source_path_to_extract) |
236 |
| - if os.path.isdir(existing_directory_path): |
237 |
| - shutil.rmtree(existing_directory_path) |
238 |
| - self.archive_helper.extract_directory(source_path_to_extract) |
239 |
| - else: |
240 |
| - ex = exception_helper.create_deploy_exception('WLSDPLY-09330', |
241 |
| - model_type, model_name, source_path_to_extract) |
242 |
| - self.logger.throwing(ex, class_name=self._class_name, method_name=_method_name) |
243 |
| - raise ex |
244 |
| - |
245 |
| - # plan_file_to_extract should always be None for a structured app |
246 |
| - if self.archive_helper.is_path_into_archive(plan_file_to_extract): |
247 |
| - self.archive_helper.extract_file(plan_file_to_extract) |
248 |
| - |
249 |
| - self.logger.exiting(class_name=self._class_name, method_name=_method_name) |
250 |
| - |
251 | 158 | def __validate_deployment_source_path(self, deployment_name, deployment_type, deployment_dict,
|
252 | 159 | existing_deployment_names):
|
253 | 160 | _method_name = '__validate_deployment_source_path'
|
|
0 commit comments