Revision bf0e2a03 snf-deploy/fabfile.py

b/snf-deploy/fabfile.py
432 432
@roles("db")
433 433
def allow_access_in_db(ip, user="all", method="md5"):
434 434
    cmd = """
435
    echo host all {0} {1}/32 {2} >> /etc/postgresql/8.4/main/pg_hba.conf
435
    pg_hba=$(ls /etc/postgresql/*/main/pg_hba.conf)
436
    echo host all {0} {1}/32 {2} >> $pg_hba
436 437
    """.format(user, ip, method)
437 438
    try_run(cmd)
438 439
    cmd = """
439
    sed -i 's/\(host.*127.0.0.1.*\)md5/\\1trust/' /etc/postgresql/8.4/main/pg_hba.conf
440
    pg_hba=$(ls /etc/postgresql/*/main/pg_hba.conf)
441
    sed -i 's/\(host.*127.0.0.1.*\)md5/\\1trust/' $pg_hba
440 442
    """
441 443
    try_run(cmd)
442 444
    try_run("/etc/init.d/postgresql restart")
......
456 458
    cmd = 'su - postgres -c "psql -w -f %s" ' % tmpl
457 459
    try_run(cmd)
458 460
    cmd = """
459
    echo "listen_addresses = '*'" >> /etc/postgresql/8.4/main/postgresql.conf
461
    conf=$(ls /etc/postgresql/*/main/postgresql.conf)
462
    echo "listen_addresses = '*'" >> $conf
460 463
    """
461 464
    try_run(cmd)
462 465

  
463 466
    if env.env.testing_vm:
464 467
        cmd = """
465
        echo "fsync=off\nsynchronous_commit=off\nfull_page_writes=off" >> /etc/postgresql/8.4/main/postgresql.conf
468
        conf=$(ls /etc/postgresql/*/main/postgresql.conf)
469
        echo "fsync=off\nsynchronous_commit=off\nfull_page_writes=off" >> $conf
466 470
        """
467 471
        try_run(cmd)
468 472

  

Also available in: Unified diff