Created
October 10, 2015 17:43
-
-
Save schakrava/ff243afb75cb650dcc6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
join = os.path.join | |
base = os.path.dirname(os.path.abspath(os.path.realpath(__file__))) | |
base = os.path.dirname(base) | |
import sys | |
sys.path[0:0] = [ | |
join(base, 'src/rockstor'), | |
join(base, 'eggs/supervisor-3.0b1-py2.7.egg'), | |
join(base, 'eggs/meld3-1.0.2-py2.7.egg'), | |
join(base, 'eggs/setuptools-18.3.2-py2.7.egg'), | |
join(base, 'eggs/psutil-3.2.1-py2.7-linux-x86_64.egg'), | |
join(base, 'eggs/psycogreen-1.0-py2.7.egg'), | |
join(base, 'eggs/gevent_socketio-0.3.6-py2.7.egg'), | |
join(base, 'eggs/coverage-4.0-py2.7-linux-x86_64.egg'), | |
join(base, 'eggs/mock-1.0.1-py2.7.egg'), | |
join(base, 'eggs/django_ztask-0.1.5-py2.7.egg'), | |
join(base, 'eggs/six-1.7.3-py2.7.egg'), | |
join(base, 'eggs/django_oauth_toolkit-0.7.0-py2.7.egg'), | |
join(base, 'eggs/psycopg2-2.6-py2.7-linux-x86_64.egg'), | |
join(base, 'eggs/South-0.8.4-py2.7.egg'), | |
join(base, 'eggs/pyzmq-13.0.0-py2.7-linux-x86_64.egg'), | |
join(base, 'eggs/requests-1.1.0-py2.7.egg'), | |
join(base, 'eggs/django_pipeline-1.2.23-py2.7.egg'), | |
join(base, 'eggs/pytz-2014.3-py2.7.egg'), | |
join(base, 'eggs/djangorestframework-3.1.1-py2.7.egg'), | |
join(base, 'eggs/URLObject-2.1.1-py2.7.egg'), | |
join(base, 'eggs/distribute-0.7.3-py2.7.egg'), | |
join(base, 'eggs/Django-1.6.2-py2.7.egg'), | |
join(base, 'eggs/gevent_websocket-0.9.5-py2.7.egg'), | |
join(base, 'eggs/gevent-1.0.2-py2.7-linux-x86_64.egg'), | |
join(base, 'eggs/oauthlib-0.6.1-py2.7.egg'), | |
join(base, 'eggs/django_braces-1.8.1-py2.7.egg'), | |
join(base, 'eggs/greenlet-0.4.9-py2.7-linux-x86_64.egg'), | |
] | |
import scripts.delete_api_key | |
if __name__ == '__main__': | |
from storageadmin.models import Pool | |
try: | |
pname = sys.argv[1] | |
except IndexError: | |
sys.exit('Usage: %s <pool_name>' % sys.argv[0]) | |
try: | |
po = Pool.objects.get(name=pname) | |
if (po.disk_set.count() == 0): | |
po.delete() | |
else: | |
sys.exit('Pool(%s) cannot be deleted because the disk set is not empty' % pname) | |
except Pool.DoesNotExist: | |
print ('Pool with name: %s does not exist' % pname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment