1 |
commit: a436a8360d42232c1285e0979f3c561579bba591 |
2 |
Author: Antanas Uršulis <antanas.ursulis <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jul 29 22:36:51 2013 +0000 |
4 |
Commit: Antanas Ursulis <antanas.ursulis <AT> gmail <DOT> com> |
5 |
CommitDate: Mon Jul 29 22:36:51 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/log-analysis.git;a=commit;h=a436a836 |
7 |
|
8 |
Add hostname to schema |
9 |
|
10 |
--- |
11 |
database.py | 4 ++-- |
12 |
portage_processor.py | 3 ++- |
13 |
schema.sql | 1 + |
14 |
3 files changed, 5 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/database.py b/database.py |
17 |
index 5202876..79ae693 100644 |
18 |
--- a/database.py |
19 |
+++ b/database.py |
20 |
@@ -11,9 +11,9 @@ class DatabaseConnection: |
21 |
self.conn.commit() |
22 |
return c.lastrowid |
23 |
|
24 |
- def insert_group(self, name, provider, date): |
25 |
+ def insert_group(self, hostname, name, provider, date): |
26 |
with closing(self.conn.cursor()) as c: |
27 |
- c.execute("insert into `groups` (`name`, `provider`, `date`) values (%s, %s, %s)", (name, provider, date)) |
28 |
+ c.execute("insert into `groups` (`hostname`, `name`, `provider`, `date`) values (%s, %s, %s, %s)", (hostname, name, provider, date)) |
29 |
self.conn.commit() |
30 |
return c.lastrowid |
31 |
|
32 |
|
33 |
diff --git a/portage_processor.py b/portage_processor.py |
34 |
index 66fb970..32ca9c4 100644 |
35 |
--- a/portage_processor.py |
36 |
+++ b/portage_processor.py |
37 |
@@ -14,7 +14,8 @@ class PortageProcessor: |
38 |
self.storage = storage |
39 |
|
40 |
def process(self, request, source, db): |
41 |
- group_id = db.insert_group(request.group_name, 'portage', int(time.time())) |
42 |
+ group_id = db.insert_group(source, request.group_name, 'portage', int(time.time())) |
43 |
+ |
44 |
for f in request.files: |
45 |
matches = 0 |
46 |
pkg_failed = False |
47 |
|
48 |
diff --git a/schema.sql b/schema.sql |
49 |
index 564385e..6b418a8 100644 |
50 |
--- a/schema.sql |
51 |
+++ b/schema.sql |
52 |
@@ -6,6 +6,7 @@ create table if not exists `files` ( |
53 |
|
54 |
create table if not exists `groups` ( |
55 |
`id` int primary key auto_increment, |
56 |
+ `hostname` varchar(255) not null, |
57 |
`name` text not null, |
58 |
`provider` varchar(16) not null, |
59 |
`date` int not null |