fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] Log & integratiing extra commands


From: Unatine
Subject: Re: [Fab-user] Log & integratiing extra commands
Date: Thu, 11 Feb 2010 00:37:54 +0300

On Wed, Feb 10, 2010 at 11:54 PM, Nicolas Steinmetz
<address@hidden> wrote:
> Hi,
>
> 2010/2/10 Jeff Forcier <address@hidden>
>>
>> Could you provide an example here? I'm afraid I don't quite follow
>> what you're asking :)
>
> Yep, of course :-)
> For now, I have a commands.upd file which can contains commands to execute
> against some servers :
> Ex :
> remote front cd /var/www/myapp && php path/to/script.php -s <arg> : will
> execute the given command on all frontals
> remote once front cd /var/www/myapp && php /path/to/script2.php -s <arg> -u
> <arg> : will execute the command on the first frontal only
> remote db mysql -u<usser> -p<pass> -e "SQL Query" : will execute the query
> on all db servers
> So my perl script actually :
> * first push files on given servers (db or frontal according to a tree
> structure of the package)
> * execute content from the commands.upd file
> Most of the time, I do always the same thing in my commands.upd file : clear
> cache and update version in DB. But sometimes, I can have extra commands to
> pass (for ex, when I deploy a new town in my app, I have some jobs to run
> for initialising the meteo block or stations list or ...
> This scripts are part of my app but I need to call them.
> So I used to have so far most of the time the same commands.upd file that I
> "extend" for a given release with some required commands.
> I would like to do the same without modifying the fabfile.py (to avoid that
> at next release there are some old scripts that would be run because they
> were forgotten).
> Is it clear enough ?

Something like that (different commands may execute on different
servers with few fab commands), i'm make.

For example.
Input data: users, groups from several servers (20-30 or more). Some
users can be on one or few servers.
Need: after inspecting users, i have list (exported to file of course
:)) with hosts, users and needed actions (for users for example:
block, disable password, change password (password length can be
different), create sudo %rule for some group (or for group of some
user), add user(s) to group, etc).

After that, when i'm execute fab with special command(s), this file
loaded, parsed and use env.roledefs, and other combination inspect
module, globals() and other, run specified actions (with needed
parameters) only on needed hosts.

In other varian, i'm make fabfile for deploying oracle ias
applications. Several applications on production and testing servers
with one fabfile and few commands. But all settings (paths, servers,
applications names) for this applications (testing and production)
change not very often, and so all this settings i'm write in few
python dictionaries. and after run (for example) "fab beta deploy",
i'm пуt deployed application on testing environment beta (but fabfile,
and other included modules, don't contain function "beta" in this case
:)). and if i need new testing environment (gamma), i'm just add new
parameters to dictionary, and i can run deploy command "fab gamma
deploy". in internals, on loading fabfile, i'm analysing fab command
line parameters (and change it), based on this command-line parameters
and parameters for environments, i'm generating need small functions
(that contains atomic functions with passed parameters), and export
generated functions to global. and fab can run this on-fly generated
functions.


>> Again, however, we have plans to make that a lot easier or automatic,
>> in the future.
>
> Ok, thanks for the information - Will try to see what can I do with the
> current .stderr, before 1.0 lands.
> Nicolas

i'm also try solve this problem with logging. for now, i'm sometimes
use decorated fabric functions (run, sudo, and so on). decorator just
turn off all function output and redirect stdout with stderr to
logging module.
and this decorated functions use in fabfile.


-- 
WBW, Unatine
mailto:address@hidden
xmpp:address@hidden




reply via email to

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