merged in trunk and fixed import merge errors

This commit is contained in:
Vishvananda Ishaya
2010-07-18 13:25:43 -05:00
42 changed files with 69 additions and 142 deletions

View File

@@ -10,16 +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
\n

View File

@@ -22,8 +22,6 @@ Tornado daemon for the main API endpoint.
"""
import logging
from nova import vendor
from tornado import httpserver
from tornado import ioloop

View File

@@ -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

View File

@@ -32,13 +32,13 @@ import sys
# not true the ugly line below can be removed
sys.path.append(os.path.abspath(os.path.join(__file__, "../../")))
from nova import flags
from nova import rpc
from nova import utils
from nova.compute import linux_net
from nova.compute import network
from nova import flags
FLAGS = flags.FLAGS

View File

@@ -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

View File

@@ -22,8 +22,6 @@
"""
import logging
from nova import vendor
from twisted.internet import task
from twisted.application import service

View File

@@ -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

View File

@@ -22,8 +22,6 @@
"""
import logging
from nova import vendor
from tornado import httpserver
from tornado import ioloop

View File

@@ -21,10 +21,8 @@
"""
import logging
from wsgiref import simple_server
from nova import vendor
from tornado import ioloop
from wsgiref import simple_server
from nova import flags
from nova import rpc

View File

@@ -22,8 +22,6 @@
"""
import logging
from nova import vendor
from tornado import ioloop
from nova import flags

View File

@@ -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:

View File

@@ -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 -----------------------------------------------------

View File

@@ -44,6 +44,8 @@ Contents:
fakes
binaries
todo
modules
packages
Indices and tables
==================

View File

@@ -20,8 +20,6 @@ Nova User API client library.
"""
import base64
from nova import vendor
import boto
from boto.ec2.regioninfo import RegionInfo

View File

@@ -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):

View File

@@ -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
@@ -462,11 +459,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 +524,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:

View File

@@ -24,8 +24,6 @@ before trying to run this.
"""
import logging
from nova import vendor
import redis
from nova import exception
@@ -105,7 +103,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 +145,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)

View File

@@ -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
from nova import vendor
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')

View File

@@ -27,15 +27,13 @@ import json
import logging
import os
import time
from nova import vendor
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')

View File

@@ -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
from nova import vendor
import boto
import boto.s3
from nova import flags
from nova import utils
FLAGS = flags.FLAGS
def modify(context, image_id, operation):

View File

@@ -26,21 +26,19 @@ import logging
import multiprocessing
import os
import time
from nova import vendor
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

View File

@@ -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

View File

@@ -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

View File

@@ -23,8 +23,6 @@ Process pool, still buggy right now.
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

View File

@@ -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 nova import vendor
from carrot import connection
from carrot import messaging
from twisted.internet import defer
from twisted.internet import reactor
from twisted.internet import task

View File

@@ -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
from nova import vendor
import daemon
from daemon import pidlockfile
from nova import flags

View File

@@ -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):

View File

@@ -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'

View File

@@ -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
from nova import vendor
import boto
from boto.ec2 import regioninfo
from tornado import httpserver
from twisted.internet import defer

View File

@@ -19,12 +19,10 @@
import logging
import StringIO
import time
import unittest
from xml.etree import ElementTree
from nova import vendor
from tornado import ioloop
from twisted.internet import defer
import unittest
from xml.etree import ElementTree
from nova import flags
from nova import rpc

View File

@@ -17,15 +17,13 @@
# under the License.
import logging
import mox
import StringIO
import time
import unittest
from xml.etree import ElementTree
from nova import vendor
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

View File

@@ -18,8 +18,6 @@
import logging
import time
from nova import vendor
from twisted.internet import defer
from nova import exception

View File

@@ -16,12 +16,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import IPy
import os
import logging
from nova import vendor
import IPy
from nova import flags
from nova import test
from nova import utils

View File

@@ -18,11 +18,8 @@
import logging
import time
from xml.etree import ElementTree
from nova import vendor
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

View File

@@ -23,15 +23,13 @@ import os
import shutil
import tempfile
from nova import vendor
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-')

View File

@@ -17,11 +17,9 @@
# under the License.
import logging
from xml.etree import ElementTree
from nova import vendor
from twisted.internet import defer
from twisted.internet import reactor
from xml.etree import ElementTree
from nova import exception
from nova import flags

View File

@@ -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):

View File

@@ -17,12 +17,10 @@
# under the License.
import logging
import unittest
from nova import vendor
from M2Crypto import BIO
from M2Crypto import RSA
from M2Crypto import X509
import unittest
from nova import crypto
from nova import flags

View File

@@ -19,8 +19,6 @@
import logging
import unittest
from nova import vendor
from nova import flags
from nova import test
from nova import validate

View File

@@ -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 nova import vendor
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:

View File

@@ -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... :('

View File

@@ -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