af not playing well with symlinks #3

Closed
sodiumjoe opened this Issue Jul 20, 2012 · 8 comments

Projects

None yet

5 participants

@sodiumjoe

When I try to upload an app with symlinks generated by pip, I get:

$ af update flask-example
Uploading Application:
different prefix: "" and "/Users/joe/Work/flask-example"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/pathname.rb:730:in `relative_path_from'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:388:in `check_unreachable_links'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:385:in `each'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:385:in `check_unreachable_links'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:427:in `upload_app_bits'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:420:in `chdir'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:420:in `upload_app_bits'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/commands/apps.rb:274:in `update'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/runner.rb:465:in `send'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/runner.rb:465:in `run'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/lib/cli/runner.rb:14:in `run'
/Library/Ruby/Gems/1.8/gems/af-0.3.16.1/bin/af:5
/usr/bin/af:19:in `load'
/usr/bin/af:19

But, then when I "cp -r" the directory into a brand new one copying the contents of the symlinked directories into the new one, it uploads fine.

@mattly

you're right, it doesn't play well with symlinks. I believe this is by design.

/cc @jvoorhis @lhitchon can you confirm?

@lhitchon

Yes, that's right.
It does not allow symlinks that point outside of the project directory.
And the 'cp -r' copies the contents of the files instead of making new symlinks, so the new directory you created should work.

@sodiumjoe

I see. Then, since virtualenv uses symlinks, should we not recommend using it, or should I look for a way to tell virtualenv to not use symlinks?

@lhitchon

I don't know much about virtualenv.
But symlinks are okay as long as they don't point outside the project root directory.
It's 'external' links that af will not allow

@sodiumjoe

Ok, this is expected behavior. Current workaround: create a separate directory outside of the app directory for virtualenv, and activate it. Thanks @lhitchon !

@sodiumjoe sodiumjoe closed this Jul 25, 2012
@nyaruka

Just ran into this myself with a virtualenv. This kind of directory structure is very typical for Django apps::

/app
   /env <--- virtualenv directory
   requirements.txt
   manage.py
   app1/
   app2/

But if you use this with AppFog then it blows up with the rather vague different prefix error since the virtualenv has lots of symlinks (to the system Python libraries in it).

Is there a way to have files in your app directory which af will just ignore? Alternatively, might it be useful to special case the virtualenv case? It is fairly easy to divine that a directory is a virtualenv by its contents. (/bin subdir with activate and deactivate scripts ought to be fairly foolproof)

Any interest in such a patch? Or alternatively an .afignore file?

@ghost

I don's use any symlink, but I still have the same error. Can somebody tell me how to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment