Exemplo n.º 1
0
def extract_instances_name(hostname):
    instances = []
    server_info = read_server_info(hostname)
    for instance in server_info:
        instances.append(instance['id'])
        
    return instances
Exemplo n.º 2
0
def extract_appli_info(hostname, environment):
    applications = []
    server_info = read_server_info(hostname)
    if server_info: 
        for instance in server_info:
            for appli in instance['applilist']:
                version = ""
                if "appliver" in appli and "version" in appli["appliver"]:
                    version = appli["appliver"]["version"]
                    
                app = {"type":"OC4J",
                       "name":appli["name"], 
                       "version":version,
                       "env":environment,
                       "servers":[{"server":hostname, "instance":instance["id"]}],
                       "deploy":1}
                applications.append(app)
    return applications
Exemplo n.º 3
0
def extract_appli_details(hostname, environment, appname):
    applications = []
    server_info = read_server_info(hostname)
    if server_info: 
        for instance in server_info:
            for appli in instance['applilist']:
                if appli["name"] != appname:
                    continue
                version = ""
                if "appliver" in appli and "version" in appli["appliver"]:
                    version = appli["appliver"]["version"]
                    
                app = {"type":"OC4J",
                       "name":appli["name"], 
                       "version":version,
                       "env":environment,
                       "server": hostname, 
                       "instance": instance["id"]}
                applications.append(app)
    return applications
Exemplo n.º 4
0
 def getDetailsTree(self, hostname):
     server_info = read_server_info(hostname)
     content = {}
     #Configuring Instances
     if server_info:
         content = {"isFolder": True, "expand": True, "title": 'OC4J', "key":'OC4J', "icon":"oracle_logo.png"}
         logger.debug('Configuring Instances')
         db_instances = {'title': 'Instances', 'isFolder':True, "expand":True, "key":"instance", "icon":"app_server.png", "type":"instances"}
         dbs = []
         for instance in server_info:
             db = {'title':instance['id'], "key":instance['id'], "icon":"web_instance.png", "type":"instance", "instance":instance['id'],"detailsEnabled":"true", 'url': reverse('oc4j_instance_details', kwargs={'hostname':hostname, 'instance_name':instance['id'], 'resource_name':instance['id']})}
             #Configuring Applications
             logger.debug('Configuring Applications')
             applications = {'title': 'Applications', 'isFolder':True, "key":"applications", "icon":"folder_applications.png", "type":"applications"}
             apps = []
             for appli in instance['applilist']:
                 app = {'title':appli['name'], "key":appli['name'], "icon":"application.png", "type":"application", "instance":instance['id'], "detailsEnabled":"true", 'url': reverse('oc4j_application_details', kwargs={'hostname':hostname, 'instance_name':instance['id'], 'resource_name':appli['name']})}
                 apps.append(app)
             applications['children'] = apps
             
             #Configuring Datasources
             logger.debug('Configuring Datasources')
             datasources = {'title': 'Datasources', 'isFolder':True, "key":"datasources", "icon":"folder_database.png", "type":"datasources", "instance":instance['id'], "detailsEnabled":"true", 'url': reverse('oc4j_datasources_details', kwargs={'hostname':hostname, 'instance_name':instance['id'], 'resource_name':instance['id']})}
             dss = []
             for datasource in instance['datasource']:
                 datasource_url = datasource['name'].replace('/', '_')
                 datasource = {'title':datasource['name'], "key":datasource['name'], "icon":"datasource.png", "type":"datasource", "instance":instance['id'], "detailsEnabled":"true", 'url': reverse('oc4j_datasource_details', kwargs={'hostname':hostname, 'instance_name':instance['id'], 'resource_name':datasource_url})}
                 dss.append(datasource)
             datasources['children'] = dss
             
             db['children'] = [datasources, applications]
             dbs.append(db)
         db_instances['children'] = dbs
         
         children = []
         children.append(db_instances)
         content['children'] = children 
     return content