def host_add_labels(id, labels):
 labels = models.Label.smart_get_bulk(labels)
 host = models.Host.smart_get(id)
 platforms = [label.name for label in labels if label.platform]
 if (len(platforms) > 1):
  raise model_logic.ValidationError({'labels': ('Adding more than one platform label: %s' % ', '.join(platforms))})
 if (len(platforms) == 1):
  models.Host.check_no_platform([host])
 host.labels.add(*labels)

def host_add_labels ( id , labels ) : labels = models . Label . smart_get_bulk ( labels ) host = models . Host . smart_get ( id ) platforms = [ label . name for label in labels if label . platform ] if ( len ( platforms ) > 1 ) : raise model_logic . ValidationError ( { 'labels' : ( 'Adding more than one platform label: %s' % ', ' . join ( platforms ) ) } ) if ( len ( platforms ) == 1 ) : models . Host . check_no_platform ( [ host ] ) host . labels . add ( * labels )
add labels to host .