FinalsClub / karmaworld

KarmaNotes.org v3.0
GNU Affero General Public License v3.0
7 stars 6 forks source link

Automagically determine Django user #336

Closed btbonval closed 10 years ago

btbonval commented 10 years ago

Stemming from #334 , it'd be good to figure out which user is the Django user without programming in "I'm connecting to the staging system" or "I'm connecting to the prod system" or "I'm connecting to the VM."

I can foresee a few ways to do this.

  1. run finger against the usual suspects until a username is hit (finger returns $? == 0)
  2. check /var/www/karmaworld/ ownership (won't work on a fresh system that hasn't established the directory)
  3. combination thereof, starting at 2 and falling back to 1 upon failure.

There might be better ideas still, but this is top of my head.

btbonval commented 10 years ago

Little bits of code like this one will need to be changed for the django_user: https://github.com/FinalsClub/karmaworld/blob/d8e204a5978bd1d161f8a338ef1c3f029039731b/fabfile.py#L226

By the new assumption, env.user would be the user with sudo privs.

Btw, env.sudo_user is a thing. Find documentation about that.

charlesconnell commented 10 years ago

This becomes irrelevant on Heroku. Closing.