Merge branch 'master' of https://bitbucket.org/yackob03/quay
This commit is contained in:
commit
05a9cb437b
2 changed files with 26 additions and 1 deletions
|
@ -4,7 +4,7 @@ to prepare a new host:
|
|||
sudo apt-get install software-properties-common
|
||||
sudo apt-add-repository -y ppa:nginx/stable
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git python-virtualenv python-dev phantomjs
|
||||
sudo apt-get install -y git python-virtualenv python-dev phantomjs libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
|
||||
sudo apt-get install -y nginx-full
|
||||
```
|
||||
|
||||
|
|
25
tools/freeloaders.py
Normal file
25
tools/freeloaders.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from data import model
|
||||
from data.database import User
|
||||
from app import stripe
|
||||
from data.plans import get_plan
|
||||
|
||||
def get_private_allowed(customer):
|
||||
if not customer.stripe_id:
|
||||
return 0
|
||||
|
||||
subscription = stripe.Customer.retrieve(customer.stripe_id).subscription
|
||||
if subscription is None:
|
||||
return 0
|
||||
|
||||
plan = get_plan(subscription.plan.id)
|
||||
return plan['privateRepos']
|
||||
|
||||
# Find customers who have more private repositories than their plans allow
|
||||
users = User.select()
|
||||
|
||||
usage = [(user.username, model.get_private_repo_count(user.username),
|
||||
get_private_allowed(user)) for user in users]
|
||||
|
||||
for username, used, allowed in usage:
|
||||
if used > allowed:
|
||||
print('Violation: %s %s > %s' % (username, used, allowed))
|
Reference in a new issue