From 7e6dbd616dc5abbee055d59ac774f1eb440c27f2 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 19 Jun 2015 10:29:00 -0400 Subject: [PATCH] Allow fact scanning hosts with same name in two different inventories --- awx/fact/models/fact.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/awx/fact/models/fact.py b/awx/fact/models/fact.py index 783291ab42..e6efb9d782 100644 --- a/awx/fact/models/fact.py +++ b/awx/fact/models/fact.py @@ -21,15 +21,14 @@ class TransformField(BaseField): return value class FactHost(Document): - hostname = StringField(max_length=100, required=True, unique=True) - inventory_id = IntField(required=True) + hostname = StringField(max_length=100, required=True, unique_with='inventory_id') + inventory_id = IntField(required=True, unique_with='hostname') # TODO: Consider using hashed index on hostname. django-mongo may not support this but # executing raw js will meta = { 'indexes': [ - 'hostname', - 'inventory_id' + ('hostname', 'inventory_id') ] }