From c8fdce011092f23efd55385b45db8e6f3886beb1 Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 15 Jul 2010 11:07:40 -0500 Subject: remove import of vendor since we have PPA now --- HACKING | 3 --- bin/nova-api | 2 +- bin/nova-compute | 2 +- bin/nova-instancemonitor | 2 +- bin/nova-objectstore | 2 +- bin/nova-rsapi | 2 +- bin/nova-volume | 2 +- docs/conf.py | 2 +- nova/adminclient.py | 2 +- nova/cloudpipe/api.py | 2 +- nova/compute/disk.py | 2 +- nova/compute/model.py | 2 +- nova/compute/monitor.py | 2 +- nova/compute/network.py | 2 +- nova/compute/node.py | 2 +- nova/crypto.py | 2 +- nova/datastore.py | 2 +- nova/endpoint/api.py | 2 +- nova/endpoint/cloud.py | 2 +- nova/endpoint/images.py | 2 +- nova/endpoint/rackspace.py | 2 +- nova/flags.py | 2 +- nova/objectstore/handler.py | 2 +- nova/process.py | 2 +- nova/rpc.py | 2 +- nova/server.py | 2 +- nova/test.py | 2 +- nova/tests/api_unittest.py | 2 +- nova/tests/cloud_unittest.py | 2 +- nova/tests/future_unittest.py | 2 +- nova/tests/model_unittest.py | 2 +- nova/tests/network_unittest.py | 2 +- nova/tests/node_unittest.py | 2 +- nova/tests/objectstore_unittest.py | 2 +- nova/tests/process_unittest.py | 2 +- nova/tests/users_unittest.py | 2 +- nova/tests/validator_unittest.py | 2 +- nova/twistd.py | 2 +- nova/vendor.py | 24 ------------------------ nova/volume/storage.py | 2 +- run_tests.py | 2 +- smoketests/flags.py | 2 +- smoketests/novatestcase.py | 2 +- smoketests/smoketest.py | 2 +- 44 files changed, 42 insertions(+), 69 deletions(-) delete mode 100644 nova/vendor.py diff --git a/HACKING b/HACKING index 77e42b8e6..325ae9198 100644 --- a/HACKING +++ b/HACKING @@ -10,15 +10,12 @@ Imports - thou shalt not import objects, only modules - thou shalt not import more than one module per line - thou shalt not make relative imports -- thou shalt "from nova import vendor" before importing third party code - thou shalt organize your imports according to the following template :: # vim: tabstop=4 shiftwidth=4 softtabstop=4 {{stdlib imports in human alphabetical order}} \n - from nova import vendor - {{vendor imports in human alphabetical order}} \n {{nova imports in human alphabetical order}} \n diff --git a/bin/nova-api b/bin/nova-api index 7bc9166b8..ae274abf6 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -23,7 +23,7 @@ Tornado daemon for the main API endpoint. import logging -from nova import vendor + from tornado import httpserver from tornado import ioloop diff --git a/bin/nova-compute b/bin/nova-compute index 803887039..5635efbaf 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -33,7 +33,7 @@ NOVA_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'nova') if os.path.exists(NOVA_PATH): sys.path.insert(0, os.path.dirname(NOVA_PATH)) -from nova import vendor + from carrot import connection from carrot import messaging from twisted.internet import task diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index d3f0ae221..d2ed82c9f 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -23,7 +23,7 @@ import logging -from nova import vendor + from twisted.internet import task from twisted.application import service diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 7876864c0..8ae80707e 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -23,7 +23,7 @@ import logging -from nova import vendor + from tornado import httpserver from tornado import ioloop diff --git a/bin/nova-rsapi b/bin/nova-rsapi index c2f2c9d70..cca5b3048 100755 --- a/bin/nova-rsapi +++ b/bin/nova-rsapi @@ -23,7 +23,7 @@ import logging from wsgiref import simple_server -from nova import vendor + from tornado import ioloop from nova import flags diff --git a/bin/nova-volume b/bin/nova-volume index 9b7787c96..8296eb1d8 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -23,7 +23,7 @@ import logging -from nova import vendor + from tornado import ioloop from nova import flags diff --git a/docs/conf.py b/docs/conf.py index 784d8c096..fb3fd1a30 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,7 +18,7 @@ import sys, os # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.append(os.path.abspath('/Users/jmckenty/Projects/cc')) sys.path.append([os.path.abspath('../nova'),os.path.abspath('../'),os.path.abspath('../vendor')]) -from nova import vendor + # -- General configuration ----------------------------------------------------- diff --git a/nova/adminclient.py b/nova/adminclient.py index 1a5f41418..42297faf3 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -21,7 +21,7 @@ Nova User API client library. import base64 -from nova import vendor + import boto from boto.ec2.regioninfo import RegionInfo diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index 99a0a1d6d..e071167bb 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -23,7 +23,7 @@ Tornado REST API Request Handlers for CloudPipe import logging import urllib -from nova import vendor + import tornado.web from nova import crypto diff --git a/nova/compute/disk.py b/nova/compute/disk.py index b24a90d7f..b476987bb 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -25,7 +25,7 @@ import logging import os import tempfile -from nova import vendor + from twisted.internet import defer from nova import exception diff --git a/nova/compute/model.py b/nova/compute/model.py index f1eb99e74..2d8a036a5 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -43,7 +43,7 @@ True import logging import time -from nova import vendor + import redis from nova import datastore diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index b9fe20a71..64852838d 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -36,7 +36,7 @@ except Exception, err: logging.warning('no libvirt found') from nova import flags -from nova import vendor + import boto import boto.s3 import libxml2 diff --git a/nova/compute/network.py b/nova/compute/network.py index 8592d7af7..faac74e54 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -25,7 +25,7 @@ import os import time # TODO(termie): clean up these imports -from nova import vendor + import IPy from nova import datastore diff --git a/nova/compute/node.py b/nova/compute/node.py index 7e4277f58..488e8870f 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -31,7 +31,7 @@ import os import shutil import sys -from nova import vendor + from twisted.internet import defer from twisted.internet import task from twisted.application import service diff --git a/nova/crypto.py b/nova/crypto.py index 98d412687..f6e9717d0 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -31,7 +31,7 @@ import tempfile import time import utils -from nova import vendor + import M2Crypto from nova import exception diff --git a/nova/datastore.py b/nova/datastore.py index 8d6272ada..ab6da7043 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -25,7 +25,7 @@ before trying to run this. import logging -from nova import vendor + import redis from nova import exception diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index 255519198..2046d01ae 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -29,7 +29,7 @@ import urllib # TODO(termie): replace minidom with etree from xml.dom import minidom -from nova import vendor + import tornado.web from twisted.internet import defer diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 5b713feb9..97f31349c 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -28,7 +28,7 @@ import logging import os import time -from nova import vendor + from twisted.internet import defer from nova import datastore diff --git a/nova/endpoint/images.py b/nova/endpoint/images.py index 5c6514732..34da907cb 100644 --- a/nova/endpoint/images.py +++ b/nova/endpoint/images.py @@ -25,7 +25,7 @@ import json import random import urllib -from nova import vendor + import boto import boto.s3 diff --git a/nova/endpoint/rackspace.py b/nova/endpoint/rackspace.py index 29a077b24..18cb201a7 100644 --- a/nova/endpoint/rackspace.py +++ b/nova/endpoint/rackspace.py @@ -27,7 +27,7 @@ import multiprocessing import os import time -from nova import vendor + import tornado.web from twisted.internet import defer diff --git a/nova/flags.py b/nova/flags.py index 22e00a44a..60245a349 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -23,7 +23,7 @@ where they're used. import socket -from nova import vendor + from gflags import * # This keeps pylint from barfing on the imports diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 22cfca5fd..79f01169c 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -44,7 +44,7 @@ import logging import multiprocessing -from nova import vendor + from tornado import escape, web from nova import exception diff --git a/nova/process.py b/nova/process.py index 00ec4a267..4c1cef58c 100644 --- a/nova/process.py +++ b/nova/process.py @@ -24,7 +24,7 @@ import logging import multiprocessing import StringIO -from nova import vendor + from twisted.internet import defer from twisted.internet import error from twisted.internet import process diff --git a/nova/rpc.py b/nova/rpc.py index 72a84b7f7..1b171f5d9 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -26,7 +26,7 @@ import logging import sys import uuid -from nova import vendor + from carrot import connection from carrot import messaging from twisted.internet import defer diff --git a/nova/server.py b/nova/server.py index 1a6f33876..8f4ea91a3 100644 --- a/nova/server.py +++ b/nova/server.py @@ -27,7 +27,7 @@ import signal import sys import time -from nova import vendor + import daemon from daemon import pidlockfile diff --git a/nova/test.py b/nova/test.py index 1f8a5ff47..864bc3f5a 100644 --- a/nova/test.py +++ b/nova/test.py @@ -26,7 +26,7 @@ import logging import time import unittest -from nova import vendor + import mox from tornado import ioloop from twisted.internet import defer diff --git a/nova/tests/api_unittest.py b/nova/tests/api_unittest.py index aee57b514..2937ef0b4 100644 --- a/nova/tests/api_unittest.py +++ b/nova/tests/api_unittest.py @@ -20,7 +20,7 @@ import httplib import random import StringIO -from nova import vendor + import boto from boto.ec2 import regioninfo from tornado import httpserver diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 9df83ec62..6bafe2ea7 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -22,7 +22,7 @@ import time import unittest from xml.etree import ElementTree -from nova import vendor + from tornado import ioloop from twisted.internet import defer diff --git a/nova/tests/future_unittest.py b/nova/tests/future_unittest.py index be4218c39..a4523a315 100644 --- a/nova/tests/future_unittest.py +++ b/nova/tests/future_unittest.py @@ -22,7 +22,7 @@ import time import unittest from xml.etree import ElementTree -from nova import vendor + import mox from tornado import ioloop from twisted.internet import defer diff --git a/nova/tests/model_unittest.py b/nova/tests/model_unittest.py index f70cab40d..37a4c3e80 100644 --- a/nova/tests/model_unittest.py +++ b/nova/tests/model_unittest.py @@ -19,7 +19,7 @@ import logging import time -from nova import vendor + from twisted.internet import defer from nova import exception diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index dd1966ffa..af9efffbd 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -20,7 +20,7 @@ import os import logging import unittest -from nova import vendor + import IPy from nova import flags diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 4f7bbd587..60f97741e 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -21,7 +21,7 @@ import time from xml.etree import ElementTree -from nova import vendor + from twisted.internet import defer from nova import exception diff --git a/nova/tests/objectstore_unittest.py b/nova/tests/objectstore_unittest.py index ca2d31159..0c700ff96 100644 --- a/nova/tests/objectstore_unittest.py +++ b/nova/tests/objectstore_unittest.py @@ -23,7 +23,7 @@ import os import shutil import tempfile -from nova import vendor + from nova import flags from nova import objectstore diff --git a/nova/tests/process_unittest.py b/nova/tests/process_unittest.py index 671ab05cd..fe625b6c8 100644 --- a/nova/tests/process_unittest.py +++ b/nova/tests/process_unittest.py @@ -19,7 +19,7 @@ import logging from xml.etree import ElementTree -from nova import vendor + from twisted.internet import defer from twisted.internet import reactor diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index 6110248b5..4bc66ca5c 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -19,7 +19,7 @@ import logging import unittest -from nova import vendor + from M2Crypto import BIO from M2Crypto import RSA from M2Crypto import X509 diff --git a/nova/tests/validator_unittest.py b/nova/tests/validator_unittest.py index 38cddfef1..fba5b3060 100644 --- a/nova/tests/validator_unittest.py +++ b/nova/tests/validator_unittest.py @@ -19,7 +19,7 @@ import logging import unittest -from nova import vendor + from nova import flags from nova import test diff --git a/nova/twistd.py b/nova/twistd.py index 03de2d0ab..3d7fdeb6e 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -29,7 +29,7 @@ import time import UserDict import logging.handlers -from nova import vendor + from twisted.scripts import twistd from twisted.python import log from twisted.python import reflect diff --git a/nova/vendor.py b/nova/vendor.py deleted file mode 100644 index db75f30ec..000000000 --- a/nova/vendor.py +++ /dev/null @@ -1,24 +0,0 @@ -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Get our vendor folders into the system path. -""" - -print 'sorry, we cannot include vendor open source libraries... :(' - diff --git a/nova/volume/storage.py b/nova/volume/storage.py index 1507b4ec7..dc67aaeec 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -30,7 +30,7 @@ import shutil import tempfile import time -from nova import vendor + from tornado import ioloop from twisted.internet import defer diff --git a/run_tests.py b/run_tests.py index bd1587d43..eb26459c5 100644 --- a/run_tests.py +++ b/run_tests.py @@ -41,7 +41,7 @@ Due to our use of multiprocessing it we frequently get some ignorable import __main__ import sys -from nova import vendor + from twisted.scripts import trial as trial_script from nova import datastore diff --git a/smoketests/flags.py b/smoketests/flags.py index ae0001e89..3617fb797 100644 --- a/smoketests/flags.py +++ b/smoketests/flags.py @@ -21,7 +21,7 @@ Package-level global flags are defined here, the rest are defined where they're used. """ -from nova import vendor + from gflags import * # This keeps pylint from barfing on the imports diff --git a/smoketests/novatestcase.py b/smoketests/novatestcase.py index 11c8661ba..513e0ca91 100644 --- a/smoketests/novatestcase.py +++ b/smoketests/novatestcase.py @@ -22,7 +22,7 @@ import random import sys import unittest -from nova import vendor + import paramiko from nova import adminclient diff --git a/smoketests/smoketest.py b/smoketests/smoketest.py index 61967d3b7..ad95114d4 100644 --- a/smoketests/smoketest.py +++ b/smoketests/smoketest.py @@ -25,7 +25,7 @@ import time import unittest import zipfile -from nova import vendor + import paramiko from smoketests import flags -- cgit From 3ce6ec1a83731da868c5a77c4684808a54ffd8fd Mon Sep 17 00:00:00 2001 From: Jesse Andrews Date: Thu, 15 Jul 2010 18:13:48 -0500 Subject: reorder imports spacing --- HACKING | 1 - bin/dhcpleasor.py | 5 ++--- bin/nova-api | 2 -- bin/nova-import-canonical-imagestore | 2 +- bin/nova-instancemonitor | 2 -- bin/nova-manage | 3 ++- bin/nova-objectstore | 2 -- bin/nova-rsapi | 4 +--- bin/nova-volume | 2 -- nova/adminclient.py | 2 -- nova/auth/signer.py | 5 +++-- nova/auth/users.py | 3 --- nova/cloudpipe/api.py | 5 ++--- nova/cloudpipe/pipelib.py | 9 +++++---- nova/compute/disk.py | 3 +-- nova/compute/exception.py | 1 + nova/compute/linux_net.py | 3 ++- nova/compute/model.py | 2 -- nova/compute/monitor.py | 14 +++++++------- nova/compute/network.py | 11 ++++------- nova/compute/node.py | 6 +++--- nova/crypto.py | 4 +--- nova/datastore.py | 2 -- nova/endpoint/api.py | 9 ++++----- nova/endpoint/cloud.py | 5 ++--- nova/endpoint/images.py | 7 +++---- nova/endpoint/rackspace.py | 6 ++---- nova/exception.py | 2 +- nova/fakerabbit.py | 3 +-- nova/objectstore/bucket.py | 3 ++- nova/objectstore/handler.py | 5 +---- nova/objectstore/stored.py | 5 +++-- nova/process.py | 2 -- nova/rpc.py | 6 ++---- nova/server.py | 6 ++---- nova/test.py | 6 ++---- nova/tests/access_unittest.py | 5 +++-- nova/tests/api_integration.py | 3 ++- nova/tests/api_unittest.py | 6 ++---- nova/tests/cloud_unittest.py | 6 ++---- nova/tests/future_unittest.py | 8 +++----- nova/tests/model_unittest.py | 2 -- nova/tests/network_unittest.py | 4 +--- nova/tests/node_unittest.py | 6 ++---- nova/tests/objectstore_unittest.py | 4 +--- nova/tests/process_unittest.py | 4 +--- nova/tests/users_unittest.py | 4 +--- nova/tests/validator_unittest.py | 2 -- nova/twistd.py | 7 +++---- nova/utils.py | 2 +- nova/volume/storage.py | 4 +--- 51 files changed, 83 insertions(+), 142 deletions(-) diff --git a/HACKING b/HACKING index 325ae9198..3af2381bf 100644 --- a/HACKING +++ b/HACKING @@ -16,7 +16,6 @@ Imports # vim: tabstop=4 shiftwidth=4 softtabstop=4 {{stdlib imports in human alphabetical order}} \n - \n {{nova imports in human alphabetical order}} \n \n diff --git a/bin/dhcpleasor.py b/bin/dhcpleasor.py index 31f4433fb..07ff325f1 100755 --- a/bin/dhcpleasor.py +++ b/bin/dhcpleasor.py @@ -31,11 +31,10 @@ sys.path.append(os.path.abspath(os.path.join(__file__, "../../"))) logging.debug(sys.path) import getopt from os import environ -from nova.compute import linux_net -from nova.compute import network from nova import rpc - from nova import flags +from nova.compute import linux_net +from nova.compute import network FLAGS = flags.FLAGS diff --git a/bin/nova-api b/bin/nova-api index ae274abf6..26f5dbc87 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -22,8 +22,6 @@ Tornado daemon for the main API endpoint. """ import logging - - from tornado import httpserver from tornado import ioloop diff --git a/bin/nova-import-canonical-imagestore b/bin/nova-import-canonical-imagestore index 82daf61ce..2e79f09b7 100755 --- a/bin/nova-import-canonical-imagestore +++ b/bin/nova-import-canonical-imagestore @@ -29,9 +29,9 @@ import subprocess import sys import urllib2 -from nova.objectstore import image from nova import flags from nova import utils +from nova.objectstore import image FLAGS = flags.FLAGS diff --git a/bin/nova-instancemonitor b/bin/nova-instancemonitor index d2ed82c9f..b195089b7 100755 --- a/bin/nova-instancemonitor +++ b/bin/nova-instancemonitor @@ -22,8 +22,6 @@ """ import logging - - from twisted.internet import task from twisted.application import service diff --git a/bin/nova-manage b/bin/nova-manage index 5693a40f6..56f89ce30 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -23,6 +23,7 @@ """ import sys +import time from nova import flags from nova import utils @@ -31,7 +32,7 @@ from nova.compute import model from nova.compute import network from nova.cloudpipe import pipelib from nova.endpoint import cloud -import time + FLAGS = flags.FLAGS diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 8ae80707e..521f3d5d1 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -22,8 +22,6 @@ """ import logging - - from tornado import httpserver from tornado import ioloop diff --git a/bin/nova-rsapi b/bin/nova-rsapi index cca5b3048..5cbe2d8c1 100755 --- a/bin/nova-rsapi +++ b/bin/nova-rsapi @@ -21,10 +21,8 @@ """ import logging -from wsgiref import simple_server - - from tornado import ioloop +from wsgiref import simple_server from nova import flags from nova import rpc diff --git a/bin/nova-volume b/bin/nova-volume index 8296eb1d8..df9fb5c7a 100755 --- a/bin/nova-volume +++ b/bin/nova-volume @@ -22,8 +22,6 @@ """ import logging - - from tornado import ioloop from nova import flags diff --git a/nova/adminclient.py b/nova/adminclient.py index 42297faf3..db392feb1 100644 --- a/nova/adminclient.py +++ b/nova/adminclient.py @@ -20,8 +20,6 @@ Nova User API client library. """ import base64 - - import boto from boto.ec2.regioninfo import RegionInfo diff --git a/nova/auth/signer.py b/nova/auth/signer.py index a3d3c5329..83831bfac 100644 --- a/nova/auth/signer.py +++ b/nova/auth/signer.py @@ -43,11 +43,12 @@ Utility class for parsing signed AMI manifests. """ -import logging +import base64 import hashlib import hmac +import logging import urllib -import base64 + from nova.exception import Error class Signer(object): diff --git a/nova/auth/users.py b/nova/auth/users.py index 72edcc2aa..2c153c788 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -26,7 +26,6 @@ import os import shutil import signer import string -from string import Template import tempfile import uuid import zipfile @@ -44,8 +43,6 @@ from nova import exception from nova import flags from nova import crypto from nova import utils - - from nova import objectstore # for flags FLAGS = flags.FLAGS diff --git a/nova/cloudpipe/api.py b/nova/cloudpipe/api.py index e071167bb..a5f78a16d 100644 --- a/nova/cloudpipe/api.py +++ b/nova/cloudpipe/api.py @@ -21,14 +21,13 @@ Tornado REST API Request Handlers for CloudPipe """ import logging -import urllib - - import tornado.web +import urllib from nova import crypto from nova.auth import users + _log = logging.getLogger("api") _log.setLevel(logging.DEBUG) diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index de5326c5e..63f7ae222 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -22,18 +22,19 @@ an instance with it. """ +import base64 import logging import os import tempfile -import base64 -from zipfile import ZipFile, ZIP_DEFLATED +import zipfile from nova import exception from nova import flags -from nova.auth import users from nova import utils +from nova.auth import users from nova.endpoint import api + FLAGS = flags.FLAGS flags.DEFINE_string('boot_script_template', @@ -52,7 +53,7 @@ class CloudPipe(object): tmpfolder = tempfile.mkdtemp() filename = "payload.zip" zippath = os.path.join(tmpfolder, filename) - z = ZipFile(zippath, "w", ZIP_DEFLATED) + z = zipfile.ZipFile(zippath, "w", zipfile.ZIP_DEFLATED) z.write(FLAGS.boot_script_template,'autorun.sh') z.close() diff --git a/nova/compute/disk.py b/nova/compute/disk.py index b476987bb..08a22556e 100644 --- a/nova/compute/disk.py +++ b/nova/compute/disk.py @@ -24,12 +24,11 @@ Includes injection of SSH PGP keys into authorized_keys file. import logging import os import tempfile - - from twisted.internet import defer from nova import exception + @defer.inlineCallbacks def partition(infile, outfile, local_bytes=0, local_type='ext2', execute=None): """Takes a single partition represented by infile and writes a bootable diff --git a/nova/compute/exception.py b/nova/compute/exception.py index fefa7451d..13e4f0a51 100644 --- a/nova/compute/exception.py +++ b/nova/compute/exception.py @@ -22,6 +22,7 @@ Exceptions for Compute Node errors, mostly network addressing. from nova.exception import Error + class NoMoreAddresses(Error): pass diff --git a/nova/compute/linux_net.py b/nova/compute/linux_net.py index 358f184af..7b6ae693a 100644 --- a/nova/compute/linux_net.py +++ b/nova/compute/linux_net.py @@ -19,11 +19,12 @@ import logging import signal import os -import nova.utils import subprocess # todo(ja): does the definition of network_path belong here? +from nova import utils + from nova import flags FLAGS=flags.FLAGS diff --git a/nova/compute/model.py b/nova/compute/model.py index 2d8a036a5..cda188183 100644 --- a/nova/compute/model.py +++ b/nova/compute/model.py @@ -42,8 +42,6 @@ True import logging import time - - import redis from nova import datastore diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py index 64852838d..fdc86b031 100644 --- a/nova/compute/monitor.py +++ b/nova/compute/monitor.py @@ -24,11 +24,18 @@ Instance Monitoring: in the object store. """ +import boto +import boto.s3 import datetime +import libxml2 import logging import os +import rrdtool import sys import time +from twisted.internet import defer +from twisted.internet import task +from twisted.application import service try: import libvirt @@ -37,13 +44,6 @@ except Exception, err: from nova import flags -import boto -import boto.s3 -import libxml2 -import rrdtool -from twisted.internet import defer -from twisted.internet import task -from twisted.application import service FLAGS = flags.FLAGS flags.DEFINE_integer( diff --git a/nova/compute/network.py b/nova/compute/network.py index faac74e54..1a8bc4ca1 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -20,22 +20,19 @@ Classes for network control, including VLANs, DHCP, and IP allocation. """ +import IPy import logging import os import time -# TODO(termie): clean up these imports - -import IPy - from nova import datastore +from nova import exception from nova import flags from nova import utils -from nova import exception -from nova.compute import exception as compute_exception from nova.auth import users +from nova.compute import exception as compute_exception +from nova.compute import linux_net -import linux_net FLAGS = flags.FLAGS flags.DEFINE_string('networks_path', utils.abspath('../networks'), diff --git a/nova/compute/node.py b/nova/compute/node.py index 488e8870f..d681ec661 100644 --- a/nova/compute/node.py +++ b/nova/compute/node.py @@ -30,12 +30,11 @@ import logging import os import shutil import sys - - from twisted.internet import defer from twisted.internet import task from twisted.application import service + try: import libvirt except Exception, err: @@ -49,8 +48,9 @@ from nova import utils from nova.compute import disk from nova.compute import model from nova.compute import network -from nova.volume import storage from nova.objectstore import image # for image_path flag +from nova.volume import storage + FLAGS = flags.FLAGS flags.DEFINE_string('libvirt_xml_template', diff --git a/nova/crypto.py b/nova/crypto.py index f6e9717d0..cc84f5e45 100644 --- a/nova/crypto.py +++ b/nova/crypto.py @@ -24,6 +24,7 @@ SSH keypairs and x509 certificates. import base64 import hashlib import logging +import M2Crypto import os import shutil import struct @@ -31,9 +32,6 @@ import tempfile import time import utils - -import M2Crypto - from nova import exception from nova import flags diff --git a/nova/datastore.py b/nova/datastore.py index ab6da7043..dae78f50c 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -24,8 +24,6 @@ before trying to run this. """ import logging - - import redis from nova import exception diff --git a/nova/endpoint/api.py b/nova/endpoint/api.py index 2046d01ae..79a2aaddb 100755 --- a/nova/endpoint/api.py +++ b/nova/endpoint/api.py @@ -25,21 +25,20 @@ import logging import multiprocessing import random import re +import tornado.web +from twisted.internet import defer import urllib # TODO(termie): replace minidom with etree from xml.dom import minidom - -import tornado.web -from twisted.internet import defer - from nova import crypto from nova import exception from nova import flags from nova import utils -from nova.endpoint import cloud from nova.auth import users import nova.cloudpipe.api +from nova.endpoint import cloud + FLAGS = flags.FLAGS flags.DEFINE_integer('cc_port', 8773, 'cloud controller port') diff --git a/nova/endpoint/cloud.py b/nova/endpoint/cloud.py index 97f31349c..3b7b4804b 100644 --- a/nova/endpoint/cloud.py +++ b/nova/endpoint/cloud.py @@ -27,15 +27,13 @@ import json import logging import os import time - - from twisted.internet import defer from nova import datastore +from nova import exception from nova import flags from nova import rpc from nova import utils -from nova import exception from nova.auth import rbac from nova.auth import users from nova.compute import model @@ -44,6 +42,7 @@ from nova.compute import node from nova.endpoint import images from nova.volume import storage + FLAGS = flags.FLAGS flags.DEFINE_string('cloud_topic', 'cloud', 'the topic clouds listen on') diff --git a/nova/endpoint/images.py b/nova/endpoint/images.py index 34da907cb..40234d708 100644 --- a/nova/endpoint/images.py +++ b/nova/endpoint/images.py @@ -21,17 +21,16 @@ Proxy AMI-related calls from the cloud controller, to the running objectstore daemon. """ +import boto +import boto.s3 import json import random import urllib - -import boto -import boto.s3 - from nova import flags from nova import utils + FLAGS = flags.FLAGS def modify(context, image_id, operation): diff --git a/nova/endpoint/rackspace.py b/nova/endpoint/rackspace.py index 18cb201a7..9208ddab7 100644 --- a/nova/endpoint/rackspace.py +++ b/nova/endpoint/rackspace.py @@ -26,21 +26,19 @@ import logging import multiprocessing import os import time - - import tornado.web from twisted.internet import defer from nova import datastore +from nova import exception from nova import flags from nova import rpc from nova import utils -from nova import exception from nova.auth import users from nova.compute import model from nova.compute import network -from nova.endpoint import wsgi from nova.endpoint import images +from nova.endpoint import wsgi from nova.volume import storage diff --git a/nova/exception.py b/nova/exception.py index 09d894e4b..bda002d1e 100644 --- a/nova/exception.py +++ b/nova/exception.py @@ -22,8 +22,8 @@ Nova-type exceptions. SHOULD include dedicated exception logging. """ import logging -import traceback import sys +import traceback class Error(Exception): def __init__(self, message=None): diff --git a/nova/fakerabbit.py b/nova/fakerabbit.py index 00eb18327..689194513 100644 --- a/nova/fakerabbit.py +++ b/nova/fakerabbit.py @@ -18,11 +18,10 @@ """ Based a bit on the carrot.backeds.queue backend... but a lot better """ +from carrot.backends import base import logging import Queue as queue -from carrot.backends import base - class Message(base.BaseMessage): pass diff --git a/nova/objectstore/bucket.py b/nova/objectstore/bucket.py index 61feb4a4c..090ef4e61 100644 --- a/nova/objectstore/bucket.py +++ b/nova/objectstore/bucket.py @@ -20,17 +20,18 @@ Simple object store using Blobs and JSON files on disk. """ +import bisect import datetime import glob import json import os -import bisect from nova import exception from nova import flags from nova import utils from nova.objectstore import stored + FLAGS = flags.FLAGS flags.DEFINE_string('buckets_path', utils.abspath('../buckets'), 'path to s3 buckets') diff --git a/nova/objectstore/handler.py b/nova/objectstore/handler.py index 79f01169c..8377a57a6 100644 --- a/nova/objectstore/handler.py +++ b/nova/objectstore/handler.py @@ -38,14 +38,11 @@ S3 client with this module:: import datetime import os -import urllib import json import logging import multiprocessing - - - from tornado import escape, web +import urllib from nova import exception from nova import flags diff --git a/nova/objectstore/stored.py b/nova/objectstore/stored.py index f1730cbc7..81c047b22 100644 --- a/nova/objectstore/stored.py +++ b/nova/objectstore/stored.py @@ -20,10 +20,11 @@ Properties of an object stored within a bucket. """ -from nova.exception import NotFound, NotAuthorized - import os + import nova.crypto +from nova.exception import NotFound, NotAuthorized + class Object(object): def __init__(self, bucket, key): diff --git a/nova/process.py b/nova/process.py index 4c1cef58c..ff789a08a 100644 --- a/nova/process.py +++ b/nova/process.py @@ -23,8 +23,6 @@ Process pool, still buggy right now. import logging import multiprocessing import StringIO - - from twisted.internet import defer from twisted.internet import error from twisted.internet import process diff --git a/nova/rpc.py b/nova/rpc.py index 1b171f5d9..58a2b29cf 100644 --- a/nova/rpc.py +++ b/nova/rpc.py @@ -21,14 +21,12 @@ AMQP-based RPC. Queues have consumers and publishers. No fan-out support yet. """ +from carrot import connection +from carrot import messaging import json import logging import sys import uuid - - -from carrot import connection -from carrot import messaging from twisted.internet import defer from twisted.internet import reactor from twisted.internet import task diff --git a/nova/server.py b/nova/server.py index 8f4ea91a3..7a1901a2f 100644 --- a/nova/server.py +++ b/nova/server.py @@ -20,6 +20,8 @@ Base functionality for nova daemons - gradually being replaced with twistd.py. """ +import daemon +from daemon import pidlockfile import logging import logging.handlers import os @@ -27,10 +29,6 @@ import signal import sys import time - -import daemon -from daemon import pidlockfile - from nova import flags diff --git a/nova/test.py b/nova/test.py index 864bc3f5a..5dcf0b9b0 100644 --- a/nova/test.py +++ b/nova/test.py @@ -23,16 +23,14 @@ and some black magic for inline callbacks. """ import logging +import mox +import stubout import time import unittest - - -import mox from tornado import ioloop from twisted.internet import defer from twisted.python import failure from twisted.trial import unittest as trial_unittest -import stubout from nova import fakerabbit from nova import flags diff --git a/nova/tests/access_unittest.py b/nova/tests/access_unittest.py index 609bda901..8500dd0cb 100644 --- a/nova/tests/access_unittest.py +++ b/nova/tests/access_unittest.py @@ -19,11 +19,12 @@ import unittest import logging -from nova.auth.users import UserManager -from nova.auth import rbac from nova import exception from nova import flags from nova import test +from nova.auth.users import UserManager +from nova.auth import rbac + FLAGS = flags.FLAGS class Context(object): diff --git a/nova/tests/api_integration.py b/nova/tests/api_integration.py index 0ccf69525..23a88f083 100644 --- a/nova/tests/api_integration.py +++ b/nova/tests/api_integration.py @@ -16,10 +16,11 @@ # License for the specific language governing permissions and limitations # under the License. -import unittest import boto from boto.ec2.regioninfo import RegionInfo +import unittest + ACCESS_KEY = 'fake' SECRET_KEY = 'fake' diff --git a/nova/tests/api_unittest.py b/nova/tests/api_unittest.py index 2937ef0b4..e5e2afe26 100644 --- a/nova/tests/api_unittest.py +++ b/nova/tests/api_unittest.py @@ -16,13 +16,11 @@ # License for the specific language governing permissions and limitations # under the License. +import boto +from boto.ec2 import regioninfo import httplib import random import StringIO - - -import boto -from boto.ec2 import regioninfo from tornado import httpserver from twisted.internet import defer diff --git a/nova/tests/cloud_unittest.py b/nova/tests/cloud_unittest.py index 6bafe2ea7..b8614fdc8 100644 --- a/nova/tests/cloud_unittest.py +++ b/nova/tests/cloud_unittest.py @@ -19,12 +19,10 @@ import logging import StringIO import time -import unittest -from xml.etree import ElementTree - - from tornado import ioloop from twisted.internet import defer +import unittest +from xml.etree import ElementTree from nova import flags from nova import rpc diff --git a/nova/tests/future_unittest.py b/nova/tests/future_unittest.py index a4523a315..da5470ffe 100644 --- a/nova/tests/future_unittest.py +++ b/nova/tests/future_unittest.py @@ -17,15 +17,13 @@ # under the License. import logging +import mox import StringIO import time -import unittest -from xml.etree import ElementTree - - -import mox from tornado import ioloop from twisted.internet import defer +import unittest +from xml.etree import ElementTree from nova import cloud from nova import exception diff --git a/nova/tests/model_unittest.py b/nova/tests/model_unittest.py index 37a4c3e80..1bd7e527f 100644 --- a/nova/tests/model_unittest.py +++ b/nova/tests/model_unittest.py @@ -18,8 +18,6 @@ import logging import time - - from twisted.internet import defer from nova import exception diff --git a/nova/tests/network_unittest.py b/nova/tests/network_unittest.py index af9efffbd..a822cc1d9 100644 --- a/nova/tests/network_unittest.py +++ b/nova/tests/network_unittest.py @@ -16,13 +16,11 @@ # License for the specific language governing permissions and limitations # under the License. +import IPy import os import logging import unittest - -import IPy - from nova import flags from nova import test from nova import exception diff --git a/nova/tests/node_unittest.py b/nova/tests/node_unittest.py index 60f97741e..93942d79e 100644 --- a/nova/tests/node_unittest.py +++ b/nova/tests/node_unittest.py @@ -18,11 +18,8 @@ import logging import time - -from xml.etree import ElementTree - - from twisted.internet import defer +from xml.etree import ElementTree from nova import exception from nova import flags @@ -31,6 +28,7 @@ from nova import utils from nova.compute import model from nova.compute import node + FLAGS = flags.FLAGS diff --git a/nova/tests/objectstore_unittest.py b/nova/tests/objectstore_unittest.py index 0c700ff96..f47ca7f00 100644 --- a/nova/tests/objectstore_unittest.py +++ b/nova/tests/objectstore_unittest.py @@ -23,15 +23,13 @@ import os import shutil import tempfile - - from nova import flags from nova import objectstore from nova import test from nova.auth import users -FLAGS = flags.FLAGS +FLAGS = flags.FLAGS oss_tempdir = tempfile.mkdtemp(prefix='test_oss-') diff --git a/nova/tests/process_unittest.py b/nova/tests/process_unittest.py index fe625b6c8..01648961f 100644 --- a/nova/tests/process_unittest.py +++ b/nova/tests/process_unittest.py @@ -17,11 +17,9 @@ # under the License. import logging -from xml.etree import ElementTree - - from twisted.internet import defer from twisted.internet import reactor +from xml.etree import ElementTree from nova import exception from nova import flags diff --git a/nova/tests/users_unittest.py b/nova/tests/users_unittest.py index 4bc66ca5c..301721075 100644 --- a/nova/tests/users_unittest.py +++ b/nova/tests/users_unittest.py @@ -17,12 +17,10 @@ # under the License. import logging -import unittest - - from M2Crypto import BIO from M2Crypto import RSA from M2Crypto import X509 +import unittest from nova import crypto from nova import flags diff --git a/nova/tests/validator_unittest.py b/nova/tests/validator_unittest.py index fba5b3060..84daa135e 100644 --- a/nova/tests/validator_unittest.py +++ b/nova/tests/validator_unittest.py @@ -19,8 +19,6 @@ import logging import unittest - - from nova import flags from nova import test from nova import validate diff --git a/nova/twistd.py b/nova/twistd.py index 3d7fdeb6e..32a46ce03 100644 --- a/nova/twistd.py +++ b/nova/twistd.py @@ -22,22 +22,21 @@ manage pid files and support syslogging. """ import logging +import logging.handlers import os import signal import sys import time -import UserDict -import logging.handlers - - from twisted.scripts import twistd from twisted.python import log from twisted.python import reflect from twisted.python import runtime from twisted.python import usage +import UserDict from nova import flags + if runtime.platformType == "win32": from twisted.scripts._twistw import ServerOptions else: diff --git a/nova/utils.py b/nova/utils.py index 25181332d..c5b935673 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -20,6 +20,7 @@ System-level utilities and helper functions. """ +from datetime import datetime import inspect import logging import os @@ -27,7 +28,6 @@ import random import subprocess import socket import sys -from datetime import datetime from nova import flags diff --git a/nova/volume/storage.py b/nova/volume/storage.py index dc67aaeec..de20f30b5 100644 --- a/nova/volume/storage.py +++ b/nova/volume/storage.py @@ -25,12 +25,10 @@ Currently uses Ata-over-Ethernet. import glob import logging import os -import socket import shutil +import socket import tempfile import time - - from tornado import ioloop from twisted.internet import defer -- cgit From 76ad7b8d40352ba39f5da9bb19ad1ab52ab3986e Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 15 Jul 2010 23:16:09 +0000 Subject: no more print in storage unittest --- nova/tests/storage_unittest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/nova/tests/storage_unittest.py b/nova/tests/storage_unittest.py index b04602b71..60576d74f 100644 --- a/nova/tests/storage_unittest.py +++ b/nova/tests/storage_unittest.py @@ -69,13 +69,11 @@ class StorageTestCase(test.TrialTestCase): vols = [] for i in xrange(total_slots): vid = self.mystorage.create_volume(vol_size, user_id, project_id) - print vid vols.append(vid) self.assertRaises(storage.NoMoreVolumes, self.mystorage.create_volume, vol_size, user_id, project_id) for id in vols: - print id self.mystorage.delete_volume(id) def test_run_attach_detach_volume(self): -- cgit From 4e2fdcb6e82d9fab4ea37749fc3f380430ffb0ff Mon Sep 17 00:00:00 2001 From: Justin Santa Barbara Date: Fri, 16 Jul 2010 18:33:46 +0000 Subject: _redis_name wasn't picking up override_type correctly, and _redis_key wasn't using it --- nova/datastore.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nova/datastore.py b/nova/datastore.py index 8d6272ada..47ce37992 100644 --- a/nova/datastore.py +++ b/nova/datastore.py @@ -105,7 +105,7 @@ class BasicModel(object): @classmethod def _redis_name(cls): - return self.override_type or cls.__name__ + return cls.override_type or cls.__name__ @classmethod def lookup(cls, identifier): @@ -147,7 +147,7 @@ class BasicModel(object): @property def __redis_key(self): - return '%s:%s' % (self.__class__.__name__.lower(), self.identifier) + return '%s:%s' % (self._redis_name(), self.identifier) def __repr__(self): return "<%s:%s>" % (self.__class__.__name__, self.identifier) -- cgit From c954657ba018dbeda5db6ef39dc68a0fe48f421f Mon Sep 17 00:00:00 2001 From: Todd Willey Date: Fri, 16 Jul 2010 15:11:48 -0400 Subject: Fixes things that were not quite right after big merge party. --- nova/auth/users.py | 25 +++++++++++++------------ nova/compute/network.py | 10 ++++++++-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/nova/auth/users.py b/nova/auth/users.py index 72edcc2aa..0903341b4 100644 --- a/nova/auth/users.py +++ b/nova/auth/users.py @@ -462,11 +462,11 @@ class UserManager(object): description=None, member_users=None): if member_users: member_users = [User.safe_id(u) for u in member_users] + # NOTE(vish): try to associate a vpn ip and port first because + # if it throws an exception, we save having to + # create and destroy a project + Vpn.create(name) with LDAPWrapper() as conn: - # NOTE(vish): try to associate a vpn ip and port first because - # if it throws an exception, we save having to - # create and destroy a project - Vpn.create(name) return conn.create_project(name, User.safe_id(manager_user), description, @@ -527,15 +527,16 @@ class UserManager(object): with LDAPWrapper() as conn: user = User.safe_id(user) result = conn.create_user(user, access, secret, admin) - if create_project: - # NOTE(vish): if the project creation fails, we delete - # the user and return an exception - try: - conn.create_project(user, user, user) - except Exception: + if create_project: + # NOTE(vish): if the project creation fails, we delete + # the user and return an exception + try: + conn.create_project(user, user, user) + except Exception: + with LDAPWrapper() as conn: conn.delete_user(user) - raise - return result + raise + return result def delete_user(self, user, delete_project=True): with LDAPWrapper() as conn: diff --git a/nova/compute/network.py b/nova/compute/network.py index 8592d7af7..ff527f74e 100644 --- a/nova/compute/network.py +++ b/nova/compute/network.py @@ -130,8 +130,9 @@ class Vlan(datastore.BasicModel): @datastore.absorb_connection_error def all(cls): set_name = cls._redis_set_name(cls.__name__) - for project,vlan in datastore.Redis.instance().hgetall(set_name): - yield cls(project, vlan) + elements = datastore.Redis.instance().hgetall(set_name) + for project in elements: + yield cls(project, elements[project]) @datastore.absorb_connection_error def save(self): @@ -291,6 +292,7 @@ class BridgedNetwork(BaseNetwork): netmask """ + bridge_gets_ip = False override_type = 'network' @classmethod @@ -532,6 +534,10 @@ def get_vlan_for_project(project_id): return Vlan.create(project_id, vnum) raise compute_exception.AddressNotAllocated("Out of VLANs") +def get_network_by_interface(iface, security_group='default'): + vlan = iface.rpartition("br")[2] + return get_project_network(Vlan.dict_by_vlan().get(vlan), security_group) + def get_network_by_address(address): logging.debug("Get Network By Address: %s" % address) for project in users.UserManager.instance().get_projects(): -- cgit From c510e7e830961e593f86dbe9dbb5d031dedef5e8 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 16 Jul 2010 15:33:24 -0500 Subject: Added a config file to let setup.py drive building the sphinx docs. --- docs/auth.rst | 4 ++-- docs/index.rst | 2 ++ setup.cfg | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 setup.cfg diff --git a/docs/auth.rst b/docs/auth.rst index 476ca9154..70aca704a 100644 --- a/docs/auth.rst +++ b/docs/auth.rst @@ -172,10 +172,10 @@ Further Challenges -The :mod:`access` Module +The :mod:`rbac` Module -------------------------- -.. automodule:: nova.auth.access +.. automodule:: nova.auth.rbac :members: :undoc-members: :show-inheritance: diff --git a/docs/index.rst b/docs/index.rst index 039bf00ff..ef2e8f63e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -44,6 +44,8 @@ Contents: fakes binaries todo + modules + packages Indices and tables ================== diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..278586962 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[build_sphinx] +source-dir = docs +build-dir = docs/_build +all_files = 1 -- cgit