summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Reporting/models.py
diff options
context:
space:
mode:
authorTim Laszlo <tim.laszlo@gmail.com>2012-10-15 08:04:36 -0500
committerTim Laszlo <tim.laszlo@gmail.com>2012-10-15 09:20:32 -0500
commit9707ee8e4c495133f329000d3e5b89d8b84e5998 (patch)
tree38ad26163b4a8f8ac9dcfd9ace3001031de43a97 /src/lib/Bcfg2/Reporting/models.py
parenta1d43c65ccf28597c2fef482dfcd3780fb9b707e (diff)
downloadbcfg2-9707ee8e4c495133f329000d3e5b89d8b84e5998.tar.gz
bcfg2-9707ee8e4c495133f329000d3e5b89d8b84e5998.tar.bz2
bcfg2-9707ee8e4c495133f329000d3e5b89d8b84e5998.zip
migrate_db: skip db lookup since all should be known
Diffstat (limited to 'src/lib/Bcfg2/Reporting/models.py')
-rw-r--r--src/lib/Bcfg2/Reporting/models.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Reporting/models.py b/src/lib/Bcfg2/Reporting/models.py
index b8fe1b973..374331632 100644
--- a/src/lib/Bcfg2/Reporting/models.py
+++ b/src/lib/Bcfg2/Reporting/models.py
@@ -346,7 +346,7 @@ class BaseEntry(models.Model):
@classmethod
- def entry_get_or_create(cls, act_dict):
+ def entry_get_or_create(cls, act_dict, skip_fetch=False):
"""Helper to quickly lookup an object"""
cls_name = cls().__class__.__name__
act_hash = hash_entry(act_dict)
@@ -356,8 +356,11 @@ class BaseEntry(models.Model):
newact = cache.get(act_key)
if newact:
return newact
-
- acts = cls.objects.filter(hash_key=act_hash)
+
+ if not skip_fetch:
+ acts = cls.objects.filter(hash_key=act_hash)
+ else:
+ acts = []
if len(acts) > 0:
for act in acts:
for key in act_dict: