def countInventoryHistory(days, only_new, pattern): return Inventory().countInventoryHistory(days, only_new, pattern)
def getMachinesBy(table, field, value): # TODO : ctx is missing....Inventory ctx = None return Inventory().getMachinesBy(ctx, table, field, value)
def getInventoryHistory(days, only_new, pattern, max, min): # Use xmlrpcCleanup to clean the date values return xmlrpcCleanup(Inventory().getInventoryHistory( days, only_new, pattern, max, min))
def getUUIDByMachineName(self, name): ctx = self.currentContext return xmlrpcCleanup(Inventory().getUUIDByMachineName(ctx, name))
def getValueFuzzyWhere(table, field1, value1, field2, fuzzy_value): return Inventory().getValueFuzzyWhere(table, field1, value1, field2, fuzzy_value)
def getMachineByOwner(self, user): ctx = self.currentContext return xmlrpcCleanup(Inventory().getMachineByOwner(ctx, user))
def getLastMachineInventoryFull(self, params): ctx = self.currentContext # if not ComputerLocationManager().doesUserHaveAccessToMachine(ctx.userid, uuid): # return False return xmlrpcCleanup(Inventory().getLastMachineInventoryFull( ctx, params))
def getMachineByHostnameAndMacs(self, hostname, macs): ctx = self.currentContext return xmlrpcCleanup(Inventory().getMachineByHostnameAndMacs( ctx, hostname, macs))
def getMachines(self, pattern=None): ctx = self.currentContext return xmlrpcCleanup(Inventory().getMachines(ctx, pattern))
def getMachineNumberByState(self): ctx = self.currentContext return xmlrpcCleanup(Inventory().getMachineNumberByState(ctx))
def getMachineListByState(self, groupName): ctx = self.currentContext return xmlrpcCleanup(Inventory().getMachineListByState(ctx, groupName))
def getMachineInventoryDiff(self, params): ctx = self.currentContext # Use xmlrpcCleanup to clean all None values return xmlrpcCleanup(Inventory().getComputerInventoryDiff(ctx, params))
def countMachineInventoryHistory(self, params): ctx = self.currentContext return Inventory().countComputerInventoryHistory(ctx, params)
def countLastMachineInventoryPart(self, part, params): ctx = self.currentContext return xmlrpcCleanup(Inventory().countLastMachineInventoryPart( ctx, part, params))
def getTypeOfAttribute(klass, attr): return Inventory().getTypeOfAttribute(klass, attr)
def getValues(table, field): return Inventory().getValues(table, field)
def getContext(self): s = SecurityContext() s.userid = self.userid s.locations = Inventory().getUserLocations(s.userid) s.locationsid = map(lambda e: e.id, s.locations) return s
def getValuesWhere(table, field1, value1, field2): return Inventory().getValuesWhere(table, field1, value1, field2)
def getLastMachineInventoryPart(self, part, params): ctx = self.currentContext # uuid = name # TODO : get uuid from name, or something like that... # ComputerLocationManager().doesUserHaveAccessToMachine(ctx.userid, uuid) return xmlrpcCleanup(Inventory().getLastMachineInventoryPart( ctx, part, params))
def getValuesFuzzy(table, field, fuzzy_value): return Inventory().getValuesFuzzy(table, field, fuzzy_value)
def getMachineInventoryHistory(self, params): ctx = self.currentContext return xmlrpcCleanup(Inventory().getComputerInventoryHistory( ctx, params))
def __init__(self, conffile=None): self.logger = logging.getLogger() self.config = InventoryConfig() self.inventory = Inventory()