summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2015-02-19 02:22:44 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2015-02-19 02:28:14 +0100
commit115c7368fc133d556e8635236e89bf8ecf5c6989 (patch)
treeb09b2bc363dfd7d5f8c8b7456486eed67fe5cccd
parent445d65f4093ffb0b5f03c427711e7c8a9e348ee6 (diff)
downloadbcfg2-115c7368fc133d556e8635236e89bf8ecf5c6989.tar.gz
bcfg2-115c7368fc133d556e8635236e89bf8ecf5c6989.tar.bz2
bcfg2-115c7368fc133d556e8635236e89bf8ecf5c6989.zip
Reporting/Storage: Fix handling of extra packages.
The code before for extra packages only worked for rpms because it only evaluated the version information of the contained <Instance> tag and droped the package if no one was avilable. Now the handling of <Instance> is optional and the package is imported everytime.
-rw-r--r--src/lib/Bcfg2/Reporting/Storage/DjangoORM.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
index 96226c424..efd9e594c 100644
--- a/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
+++ b/src/lib/Bcfg2/Reporting/Storage/DjangoORM.py
@@ -109,8 +109,8 @@ class DjangoORM(StorageBase):
# extra entries are a bit different. They can have Instance
# objects
if not act_dict['target_version']:
- for instance in entry.findall("Instance"):
- # FIXME - this probably only works for rpms
+ instance = entry.find("Instance")
+ if instance:
release = instance.get('release', '')
arch = instance.get('arch', '')
act_dict['current_version'] = instance.get('version')
@@ -118,9 +118,8 @@ class DjangoORM(StorageBase):
act_dict['current_version'] += "-" + release
if arch:
act_dict['current_version'] += "." + arch
- self.logger.debug("Adding package %s %s" %
- (name, act_dict['current_version']))
- return PackageEntry.entry_get_or_create(act_dict)
+ self.logger.debug("Adding extra package %s %s" %
+ (name, act_dict['current_version']))
else:
self.logger.debug("Adding package %s %s" %
(name, act_dict['target_version']))
@@ -128,7 +127,7 @@ class DjangoORM(StorageBase):
# not implemented yet
act_dict['verification_details'] = \
entry.get('verification_details', '')
- return PackageEntry.entry_get_or_create(act_dict)
+ return PackageEntry.entry_get_or_create(act_dict)
def _import_Path(self, entry, state):
name = entry.get('name')