def create_computer(self, account, remote_host, hostname, os_name, os_version): """Create computer in database (and link it to the account of the creator). Returns the computer id. """ # XXX: Add logging. if not type(hostname) == str or not type(os_name) == str \ or not type(os_version) == str: raise InvalidParamsFault('create_computer') if account.computer: raise NotPossibleFault('Account already associated with a computer' 'record.') c = Computer(hostname=hostname, os_name=os_name, os_version=os_version) c.save() c.flush() return c.oid