def machine_create(hostname, machine_group=None, owner=None):
 try:
  machine = Machine.objects.get(hostname__exact=hostname)
 except Machine.DoesNotExist:
  machine = Machine.objects.create(hostname=hostname)
 if (machine_group is not None):
  machine.machine_group = machine_group
 if (owner is not None):
  machine.owner = owner
 return machine

def machine_create ( hostname , machine_group = None , owner = None ) : try : machine = Machine . objects . get ( hostname__exact = hostname ) except Machine . DoesNotExist : machine = Machine . objects . create ( hostname = hostname ) if ( machine_group is not None ) : machine . machine_group = machine_group if ( owner is not None ) : machine . owner = owner return machine
creates a new machine being silent if it already exists .