Exemplo n.º 1
0
 def _getVmwareCategory(self):
     '''
     -> Category
     @raise MissingConfigFileException in case VMware category cannot be found
     Method reads config file with CIM categories and returns VMware category found
     '''
     categories = cim_discover.getCimCategories(self.framework)
     vmwareCategory = cim_discover.getCategoryByName(CimCategory.VMWARE, categories)
     if not vmwareCategory:
         msg = "VMware category definition cannot be found"
         raise RuntimeException(msg)
     return vmwareCategory
Exemplo n.º 2
0
 def _getVmwareCategory(self):
     '''
     -> Category
     @raise MissingConfigFileException in case VMware category cannot be found
     Method reads config file with CIM categories and returns VMware category found
     '''
     categories = cim_discover.getCimCategories(self.framework)
     vmwareCategory = cim_discover.getCategoryByName(
         CimCategory.VMWARE, categories)
     if not vmwareCategory:
         msg = "VMware category definition cannot be found"
         raise RuntimeException(msg)
     return vmwareCategory
Exemplo n.º 3
0
def cimConnectionCheck(credentialId, ipAddress, framework):
    
    credentialsCategory = framework.getProtocolProperty(credentialId, cim.ProtocolProperty.CATEGORY)
    categories = cim_discover.getCimCategories(framework)
    
    if credentialsCategory and credentialsCategory != cim.CimCategory.NO_CATEGORY:
        categories = [category for category in categories if category.getName() == credentialsCategory]
    
    namespaces = [ns for category in categories for ns in category.getNamespaces()]

    testFunction = fptools.partiallyApply(cim_discover.safeTestConnectionWithNamespace, framework, ipAddress, credentialId, fptools._)
    try:
        testedNamespaces = map(testFunction, namespaces)
        testedNamespaces = filter(None, testedNamespaces)
        if len(testedNamespaces) == 0:
            raise ValueError("Failed to establish connection to any namespace")
        return Result(True)
    except ValueError, ex:
        return Result(False, str(ex))