def process(self, context):
        '''
        Plugin gets system information from DEFAULT profile. In case if profile
        cannot be processed - system information is parsed from instance
        profile path.

        Default profile read for system (identified by its path) is shared
        between application component instances
        '''
        shell = context.client
        osh = context.application.applicationOsh
        host_osh = context.hostOsh
        attrName = sap.InstanceBuilder.INSTANCE_PROFILE_PATH_ATTR
        pf_path = osh.getAttributeValue(attrName)
        logger.info("Instance pf path is: %s" % pf_path)
        system, pf_name = sap_discoverer.parsePfDetailsFromPath(pf_path)
        logger.info("Parsed details from pf name: %s" % str((system, pf_name)))
        topology = self._discover_topology(shell, system, pf_path)
        if topology:
            #resolver = dns_resolver.SocketDnsResolver()
            resolver = dns_resolver.create(shell, local_shell=None,
                                   dns_server=None,
                                   hosts_filename=None)

            db_host_osh, oshs = _report_db_host(topology, resolver)
            application_ip = _report_application_ip(shell, topology, resolver)
            if application_ip:
                logger.info("application ip is: %s" % application_ip)
                osh.setAttribute('application_ip', str(application_ip))
                host_app_osh = modeling.createHostOSH(str(application_ip))
                logger.info("set container: %s" % host_app_osh)
                osh.setContainer(host_app_osh)
            oshs.extend(self._report_topology(osh, host_osh, db_host_osh, topology))
            context.resultsVector.addAll(oshs)
Пример #2
0
 def get_sap_system(self):
     '''
     get SAP system from profile path
     @types:  -> sap.System?
     '''
     #r: check client code that system can be None
     system, pf_name = sap_discoverer.parsePfDetailsFromPath(self._pf_path)
     try:
         system = sap_discoverer.parseSapSystemFromInstanceProfileName(pf_name)
     except ValueError, ve:
         msg = str(ve)
         logger.warn("Failed to parse %s profile name. " % self.SERVER_TYPE, msg)
Пример #3
0
def _discover_msg_hostname(shell, pf_path):
    r'''Read DEFAULT profile to get message server hostname as usually this
    information resides there
    @types: Shell, str -> str?'''
    fs = file_system.createFileSystem(shell)
    pathtools = file_system.getPath(fs)
    system, _ = sap_discoverer.parsePfDetailsFromPath(pf_path)
    rootPath = sap_discoverer.findSystemBasePath(pf_path, system.getName())
    layout = sap_discoverer.Layout(pathtools, rootPath)
    default_pf_path = layout.getDefaultProfileFilePath()
    try:
        content = shell.safecat(default_pf_path)
    except (JException, Exception), e:
        logger.warn("Failed to get profile content: %s" % e)
Пример #4
0
    def process(self, context):
        '''
        Plugin gets system information from DEFAULT profile. In case if profile
        cannot be processed - system information is parsed from instance
        profile path.

        Default profile read for system (identified by its path) is shared
        between application component instances
        '''
        shell = context.client
        osh = context.application.applicationOsh
        host_osh = context.hostOsh
        attrName = sap.InstanceBuilder.INSTANCE_PROFILE_PATH_ATTR
        pf_path = osh.getAttributeValue(attrName)
        logger.info("Instance pf path is: %s" % pf_path)
        system, pf_name = sap_discoverer.parsePfDetailsFromPath(pf_path)
        logger.info("Parsed details from pf name: %s" % str((system, pf_name)))
        topology = self._discover_topology(shell, system, pf_path)
        if topology:
            #resolver = dns_resolver.SocketDnsResolver()
            resolver = dns_resolver.create(shell,
                                           local_shell=None,
                                           dns_server=None,
                                           hosts_filename=None)

            db_host_osh, oshs = _report_db_host(topology, resolver)
            application_ip = _report_application_ip(shell, topology, resolver)
            if application_ip:
                logger.info("application ip is: %s" % application_ip)
                osh.setAttribute('application_ip', str(application_ip))
                host_app_osh = modeling.createHostOSH(str(application_ip))
                logger.info("set container: %s" % host_app_osh)
                osh.setContainer(host_app_osh)
            oshs.extend(
                self._report_topology(osh, host_osh, db_host_osh, topology))
            context.resultsVector.addAll(oshs)