55 if user == source.get('db-user') and source.get('db-password'): |
55 if user == source.get('db-user') and source.get('db-password'): |
56 password = source['db-password'] |
56 password = source['db-password'] |
57 else: |
57 else: |
58 password = getpass('password: ') |
58 password = getpass('password: ') |
59 return get_connection(driver, dbhost, dbname, user, password=password, |
59 return get_connection(driver, dbhost, dbname, user, password=password, |
60 port=source.get('db-port')) |
60 port=source.get('db-port'), |
|
61 extra_args=source.get('db-extra-arguments')) |
61 |
62 |
62 def system_source_cnx(source, dbms_system_base=False, |
63 def system_source_cnx(source, dbms_system_base=False, |
63 special_privs='CREATE/DROP DATABASE', verbose=True): |
64 special_privs='CREATE/DROP DATABASE', verbose=True): |
64 """shortcut to get a connextion to the instance system database |
65 """shortcut to get a connextion to the instance system database |
65 defined in the given config. If <dbms_system_base> is True, |
66 defined in the given config. If <dbms_system_base> is True, |
366 try: |
367 try: |
367 system = config.sources()['system'] |
368 system = config.sources()['system'] |
368 get_connection( |
369 get_connection( |
369 system['db-driver'], database=system['db-name'], |
370 system['db-driver'], database=system['db-name'], |
370 host=system.get('db-host'), port=system.get('db-port'), |
371 host=system.get('db-host'), port=system.get('db-port'), |
371 user=system.get('db-user'), password=system.get('db-password')) |
372 user=system.get('db-user'), password=system.get('db-password'), |
|
373 extra_args=system.get('db-extra-arguments')) |
372 except Exception, ex: |
374 except Exception, ex: |
373 raise ConfigurationError( |
375 raise ConfigurationError( |
374 'You seem to have provided wrong connection information in '\ |
376 'You seem to have provided wrong connection information in '\ |
375 'the %s file. Resolve this first (error: %s).' |
377 'the %s file. Resolve this first (error: %s).' |
376 % (config.sources_file(), str(ex).strip())) |
378 % (config.sources_file(), str(ex).strip())) |