summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Smetana <tsmetana@redhat.com>2013-10-22 13:05:36 +0200
committerTomas Smetana <tsmetana@redhat.com>2013-10-22 13:24:01 +0200
commit6745437e51198befc5c9fa74611b4206e35b92f3 (patch)
tree9f4330fe0b3943704cd283dc2fdfaa311320c2cf
parent6d439c392595da41cec05554d0928a5ae1f71156 (diff)
downloadopenlmi-providers-6745437e51198befc5c9fa74611b4206e35b92f3.tar.gz
openlmi-providers-6745437e51198befc5c9fa74611b4206e35b92f3.tar.xz
openlmi-providers-6745437e51198befc5c9fa74611b4206e35b92f3.zip
Registration script: group list of registrations by ID when looking for number of registration IDs
-rwxr-xr-xopenlmi-mof-register.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/openlmi-mof-register.py b/openlmi-mof-register.py
index ba11191..f04d8f8 100755
--- a/openlmi-mof-register.py
+++ b/openlmi-mof-register.py
@@ -296,14 +296,15 @@ def db_get_registrations(cursor, mofs, reg):
if (reg):
qry = "SELECT mof.registration_id FROM mof JOIN reg \
ON mof.registration_id = reg.registration_id \
- WHERE (mof.fname in ('%(mofs)s') or reg.fname = '%(reg)s')" \
+ WHERE (mof.fname in ('%(mofs)s') or reg.fname = '%(reg)s') \
+ GROUP BY mof.registration_id" \
% { 'mofs': "','".join(bmofs), 'reg': reg }
else:
qry = "SELECT mof.registration_id FROM mof \
- WHERE (mof.fname in ('%(mofs)s'))" \
+ WHERE (mof.fname in ('%(mofs)s')) GROUP BY mof.registration_id" \
% { 'mofs': "','".join(bmofs) }
cursor.execute(qry)
- ret= cursor.fetchall()
+ ret = cursor.fetchall()
return ret
def db_register(mofs, reg, version, namespace, cimom):