web.pluginmanager.plugins.hardware_inventory.createhardwareprofile

Package web :: Package pluginmanager :: Package plugins :: Package hardware_inventory :: Module createhardwareprofile |
[hide private]
[frames] | no frames]

# Source Code for Module web.pluginmanager.plugins.hardware_inventory.createhardwareprofile

     1  import clientjob
     2  from clientjob.model import Job
     3  from main.model import Computer
     4  import web
     5
     6 -class CreateHardwareProfileView:
     7 -    def GET(self, element_type, name):
     8          orm = web.ctx.orm
     9
    10          if element_type == 'computer':
    11              computer = orm.query(Computer).filter(Computer.name == name).first()
    12              if not computer:
    13                  return False
    14
    15              self.create_hardware_inventory_computer(computer)
    16
    17          elif element_type == 'ou':
    18              return "Create Hardware Profile OU"
    19
    20          raise web.seeother('/jobs')
    21
    22 -    def create_hardware_inventory_computer(self, computer):
    23          job = Job()
    24          job.origin = 'hardware_inventory'
    25          job.callback_function = 'create_hardware_profile_response'
    26          job.computer = computer
    27          job.request = 'ogCreateHardwareInventory'
    28
    29          clientjob.send_job(job)
    30