fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] Simplification of contains?


From: Jorge Vargas
Subject: [Fab-user] Simplification of contains?
Date: Thu, 28 May 2009 19:13:28 -0400

I can't seem to find a way to simplify this, it looks to ugly for me.

I basically need to know if env.domain is in a or b file and if it
isn't put it in b and recreate C

    with settings(warn_only=True):
        check1 = contains(env.domain,'/etc/check1',exact=True)
        if check1.failed:
            check2 = contains(env.domain,'/etc/check2',exact=True):
            if check2.failed:
                append("%(domain)s" % env,'/etc/check2')
                run('regenerate_config /etc/check3')

As a related note, is there a simple way to provide a different
message to contains (which call run, which calls abort) I'll like to
have a "custom abort message, instead of the failed command something
more human like. "This server failed check X"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]