summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-manage29
-rw-r--r--bin/nova-spoolsentry6
2 files changed, 26 insertions, 9 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 1c885f8a6..1b70ebf17 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -267,6 +267,14 @@ class RoleCommands(object):
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 for managing users."""
@@ -282,13 +290,19 @@ class UserCommands(object):
def admin(self, name, access=None, secret=None):
"""creates a new admin and prints exports
arguments: name [access] [secret]"""
- user = self.manager.create_user(name, access, secret, True)
+ try:
+ user = self.manager.create_user(name, access, secret, True)
+ except exception.DBError, e:
+ _db_error(e)
self._print_export(user)
def create(self, name, access=None, secret=None):
"""creates a new user and prints exports
arguments: name [access] [secret]"""
- user = self.manager.create_user(name, access, secret, False)
+ try:
+ user = self.manager.create_user(name, access, secret, False)
+ except exception.DBError, e:
+ _db_error(e)
self._print_export(user)
def delete(self, name):
@@ -409,9 +423,14 @@ class ProjectCommands(object):
with open(filename, 'w') as f:
f.write(zip_file)
except db.api.NoMoreNetworks:
- print ('No more networks available. If this is a new '
- 'installation, you need\nto call something like this:\n\n'
- ' nova-manage network create 10.0.0.0/8 10 64\n\n')
+ print _('No more networks available. If this is a new '
+ 'installation, you need\nto call something like this:\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):
diff --git a/bin/nova-spoolsentry b/bin/nova-spoolsentry
index ab20268a9..c53482852 100644
--- a/bin/nova-spoolsentry
+++ b/bin/nova-spoolsentry
@@ -74,10 +74,8 @@ class SpoolSentry(object):
return rv
def send_data(self, data):
- data = {
- 'data': base64.b64encode(pickle.dumps(data).encode('zlib')),
- 'key': self.key
- }
+ data = {'data': base64.b64encode(pickle.dumps(data).encode('zlib')),
+ 'key': self.key}
req = urllib2.Request(self.sentry_url)
res = urllib2.urlopen(req, urllib.urlencode(data))
if res.getcode() != 200: