def extract_instances_name(hostname): consoles = [] server_info = read_server_info(hostname) for console in server_info: consoles.append(console['consolename']) return consoles
def barInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break selected_bar = None for bar in selected_console['barlist']: if bar['name'] == resource_name: selected_bar = bar break #Retrieving datasource information if "resources" in selected_bar: pool_info = [] for pool in selected_bar['resources']: for retrieved_ds in selected_console['poollist']: if retrieved_ds['poolname'] == pool: convert_keys_names(retrieved_ds) pool_info.append(retrieved_ds) break selected_bar['datasources'] = pool_info else: logger.debug("No poollist key found for %s" % console['consolename']) convert_keys_names(selected_bar) return render_to_response('platforms/bar/batch.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL,"hostname":hostname, "bar":selected_bar}, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/batch.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL, "hostname": hostname}, context_instance=RequestContext(request))
def getDetailsTree(self, hostname): server_info = read_server_info(hostname) content = {} #Configuring Instances if server_info: content = {"isFolder": True, "expand":True, "title": 'Consoles', "key":'consoles', "icon":"console_bar.png"} logger.debug('Configuring Bar') consoles = [] for console in server_info: #Configure Console console_dict = {"isFolder": True, "title": console['consolename'], "key":console['consolename'], "icon":"console_bar.png", "detailsEnabled": "true", 'url': reverse('bar_console_details', kwargs={'hostname':hostname, 'console_name':console['consolename'], 'resource_name':console['consolename']})} #Configure Batch Archives batch = {'title': 'Batch', 'isFolder':True, "key":"batchlist", "icon":"batch_process.png", "type":"batch", "console":console["consolename"]} bars = [] for bar in console['barlist']: bar_dict = {'title':bar['name'], "key":bar['name'], "icon":"console.png", "type":"bar", "detailsEnabled":"true", "url": reverse('bar_details', kwargs={'hostname':hostname, 'console_name':console['consolename'], 'resource_name':bar['name']})} bars.append(bar_dict) batch['children'] = bars #Configure PoolList pool_menu = {'title': 'Pools', 'isFolder':True, "key":"poollist", "icon":"folder_database.png", "type":"pool", "console":console["consolename"], "detailsEnabled":"true", "url": reverse('bar_pools_details', kwargs={'hostname':hostname, 'console_name':console['consolename'], 'resource_name':console['consolename']})} pools = [] for pool in console['poollist']: pool_url = pool['poolname'].replace('/', '_') pool_dict = {'title':pool['poolname'], "key":pool['poolname'], "icon":"datasource.png", "type":"pool", "detailsEnabled":"true", "url": reverse('bar_pool_details', kwargs={'hostname':hostname, 'console_name':console['consolename'], 'resource_name':pool_url})} pools.append(pool_dict) pool_menu['children'] = pools console_dict['children'] = [batch, pool_menu] consoles.append(console_dict) content['children'] = consoles return content
def extract_appli_info(hostname, environment): applications = [] server_info = read_server_info(hostname) if server_info: for console in server_info: for bar in console['barlist']: version = "" if "version" in bar: version = bar["version"] app = { "type": "BAR", "name": bar["name"], "version": version, "env": environment, "servers": [{ "server": hostname, "instance": console["consolename"] }], "deploy": 1 } applications.append(app) return applications
def poolInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break resource_name = resource_name.replace('_', '/') pool = None for current in selected_console['poollist']: if current['poolname'] == resource_name: pool = current convert_keys_names(pool) break return render_to_response('platforms/bar/datasource.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "datasource": pool }, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/datasource.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "hostname": hostname }, context_instance=RequestContext(request))
def barConsoleInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break if 'java_ver' in selected_console: java_version = selected_console["java_ver"] else: java_version = "" return render_to_response('platforms/bar/console.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "hostname": hostname, "java_version": java_version }, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/console.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "hostname": hostname }, context_instance=RequestContext(request))
def poolsInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break resource_name = resource_name.replace('_', '/') return render_to_response('platforms/bar/datasources.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL, "datasources": selected_console['poollist']}, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/datasources.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL, "hostname": hostname}, context_instance=RequestContext(request))
def barConsoleInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break if 'java_ver' in selected_console: java_version = selected_console["java_ver"] else: java_version = "" return render_to_response('platforms/bar/console.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL,"hostname":hostname, "java_version":java_version}, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/console.html', {"base_url": settings.BASE_URL, "static_url":settings.STATIC_URL, "hostname": hostname}, context_instance=RequestContext(request))
def extract_appli_info(hostname, environment): applications = [] server_info = read_server_info(hostname) if server_info: for console in server_info: for bar in console['barlist']: version = "" if "version" in bar: version = bar["version"] app = {"type":"BAR", "name":bar["name"], "version":version, "env":environment, "servers":[{"server":hostname, "instance":console["consolename"]}], "deploy":1} applications.append(app) return applications
def barInventory(request, hostname, console_name, resource_name): server_info = read_server_info(hostname) if server_info: selected_console = None for console in server_info: if console['consolename'] == console_name: selected_console = console break selected_bar = None for bar in selected_console['barlist']: if bar['name'] == resource_name: selected_bar = bar break #Retrieving datasource information if "resources" in selected_bar: pool_info = [] for pool in selected_bar['resources']: for retrieved_ds in selected_console['poollist']: if retrieved_ds['poolname'] == pool: convert_keys_names(retrieved_ds) pool_info.append(retrieved_ds) break selected_bar['datasources'] = pool_info else: logger.debug("No poollist key found for %s" % console['consolename']) convert_keys_names(selected_bar) return render_to_response('platforms/bar/batch.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "hostname": hostname, "bar": selected_bar }, context_instance=RequestContext(request)) else: return render_to_response('platforms/bar/batch.html', { "base_url": settings.BASE_URL, "static_url": settings.STATIC_URL, "hostname": hostname }, context_instance=RequestContext(request))
def extract_appli_details(hostname, environment, barname): applications = [] server_info = read_server_info(hostname) if server_info: for console in server_info: for bar in console['barlist']: if bar["name"] != barname: continue version = "" if "version" in bar: version = bar["version"] app = {"type":"OC4J", "name":bar["name"], "version":version, "env":environment, "server": hostname, "resources":bar["resources"], "instance": console["consolename"]} applications.append(app) return applications
def extract_appli_details(hostname, environment, barname): applications = [] server_info = read_server_info(hostname) if server_info: for console in server_info: for bar in console['barlist']: if bar["name"] != barname: continue version = "" if "version" in bar: version = bar["version"] app = { "type": "OC4J", "name": bar["name"], "version": version, "env": environment, "server": hostname, "resources": bar["resources"], "instance": console["consolename"] } applications.append(app) return applications
def getDetailsTree(self, hostname): server_info = read_server_info(hostname) content = {} #Configuring Instances if server_info: content = { "isFolder": True, "expand": True, "title": 'Consoles', "key": 'consoles', "icon": "console_bar.png" } logger.debug('Configuring Bar') consoles = [] for console in server_info: #Configure Console console_dict = { "isFolder": True, "title": console['consolename'], "key": console['consolename'], "icon": "console_bar.png", "detailsEnabled": "true", 'url': reverse('bar_console_details', kwargs={ 'hostname': hostname, 'console_name': console['consolename'], 'resource_name': console['consolename'] }) } #Configure Batch Archives batch = { 'title': 'Batch', 'isFolder': True, "key": "batchlist", "icon": "batch_process.png", "type": "batch", "console": console["consolename"] } bars = [] for bar in console['barlist']: bar_dict = { 'title': bar['name'], "key": bar['name'], "icon": "console.png", "type": "bar", "detailsEnabled": "true", "url": reverse('bar_details', kwargs={ 'hostname': hostname, 'console_name': console['consolename'], 'resource_name': bar['name'] }) } bars.append(bar_dict) batch['children'] = bars #Configure PoolList pool_menu = { 'title': 'Pools', 'isFolder': True, "key": "poollist", "icon": "folder_database.png", "type": "pool", "console": console["consolename"], "detailsEnabled": "true", "url": reverse('bar_pools_details', kwargs={ 'hostname': hostname, 'console_name': console['consolename'], 'resource_name': console['consolename'] }) } pools = [] for pool in console['poollist']: pool_url = pool['poolname'].replace('/', '_') pool_dict = { 'title': pool['poolname'], "key": pool['poolname'], "icon": "datasource.png", "type": "pool", "detailsEnabled": "true", "url": reverse('bar_pool_details', kwargs={ 'hostname': hostname, 'console_name': console['consolename'], 'resource_name': pool_url }) } pools.append(pool_dict) pool_menu['children'] = pools console_dict['children'] = [batch, pool_menu] consoles.append(console_dict) content['children'] = consoles return content