On Monday 17 Jan 2011 23:18:45 Don Jackson wrote:
> def runsudotest():
>     run( 'sudo env' )
>     run( 'sudo which sudo' )
> 
> $ fab runsudotest -H queue.likestream.net
> [queue.likestream.net] Executing task 'runsudotest'
> [queue.likestream.net] run: sudo env
> [queue.likestream.net] run: sudo which sudo
> [queue.likestream.net] out: /opt/csw/bin/sudo
> 
> So, fabric can ssh into the machine as me, and run sudo, and can find the
> sudo command as su.
> 
> def sudotest():
>     sudo( 'env' )
> 
> $ fab sudotest -H queue.likestream.net   
> [queue.likestream.net] Executing task 'sudotest'
> [queue.likestream.net] sudo: env
> [queue.likestream.net] err: ksh: sudo:  not found
> 
> Fatal error: sudo() encountered an error (return code 127) while executing
> 'env'
> 
> Aborting.
> 
> Demonstrates that running sudo directly from fabric doesn't work.

Fabric doesn't execute sudo through full login shell and it looks to me like 
the /opt/csw/bin directory may be added to PATH by some ksh startup script 
(which it doesn't execute when non-interactive/non-login).

To confirm run (not via Fabric):

    ssh queue.likestream.net 'which sudo'

If I'm right this will fail to find sudo as well.

Fabric does allow customizing the location of sudo (sudo_prefix) but only in 
>= 1.0a, I don't think there are any workarounds you can use in 0.9 apart from 
run('sudo ...').


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  
It is intended solely for the addressee and access to the email by anyone else 
is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or 
any action taken or omitted to be taken in reliance on it, is prohibited and 
may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail 
are subject to the terms and conditions expressed  in the governing client 
engagement leter or contract.
If you have received this email in error please notify 
supp...@henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, 
BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************


_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to