Beispiel #1
0
 def wrapper(*args, **kwargs):
     if not state.initialized:
         if config.get('debug', False) and config.get('debug.secret_key'):
             secret_key_file = config.get('debug.secret_key')
             crypto_util.load_secret_key_file(secret_key_file)
         else:        
             raise exc.CryptoNotInitialized("Crypto engine has not been initialized.")
     return f(*args, **kwargs)
Beispiel #2
0
def setup_crypto_state():
    """
    Initialize the crypto engine for already-crypto-configured database.
    """
    if config['debug'] and config['debug.secret_key']:
        crypto_util.load_secret_key_file(config['debug.secret_key'])
    else:
        passphrase = raw_input("Database Master Passphrase: ")
        crypto_util.configure_crypto_state(passphrase)
Beispiel #3
0
def test_data(options):
    """
    Erases database and replaces contents with test data.
    (This will only work if debug is on and debug secret key is set.)
    """
    if not config['debug'] or not config['debug.secret_key']:
        raise BuildFailure("This target only works with debug=True and debug.secret_key set")
    else:
        secret_key_file = config.get('debug.secret_key')
        crypto_util.load_secret_key_file(secret_key_file)
    
    #init_model(config)
    data = populate.TestDataPopulator()
    data.populate()