Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing distribute should not be hard coded to run as root. #99

Closed
wants to merge 1 commit into from

Conversation

tachang
Copy link

@tachang tachang commented Apr 20, 2013

Do run() instead of run_as_root() so user can decide context using
a with statement such as:

with fabtools.python.virtualenv('/home/example/python'):
fabtools.require.python.distribute()

Do run() instead of run_as_root() so user can decide context using
a with statement such as:

with fabtools.python.virtualenv('/home/example/python'):
  fabtools.require.python.distribute()
@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

Thanks for the pull request, Jeff.

fabtools needs to install distribute globally (as root) in order to install pip. (The get-pip.py script that we use to install the latest pip version requires setuptools or distribute to be installed.)

Also, I think it's not necessary to install distribute into a virtualenv, as it is already installed as part of the virtualenv creation anyway:

$ cd /tmp
$ virtualenv venv
New python executable in venv/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source venv/bin/activate
$ which easy_install
/tmp/venv/bin/easy_install

What do you think?

@tachang
Copy link
Author

tachang commented Apr 21, 2013

I have a case where even if it distribute globally when I do the virtual environment it says --version is not defined. This is why I wanted to run it as non root.

@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

Can you share a small fabfile that reproduces this problem?

@tachang
Copy link
Author

tachang commented Apr 21, 2013

I am not sure why easy_install --version is not defined. This is why detecting if distribute is installed or not fails.

@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

I can reproduce this too. Something is wrong. Investigating...

@tachang
Copy link
Author

tachang commented Apr 21, 2013

This is my first time using fab/fabtools so maybe I am doing something wrong?

@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

Older versions of distribute don't have the --version flag, so fabtools should not be using that. What is the exact operating system / distro on your remote host?

@tachang
Copy link
Author

tachang commented Apr 21, 2013

Linux apricot 3.2.0-23-virtual #36-Ubuntu SMP Tue Apr 10 22:29:03 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

root@apricot:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise

@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

Thanks! Can you paste a small example of what you're trying to do with virtualenv, and the output showing the problem?

@tachang
Copy link
Author

tachang commented Apr 21, 2013

Random question but is there is ssh authorized_keys module that lets you add ssh keys and known hosts easily? (I am trying to find in github how to message you directly but I can't seem to. Did they remove that feature?!)

@ronnix
Copy link
Collaborator

ronnix commented Apr 21, 2013

Support for authorized keys coming later today :) I'll consider adding known hosts too.

@tachang
Copy link
Author

tachang commented Apr 21, 2013

Here is my fabfile:

https://gist.github.com/tachang/5430196

Any pointers would be awesome by the way. Just getting started. What I am trying to do is log in as root and install all the packages that are needed. But if root isn't needed then the user the application runs under shouldn't have it. In this case why run the distribute installation as root (incase the version on the box is different) when you don't have to?

@tachang
Copy link
Author

tachang commented Apr 21, 2013

Wow that's awesome. Fabtools has a good chance to be the defacto standard library for fabric! :)

@ronnix
Copy link
Collaborator

ronnix commented Apr 25, 2013

I'm not going to merge this, so I'll close the pull request, but please open an issue if you still have problems.

I'll do my bet to help you use fabtools and will consider improvements that would make it better suited to you use case.

@ronnix ronnix closed this Apr 25, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants