summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorRicardo Carrillo Cruz <emaildericky@gmail.com>2011-02-04 11:26:28 +0100
committerRicardo Carrillo Cruz <emaildericky@gmail.com>2011-02-04 11:26:28 +0100
commite35ca46173a5f3bf2d1460c19249fd0bf9f5b538 (patch)
tree39eed216f35ae38d239e68ceec79ac1411110bd3 /bin
parent3ad22216eee67abfabb28efe2561f0fdcf10e6e1 (diff)
parent5e4259ce6deb227b778acf23770e35f786c9c3d0 (diff)
downloadnova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.gz
nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.tar.xz
nova-e35ca46173a5f3bf2d1460c19249fd0bf9f5b538.zip
Fixed PEP8 test problems, complaining about too many blank lines at line 51
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: