def _get_env_config(): domain_dir = get('RootDirectory') directory = '/'.join((domain_dir, 'classpath-ext/resources')) configs = [] try: for filename in os.listdir(directory): if filename.endswith('.id'): parts = filename.split('-') config = ('-').join(parts[:-1]) version = parts[-1][:-3] configs.append((config, version, 'Config', 'classpath')) except OSError: pass return configs
def get(attribute): """ Return the value for the attribute at the current location :param attribute: name of the wlst attribute :return: value set for the attribute :raises: PyWLSTException: if a WLST error occurs """ _method_name = 'get' _logger.finest('WLSDPLY-00004', attribute, class_name=_class_name, method_name=_method_name) try: result = wlst.get(attribute) except (wlst.WLSTException, offlineWLSTException), e: pwe = exception_helper.create_pywlst_exception('WLSDPLY-00005', attribute, _get_exception_mode(e), _format_exception(e), error=e) _logger.throwing(class_name=_class_name, method_name=_method_name, error=pwe) raise pwe
def _get_lib_jars(): lib_jars = [] domain_dir = get('RootDirectory') #print 'domain_dir', domain_dir for subdir in ('lib', 'lib/mbeantypes'): directory = '/'.join((domain_dir, subdir)) #print 'directory', directory try: for filename in os.listdir(directory): if filename.endswith('.jar'): components = filename[:-4].split('-') name = '-'.join(components[:-1]) version = components[-1] lib_jars.append((name, version, 'JarFile', subdir)) #print name, version, 'JarFile', subdir except OSError: pass lib_jars.sort() return lib_jars
def _get_version_from_file(category, entry): #print entry fname = get('serverConfig:/' + category + '/' + entry + '/SourcePath') _, fname = os.path.split(fname) components = fname.split('.') #print components if len(components) == 3: name = fname.replace('.', '-') version = entry.split('#')[-1].split('@')[-1] elif len(components) == 4 and '-' in fname: ncomponents = components[0].split('-') components[0] = ncomponents[-1] name = '-'.join(ncomponents[:-1]) version = '.'.join(components[:-1]) else: name = entry components[0] = components[0][len(entry) + 1:] version = '.'.join(components[:-1]) #print name, version return (name, version)
def get(name): return wlst.get(name)
def _get_names(target): values = [] for item in get(target): values.append(str(item).split('Name=')[1].split(',')[0]) values.sort() return values