def _injectedInventorySend (self, computer, mac, inventory): """ Inventory sending by HTTP POST to inventory server. @param computer: ComputerManager container @type computer: dist @param mac: MAC address @type mac: str @param inventory: inventory from PXE @type inventory: str """ self.api.logClientAction(mac, LOG_LEVEL.DEBUG, LOG_STATE.INVENTORY, "hardware inventory received") if not isinstance(computer, dict) : logging.getLogger().debug("PXE Proxy: Unknown client, ignore received inventory") return inventory = BootInventory(inventory) inventory.macaddr_info = mac hostname = computer['shortname'] entity = computer['entity'] inventory = inventory.dumpOCS(hostname, entity) d = self.send_inventory(inventory, hostname) @d.addCallback def _cb(result): self.api.logClientAction(mac, LOG_LEVEL.INFO, LOG_STATE.INVENTORY, "hardware inventory updated") @d.addErrback def _eb(failure): self.api.logClientAction(mac, LOG_LEVEL.WARNING, LOG_STATE.INVENTORY, "hardware inventory not updated")
def _injectedInventorySend(self, computer, mac, inventory): """ Inventory sending by HTTP POST to inventory server. @param computer: ComputerManager container @type computer: dist @param mac: MAC address @type mac: str @param inventory: inventory from PXE @type inventory: str """ self.api.logClientAction(mac, LOG_LEVEL.DEBUG, LOG_STATE.INVENTORY, "hardware inventory received") if not isinstance(computer, dict): logging.getLogger().debug( "PXE Proxy: Unknown client, ignore received inventory") return inventory = BootInventory(inventory) inventory.macaddr_info = mac hostname = computer['shortname'] entity = computer['entity'] inventory = inventory.dumpOCS(hostname, entity) d = self.send_inventory(inventory, hostname) @d.addCallback def _cb(result): self.api.logClientAction(mac, LOG_LEVEL.INFO, LOG_STATE.INVENTORY, "hardware inventory updated") @d.addErrback def _eb(failure): self.api.logClientAction(mac, LOG_LEVEL.WARNING, LOG_STATE.INVENTORY, "hardware inventory not updated")
def glpi_register(self, mac, hostname, ip_address): """ Computer register sending a minimal inventory @param mac: MAC address @type mac: str @param hostname: hostname of inventoried machine @type hostname: str @param ip_address: machine IP address @type ip_address: str """ boot_inv = BootInventory() boot_inv.macaddr_info = mac boot_inv.ipaddr_info = {'ip': ip_address, 'port': 0} inventory = boot_inv.dumpOCS(hostname, "root") return self.send_inventory(inventory, hostname)
def glpi_register(self, mac, hostname, ip_address): """ Computer register sending a minimal inventory @param mac: MAC address @type mac: str @param hostname: hostname of inventoried machine @type hostname: str @param ip_address: machine IP address @type ip_address: str """ logging.getLogger().debug("glpi_register") boot_inv = BootInventory() boot_inv.macaddr_info = mac boot_inv.ipaddr_info = {'ip': ip_address, 'port': 0} # add information network in xml glpi boot_inv.netmask_info = P2PServerCP().public_mask boot_inv.subnet_info = self.subnetreseau(boot_inv.ipaddr_info['ip'],boot_inv.netmask_info) inventory = boot_inv.dumpOCS(hostname, "root") return self.send_inventory(inventory, hostname)
def glpi_register(self, mac, hostname, ip_address): """ Computer register sending a minimal inventory @param mac: MAC address @type mac: str @param hostname: hostname of inventoried machine @type hostname: str @param ip_address: machine IP address @type ip_address: str """ logging.getLogger().debug("glpi_register") boot_inv = BootInventory() boot_inv.macaddr_info = mac boot_inv.ipaddr_info = {'ip': ip_address, 'port': 0} # add information network in xml glpi boot_inv.netmask_info = P2PServerCP().public_mask boot_inv.subnet_info = self.subnetreseau(boot_inv.ipaddr_info['ip'], boot_inv.netmask_info) inventory = boot_inv.dumpOCS(hostname, "root") return self.send_inventory(inventory, hostname)