This line is the interesting part:

[10.200.8.160] sudo: sudo -S -p 'sudo password:'  /bin/bash -l -c "id"

Bash is setting your PATH because it is running as a log-in shell. However,
sudo is running outside bash. So the PATH that bash prints is not the one
that is being used for the sudo command.


On Fri, Jul 5, 2013 at 12:37 PM, Ruslan Valiyev <[email protected]> wrote:

> Hey guys,
>
> I'm having some hard time with several Solaris hosts. For some reason, my
> function is not able to find the sudo binary.
>
> This is the function:
>
> def task():
>   set_users('ldap')
>   run('echo $PATH')
>   run('type sudo')
>   sudo('id')
>
> This is my output:
>
> *$ fab --show=debug task -H 10.200.8.160*
> Using fabfile '/root/fab/configs/fabfile.py'
> Commands to run: task
> Parallel tasks now using pool size of 1
> [10.200.8.160] Executing task 'task'
> [10.200.8.160] run: /bin/bash -l -c "echo \$PATH"
> [10.200.8.160] out:
> /usr/bin:/bin:/usr/sbin:/usr/sfw/bin:/opt/sfw/bin:/usr/sfw/sbin:/sbin:/bin
> [10.200.8.160] out:
>
> [10.200.8.160] run: /bin/bash -l -c "type sudo"
> [10.200.8.160] out: sudo is /opt/sfw/bin/sudo
> [10.200.8.160] out:
>
> [10.200.8.160] sudo: sudo -S -p 'sudo password:'  /bin/bash -l -c "id"
> [10.200.8.160] out: bash: sudo: command not found
> [10.200.8.160] out:
>
>
> Fatal error: sudo() received nonzero return code 127 while executing!
>
> Requested: id
> Executed: sudo -S -p 'sudo password:'  /bin/bash -l -c "id"
>
> None
>
>
> Aborting.
> Disconnecting from 10.200.8.160... done.
>
> I'm guessing there's an issue with $PATH somewhere, but I just ran two
> commands before invoking sudo and "type" found it.
>
>
> Regards,
> rv
>
> _______________________________________________
> Fab-user mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/fab-user
>
>


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

Reply via email to