Juste one mistake :
The command line :

   /user@debian:~/fabric$ fab -c /home/user/.fabricrc -f fab.py *-R*
   test1 boot/



On 19/04/12 11:51, Fabien Murgues wrote:
Hello,

To get back to my precedent post, I have a problem with the .fabrirc file. I try to put in this file (~/.fabricrc) the general settings fro my script (like hosts and passwords), but when I execute my script it does not work. Maybe I made a mistake with the use of this file, I am looking for a general settings file.

The .fabricrc :

    /from fabric.api import env/

    /env.roledefs = {/
    /    'test1' : ['user1@localhost'],/
    /    'test2' : [ 'user2@server'2],/
    /    'all' : [ '//user1@localhost//', 'user2@server2'],/
    /    }/

    /env.passwords = {'//user1@localhost//': 'aaaa', 'user2@server2':
    'bbbb'}/

The fabric file fab.py :/
/

    /from fabric.api import run,env,sudo,hide/

    /def boot():/
    /    run('uptime')/

    /def version():/
    /    with hide('running'):/
    /        val = run("awk '{print $1}' /etc/issue | head -n 1")/
    /    if val == "Ubuntu":/
    /        run("echo UBUNTU")/
    /    if val == "Debian":/
    /        run("echo DEBIAN")/

    /def update():/
    /    sudo("aptitude update; aptitude safe-upgrade")/


The command line :

    /user@debian:~/fabric$ fab -c /home/user/.fabricrc -f fab.py -H
    test1 boot/
    /[test1] Executing task 'boot'/
    /[test1] run: uptime/

    /Fatal error: Name lookup failed for test1/

    /Aborting./



With all the commands in one file, everything is ok...




--


Cordialement,
Fabien Murgues

Service Commun Documentation Saint Etienne
Informatique
23 rue Docteur Paul Michelon
42023 Saint Etienne Cedex 2

tél : 04 77 48 15 92
fax : 04 77 48 15 91


_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

--


Cordialement,
Fabien Murgues

Service Commun Documentation Saint Etienne
Informatique
23 rue Docteur Paul Michelon
42023 Saint Etienne Cedex 2

tél : 04 77 48 15 92
fax : 04 77 48 15 91

<<attachment: fabien_murgues.vcf>>

_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to