summaryrefslogtreecommitdiffstats
path: root/reports
diff options
context:
space:
mode:
authorJoey Hagedorn <hagedorn@mcs.anl.gov>2006-08-02 21:45:39 +0000
committerJoey Hagedorn <hagedorn@mcs.anl.gov>2006-08-02 21:45:39 +0000
commit556d5e682665660adeffda3a8894e756ccbcb967 (patch)
tree52a170bdc2b8e4a804f93d8927258be4627d2f31 /reports
parent18fada4b268e627ef757c2ceb063f40f3d9d3492 (diff)
downloadbcfg2-556d5e682665660adeffda3a8894e756ccbcb967.tar.gz
bcfg2-556d5e682665660adeffda3a8894e756ccbcb967.tar.bz2
bcfg2-556d5e682665660adeffda3a8894e756ccbcb967.zip
NewReports: Works with db schema changes
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2031 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'reports')
-rwxr-xr-xreports/brpt/importscript.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/reports/brpt/importscript.py b/reports/brpt/importscript.py
index d588df806..81d921613 100755
--- a/reports/brpt/importscript.py
+++ b/reports/brpt/importscript.py
@@ -91,6 +91,7 @@ if __name__ == '__main__':
[interactions_hash.__setitem__(str(x[0])+"-"+x[1].isoformat(),x[2]) for x in cursor.fetchall()]#possibly change str to tuple
pingability = {}
[pingability.__setitem__(n.get('name'),n.get('pingable',default='N')) for n in clientsdata.findall('Client')]
+
cursor.execute("SELECT id, owner, current_owner, %s, current_group, perms, current_perms, status, current_status, %s, current_to, version, current_version, current_exists, current_diff from reports_reason"%(backend.quote_name("group"),backend.quote_name("to")))
reasons_hash = {}
@@ -150,16 +151,26 @@ if __name__ == '__main__':
print("Interaction for %s at %s with id %s already exists"%(clients[name],
datetime(t[0],t[1],t[2],t[3],t[4],t[5]),current_interaction_id))
else:
- cursor.execute("INSERT INTO reports_interaction VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s);",
+ cursor.execute("INSERT INTO reports_interaction VALUES (NULL, %s, %s, %s, %s, %s, %s, %s);",
[clients[name], timestamp,
statistics.get('state', default="unknown"), statistics.get('revision',default="unknown"),
- statistics.get('client_version',default="unknown"), pingability[name],
+ statistics.get('client_version',default="unknown"),
statistics.get('good',default="0"), statistics.get('total',default="0")])
current_interaction_id = cursor.lastrowid
interactions_hash[str(clients[name])+"-"+timestamp.isoformat()] = current_interaction_id
if verbose:
print("Interaction for %s at %s with id %s INSERTED in to db"%(clients[name],
timestamp, current_interaction_id))
+
+ #get current ping info
+ #figure out which ones changed
+ #update ones that didn't change, just update endtime
+ #if it doesn't exist, create a new one with starttime and endtime==now
+ #if it does exist, insert new with start time equal to the previous endtime, endtime==now
+
+ #if (somewhatverbose or verbose):
+ # print "---------------PINGDATA SYNCED---------------------"
+
for (xpath, hashname, tablename) in [('Bad/*', bad_hash, 'reports_bad'),
('Extra/*', extra_hash, 'reports_extra'),
('Modified/*', modified_hash, 'reports_modified')]: