def DiscoveryMain(Framework): OSHVResult = ObjectStateHolderVector() #ipAddress = Framework.getDestinationAttribute('ip_address') #credentialsId = Framework.getDestinationAttribute('credentialsId') hostId = Framework.getDestinationAttribute('hostId') try: factory = hyperv.ShellClientFactory(Framework) shell = None try: shell = factory.createClient() language = shell.getOsLanguage() bundle = hyperv.getBundleByLanguage(language, Framework) namespace = hyperv.ShellNamespaceLookUp().lookUp(shell) wmiProvider = hyperv.ShellHypervAgentProvider( shell, bundle, namespace) hyperv.discoverHypervHost( wmiProvider, hostId, Framework, OSHVResult, namespace[2:]) #strip heading slashes in namespace finally: if shell is not None: shell.closeClient() except JException, ex: exInfo = ex.getMessage() errormessages.resolveAndReport(exInfo, NTCMD_PROTOCOL, Framework)
def DiscoveryMain(Framework): OSHVResult = ObjectStateHolderVector() #ipAddress = Framework.getDestinationAttribute('ip_address') #credentialsId = Framework.getDestinationAttribute('credentialsId') hostId = Framework.getDestinationAttribute('hostId') try: factory = hyperv.ShellClientFactory(Framework) shell = None try: shell = factory.createClient() language = shell.getOsLanguage() bundle = hyperv.getBundleByLanguage(language, Framework) namespace = hyperv.ShellNamespaceLookUp().lookUp(shell) wmiProvider = hyperv.ShellHypervAgentProvider(shell, bundle, namespace) hyperv.discoverHypervHost(wmiProvider, hostId, Framework, OSHVResult, namespace[2:])#strip heading slashes in namespace finally: if shell is not None: shell.closeClient() except JException, ex: exInfo = ex.getMessage() errormessages.resolveAndReport(exInfo, NTCMD_PROTOCOL, Framework)
def DiscoveryMain(Framework): OSHVResult = ObjectStateHolderVector() #ipAddress = Framework.getDestinationAttribute('ip_address') #credentialsId = Framework.getDestinationAttribute('credentialsId') hostId = Framework.getDestinationAttribute('hostId') language = getLanguage(Framework) bundle = hyperv.getBundleByLanguage(language, Framework) try: namespace = hyperv.WmiNamespaceLookUp(Framework).lookUp() factory = hyperv.WmiClientFactory(Framework, namespace) client = factory.createClient() wmiProvider = hyperv.WmiHypervAgentProvider(client, bundle) try: hyperv.discoverHypervHost(wmiProvider, hostId, Framework, OSHVResult, namespace) finally: client.close() except JException, ex: exInfo = ex.getMessage() errormessages.resolveAndReport(exInfo, WMI_PROTOCOL, Framework)