add helpful error messages to nova-manage and update nova.sh
This commit is contained in:
@@ -61,6 +61,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import IPy
|
import IPy
|
||||||
|
from sqlalchemy import exc
|
||||||
|
|
||||||
# If ../nova/__init__.py exists, add ../ to Python search path, so that
|
# If ../nova/__init__.py exists, add ../ to Python search path, so that
|
||||||
# it will override what happens to be installed in /usr/(local/)lib/python...
|
# it will override what happens to be installed in /usr/(local/)lib/python...
|
||||||
@@ -255,6 +256,13 @@ class RoleCommands(object):
|
|||||||
self.manager.remove_role(user, role, project)
|
self.manager.remove_role(user, role, project)
|
||||||
|
|
||||||
|
|
||||||
|
def _db_error(caught_exception):
|
||||||
|
print caught_exception
|
||||||
|
print _("The above error may show that the database has not "
|
||||||
|
"been created.\nPlease create a database using "
|
||||||
|
"nova-manage sync db before running this command.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
class UserCommands(object):
|
class UserCommands(object):
|
||||||
"""Class for managing users."""
|
"""Class for managing users."""
|
||||||
|
|
||||||
@@ -270,13 +278,19 @@ class UserCommands(object):
|
|||||||
def admin(self, name, access=None, secret=None):
|
def admin(self, name, access=None, secret=None):
|
||||||
"""creates a new admin and prints exports
|
"""creates a new admin and prints exports
|
||||||
arguments: name [access] [secret]"""
|
arguments: name [access] [secret]"""
|
||||||
|
try:
|
||||||
user = self.manager.create_user(name, access, secret, True)
|
user = self.manager.create_user(name, access, secret, True)
|
||||||
|
except exc.OperationalError, e:
|
||||||
|
_db_error(e)
|
||||||
self._print_export(user)
|
self._print_export(user)
|
||||||
|
|
||||||
def create(self, name, access=None, secret=None):
|
def create(self, name, access=None, secret=None):
|
||||||
"""creates a new user and prints exports
|
"""creates a new user and prints exports
|
||||||
arguments: name [access] [secret]"""
|
arguments: name [access] [secret]"""
|
||||||
|
try:
|
||||||
user = self.manager.create_user(name, access, secret, False)
|
user = self.manager.create_user(name, access, secret, False)
|
||||||
|
except exc.OperationalError, e:
|
||||||
|
_db_error(e)
|
||||||
self._print_export(user)
|
self._print_export(user)
|
||||||
|
|
||||||
def delete(self, name):
|
def delete(self, name):
|
||||||
@@ -397,9 +411,14 @@ class ProjectCommands(object):
|
|||||||
with open(filename, 'w') as f:
|
with open(filename, 'w') as f:
|
||||||
f.write(zip_file)
|
f.write(zip_file)
|
||||||
except db.api.NoMoreNetworks:
|
except db.api.NoMoreNetworks:
|
||||||
print ('No more networks available. If this is a new '
|
print _('No more networks available. If this is a new '
|
||||||
'installation, you need\nto call something like this:\n\n'
|
'installation, you need\nto call something like this:\n\n'
|
||||||
' nova-manage network create 10.0.0.0/8 10 64\n\n')
|
' nova-manage network create 10.0.0.0/8 10 64\n\n')
|
||||||
|
except exception.ProcessExecutionError, e:
|
||||||
|
print e
|
||||||
|
print _("The above error may show that the certificate db has not "
|
||||||
|
"been created.\nPlease create a database by running a "
|
||||||
|
"nova-api server on this host.")
|
||||||
|
|
||||||
|
|
||||||
class FloatingIpCommands(object):
|
class FloatingIpCommands(object):
|
||||||
|
|||||||
Reference in New Issue
Block a user