def create_and_cd(self, alias_helper, type_name, name, location, create_path=None): """ Create a new MBean instance and change directories to its attributes location. :param alias_helper: the alias helper object :param type_name: the WLST type :param name: the name for the new object :param location: the location :param create_path: the WLST path from which to create the new MBean :return: the result from cd() :raises: BundleAwareException of the specified type: if an error occurs """ _method_name = 'create_and_cd' try: if create_path is not None: wlst_helper.cd(create_path) wlst_helper.create(name, type_name) result = wlst_helper.cd( alias_helper.get_wlst_attributes_path(location)) except PyWLSTException, pwe: ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19104', type_name, name, pwe.getLocalizedMessage(), error=pwe) self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) raise ex
def _add_domain_name(location, aliases): _method_name = '_get_domain_name' try: wlst_helper.cd('/') domain_name = wlst_helper.get(model_constants.DOMAIN_NAME) except PyWLSTException, pe: de = exception_helper.create_discover_exception( 'WLSDPLY-06020', pe.getLocalizedMessage()) __logger.throwing(class_name=_class_name, method_name=_method_name, error=de) raise de
def _has_machines_folder(self, base_folder): """ This is a private method. In WLST offline, the Machine folder does not always show up even though it is there so this method determines whether the machines folder is really there or not. :param base_folder: the folder name to check :return: true, if the Machine folder exists, false otherwise """ if base_folder in wlst_helper.lsc(): result = True elif self._wlst_mode == WlstModes.OFFLINE: try: wlst_helper.cd(base_folder) result = True except PyWLSTException: result = False else: result = False return result
def cd(self, wlst_path): """ Change WLST directories to the specified path :param wlst_path: the WLST path :return: the return value from the cd() :raises: BundleAwareException of the specified type: if an error occurs """ _method_name = 'cd' try: result = wlst_helper.cd(wlst_path) except PyWLSTException, pwe: ex = exception_helper.create_exception(self.__exception_type, 'WLSDPLY-19100', wlst_path, pwe.getLocalizedMessage(), error=pwe) self.__logger.throwing(ex, class_name=self.__class_name, method_name=_method_name) raise ex
def wlst_cd(self, path, location): """ Change to the directory specified in the path. If the wlst.cd() fails, assume something is wrong with the construction of the path tokens: Log a message, and return a indication to the caller that it should not continue on in this path. :param path: where to change directory :param location: context containing the current location information used to determine the path :return: the mbean instance if the wlst.cd() was successful, or None """ _method_name = 'wlst_cd' result = None try: result = wlst_helper.cd(path) except PyWLSTException, pe: _logger.warning('WLSDPLY-06140', path, str(location), pe.getLocalizedMessage(), class_name=_class_name, method_name=_method_name)