~daisy-pluckers/daisy/trunk

« back to all changes in this revision

Viewing changes to tools/add_system_identifiers.py

  • Committer: Evan Dandrea
  • Date: 2013-03-09 01:19:57 UTC
  • Revision ID: evan.dandrea@canonical.com-20130309011957-4onwo0cxmbuygs1b
Refactor configuration handling. The decision to import local_config or configuration is always handled in __init__ now, and the imported configuration is always validated and further manipulated at that point.
Fixed a bug in write_bucket_to_disk where the oops_id was overwritten as the null string.
Fixed a bug where query_bucket_versions would raise an IndexError for an empty set.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
import pycassa
4
 
 
5
 
configuration = None
6
 
try:
7
 
    import local_config as configuration
8
 
except ImportError:
9
 
    pass
10
 
 
11
 
if not configuration:
12
 
    from daisy import configuration
13
 
 
14
 
creds = {'username': configuration.cassandra_username,
15
 
         'password': configuration.cassandra_password}
16
 
pool = pycassa.ConnectionPool(configuration.cassandra_keyspace,
17
 
                              configuration.cassandra_hosts, timeout=15,
 
4
from daisy import config
 
5
 
 
6
creds = {'username': config.cassandra_username,
 
7
         'password': config.cassandra_password}
 
8
pool = pycassa.ConnectionPool(config.cassandra_keyspace,
 
9
                              config.cassandra_hosts, timeout=15,
18
10
                              credentials=creds)
19
11
 
20
12
useroops_cf = pycassa.ColumnFamily(pool, 'UserOOPS')