Beispiel #1
0
def AddWmiServers(entity_host, nameSpace, entity_type, entity_id):
    DEBUG(
        "AddWmiServers entity_host=%s nameSpace=%s entity_type=%s entity_id=%s",
        entity_host, nameSpace, entity_type, entity_id)

    # This will not work on Linux.
    import lib_wmi

    mapWmi = dict()
    if lib_wmi.ValidClassWmi(entity_type):
        # TODO: We may also loop on all machines which may describe this object.
        wmiurl = lib_wmi.GetWmiUrl(entity_host, nameSpace, entity_type,
                                   entity_id)
        # sys.stderr.write("wmiurl=%s\n" % str(wmiurl))
        if wmiurl:
            wmiNode = lib_common.NodeUrl(wmiurl)
            if entity_host:
                txtLiteral = "WMI url, host=%s class=%s" % (entity_host,
                                                            entity_type)
            else:
                txtLiteral = "WMI url, current host, class=%s" % (entity_type)

            mapWmi[wmiNode] = [(pc.property_information,
                                lib_common.NodeLiteral(txtLiteral))]

            if entity_host:
                nodePortalWmi = lib_util.UrlPortalWmi(entity_host)

                mapWmi[wmiNode].append(
                    (pc.property_rdf_data_nolist2, nodePortalWmi))
    return mapWmi
Beispiel #2
0
def AddWmiServers(entity_host, name_space, entity_type, entity_id):
    """This adds a couple of URL """
    map_wmi = dict()

    # No WMI implementation is available on Linux.
    if lib_util.isPlatformLinux:
        return map_wmi

    import lib_wmi

    if lib_wmi.ValidClassWmi(entity_type):
        # TODO: This could loop on all machines possibly describing this object. How ?
        wmiurl = lib_wmi.GetWmiUrl(entity_host, name_space, entity_type,
                                   entity_id)
        if wmiurl:
            wmi_node = lib_common.NodeUrl(wmiurl)
            if entity_host:
                txt_literal = "WMI url, host=%s class=%s" % (entity_host,
                                                             entity_type)
            else:
                txt_literal = "WMI url, current host, class=%s" % entity_type

            map_wmi[wmi_node] = [(pc.property_information,
                                  lib_util.NodeLiteral(txt_literal))]

            if entity_host:
                node_portal_wmi = lib_util.UrlPortalWmi(entity_host)

                map_wmi[wmi_node].append(
                    (pc.property_rdf_data_nolist2, node_portal_wmi))
    return map_wmi
Beispiel #3
0
def AddDefaultScripts(grph, rootNode, entity_host):
    sys.stderr.write("AddDefaultScripts entity_host=%s\n" % entity_host)
    nodeObjTypes = lib_common.NodeUrl(lib_util.uriRoot + '/objtypes.py')
    grph.add((rootNode, pc.property_rdf_data_nolist2, nodeObjTypes))

    # Gives a general access to WBEM servers. In fact we might iterate on several servers, or none.
    nodePortalWbem = lib_util.UrlPortalWbem(entity_host)
    grph.add((rootNode, pc.property_rdf_data_nolist2, nodePortalWbem))

    # Gives a general access to WMI servers.
    nodePortalWmi = lib_util.UrlPortalWmi(entity_host)
    grph.add((rootNode, pc.property_rdf_data_nolist2, nodePortalWmi))
Beispiel #4
0
def _add_default_scripts(grph, root_node, entity_host):
    logging.debug("_add_default_scripts entity_host=%s", entity_host)
    node_obj_types = lib_common.NodeUrl(lib_util.uriRoot + '/objtypes.py')
    grph.add((root_node, pc.property_rdf_data_nolist2, node_obj_types))

    # Gives a general access to WBEM servers. In fact we might iterate on several servers, or none.
    node_portal_wbem = lib_util.UrlPortalWbem(entity_host)
    grph.add((root_node, pc.property_rdf_data_nolist2, node_portal_wbem))

    # Gives a general access to WMI servers.
    node_portal_wmi = lib_util.UrlPortalWmi(entity_host)
    grph.add((root_node, pc.property_rdf_data_nolist2, node_portal_wmi))
Beispiel #5
0
 def CredUrlWMI(hostname):
     node_wmi = lib_util.UrlPortalWmi(hostname)
     return node_wmi