Esempio n. 1
0
def fixBasicAuth(domainName):
    print("Fixing BasicAuth intercept")
    if (wlst.ls().find('SecurityConfiguration') == -1
            or wlst.ls('SecurityConfiguration').find(domainName) == -1):
        wlst.create(domainName, 'SecurityConfiguration')
    wlst.cd('/SecurityConfiguration/' + domainName)
    wlst.set('EnforceValidBasicAuthCredentials', 'false')
    print("Done")
def _ls(method_name, ls_type, path=None, log_throwing=True):
    """
    Private helper method shared by various API methods
    :param method_name: calling method name
    :param ls_type: the WLST return type requested
    :param path: the path (default is the current path)
    :param log_throwing: whether or not to log the throwing message if the path location is not found
    :return: the result of the WLST ls(returnMap='true') call
    :raises: PyWLSTException: if a WLST error occurs
    """
    _method_name = method_name
    _logger.finest('WLSDPLY-00028', method_name, ls_type, path, class_name=_class_name, method_name=_method_name)

    if path is not None:
        # ls(path, returnMap='true') is busted in earlier versions of WLST so go ahead and
        # change directories to the specified path to workaround this
        current_path = get_pwd()
        cd(path)
        try:
            result = wlst.ls(ls_type, returnMap='true', returnType=ls_type)
        except (wlst.WLSTException, offlineWLSTException), e:
            pwe = exception_helper.create_pywlst_exception('WLSDPLY-00029', path, ls_type, _get_exception_mode(e),
                                                           _format_exception(e), error=e)
            if log_throwing:
                _logger.throwing(class_name=_class_name, method_name=_method_name, error=pwe)
            cd(current_path)
            raise pwe
        cd(current_path)
def path_exists(path):
    """
    Determine if the provided path exists in the domain. This can be a path relative to the
    current location or a fully qualified path.
    :param path: path to validate.
    :return: True if path exists; false otherwise
    :raises: PyWLSTException: if a WLST error occurs
    """
    _method_name = 'path_exists'
    _logger.finest('WLSDPLY-00025', path, class_name=_class_name, method_name=_method_name)

    exists = True
    try:
        wlst.ls(path)
    except (wlst.WLSTException, offlineWLSTException), e:
        _logger.finest('WLSDPLY-00026', path, e.getLocalizedMessage(), class_name=_class_name, method_name=_method_name)
        exists = False
Esempio n. 4
0
def createJms(jmsServerName, jmsModuleName, cfName, cfJndiName, queueNames,
              queueJndiNames, jmsSubName, target):
    print("Creating Jms")
    wlst.cd('/')
    if (wlst.ls().find('JMSServer') == -1
            or wlst.ls('JMSServer').find(jmsServerName) == -1):
        wlst.create(jmsServerName, 'JMSServer')

    wlst.cd('/')
    if (wlst.ls().find('JMSSystemResource') == -1
            or wlst.ls('JMSSystemResource').find(jmsModuleName) == -1):
        wlst.create(jmsModuleName, 'JMSSystemResource')

    wlst.cd('/JMSSystemResource/' + jmsModuleName)
    if (wlst.ls().find('SubDeployment') == -1
            or wlst.ls('SubDeployment').find(jmsSubName) == -1):
        wlst.create(jmsSubName, 'SubDeployment')

    wlst.cd('/')
    wlst.assign('JMSServer', jmsServerName, 'Target', target)
    wlst.assign('JMSSystemResource', jmsModuleName, 'Target', target)
    wlst.assign('JMSSystemResource.SubDeployment', jmsSubName, 'Target',
                jmsServerName)

    wlst.cd('/JMSSystemResource/' + jmsModuleName + '/JmsResource/NO_NAME_0')
    wlst.create(cfName, 'ConnectionFactory')
    wlst.cd('ConnectionFactory/' + cfName)
    wlst.set('JNDIName', cfJndiName)
    wlst.set('SubDeploymentName', jmsSubName)

    for i in range(len(queueNames)):
        queueName = queueNames[i]
        queueJndiName = queueJndiNames[i]
        wlst.cd('/JMSSystemResource/' + jmsModuleName +
                '/JmsResource/NO_NAME_0')
        wlst.create(queueName, 'Queue')
        wlst.cd('Queue/' + queueName)
        wlst.set('JNDIName', queueJndiName)
        wlst.set('SubDeploymentName', jmsSubName)

    print("Done")
        current_path = get_pwd()
        cd(path)
        try:
            result = wlst.ls(ls_type, returnMap='true', returnType=ls_type)
        except (wlst.WLSTException, offlineWLSTException), e:
            pwe = exception_helper.create_pywlst_exception('WLSDPLY-00029', path, ls_type, _get_exception_mode(e),
                                                           _format_exception(e), error=e)
            if log_throwing:
                _logger.throwing(class_name=_class_name, method_name=_method_name, error=pwe)
            cd(current_path)
            raise pwe
        cd(current_path)
    else:
        current_path = get_pwd()
        try:
            result = wlst.ls(ls_type, returnMap='true', returnType=ls_type)
        except (wlst.WLSTException, offlineWLSTException), e:
            pwe = exception_helper.create_pywlst_exception('WLSDPLY-00029', current_path, ls_type,
                                                           _get_exception_mode(e), _format_exception(e), error=e)
            _logger.throwing(class_name=_class_name, method_name=_method_name, error=pwe)
            raise pwe
    _logger.finest('WLSDPLY-00030', method_name, ls_type, current_path, result,
                   class_name=_class_name, method_name=_method_name)
    return result


def get_singleton_name(path=None):
    """
    Return the name at the current location or at the provided path. This location represents
    the name of an MBean that is a singleton. None will be returned if a location is provided and
    it does not exist.
Esempio n. 6
0
def lsOpMap():
    result = wlst.ls(returnMap='true', returnType='o')
    return result
Esempio n. 7
0
def lsChildMap():
    result = wlst.ls(returnMap='true', returnType='c')
    return result
Esempio n. 8
0
def lsAttrMap():
    result = wlst.ls(returnMap='true', returnType='a')
    return result
Esempio n. 9
0
def lsmap():
    result = wlst.ls(returnMap='true')
    return result
Esempio n. 10
0
def ls(propertySet):
    return wlst.ls(propertySet)
Esempio n. 11
0
def __sls():
  wl.redirect('/dev/null', 'false')
  result = wl.ls(returnMap = 'true')
  wl.redirect('/dev/null', 'true')
  return result