New project structure for OS-like API versioning

Related to blueprint nailgun-validators-to-objects

Change-Id: I9dfa05deae2d2bcbfd2dfd356392b6f9e62a08cc
This commit is contained in:
Nikolay Markov 2014-05-20 17:39:31 +04:00
parent ab7f7dfdda
commit 28e54a0248
66 changed files with 191 additions and 179 deletions

View File

@ -7,68 +7,68 @@ REST API Reference
Releases API Releases API
------------ ------------
.. automodule:: nailgun.api.handlers.release .. automodule:: nailgun.api.v1.handlers.release
:inherited-members: :inherited-members:
Clusters API Clusters API
------------ ------------
.. automodule:: nailgun.api.handlers.cluster .. automodule:: nailgun.api.v1.handlers.cluster
:inherited-members: :inherited-members:
Nodes API Nodes API
--------- ---------
.. automodule:: nailgun.api.handlers.node .. automodule:: nailgun.api.v1.handlers.node
:inherited-members: :inherited-members:
Disks API Disks API
--------- ---------
.. automodule:: nailgun.api.handlers.disks .. automodule:: nailgun.api.v1.handlers.disks
:inherited-members: :inherited-members:
Network Configuration API Network Configuration API
------------------------- -------------------------
.. automodule:: nailgun.api.handlers.network_configuration .. automodule:: nailgun.api.v1.handlers.network_configuration
:inherited-members: :inherited-members:
Notifications API Notifications API
----------------- -----------------
.. automodule:: nailgun.api.handlers.notifications .. automodule:: nailgun.api.v1.handlers.notifications
:inherited-members: :inherited-members:
Tasks API Tasks API
----------------- -----------------
.. automodule:: nailgun.api.handlers.tasks .. automodule:: nailgun.api.v1.handlers.tasks
:inherited-members: :inherited-members:
Logs API Logs API
----------------- -----------------
.. automodule:: nailgun.api.handlers.logs .. automodule:: nailgun.api.v1.handlers.logs
:inherited-members: :inherited-members:
Redhat API Redhat API
----------------- -----------------
.. automodule:: nailgun.api.handlers.redhat .. automodule:: nailgun.api.v1.handlers.redhat
:inherited-members: :inherited-members:
Version API Version API
----------------- -----------------
.. automodule:: nailgun.api.handlers.version .. automodule:: nailgun.api.v1.handlers.version
:inherited-members: :inherited-members:

View File

@ -12,6 +12,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.handlers.base import check_client_content_type from nailgun.api.v1.handlers.base import check_client_content_type
from nailgun.api.handlers.base import forbid_client_caching from nailgun.api.v1.handlers.base import forbid_client_caching
from nailgun.api.handlers.base import load_db_driver from nailgun.api.v1.handlers.base import load_db_driver

View File

@ -20,10 +20,10 @@ Handlers dealing with nodes assignment
import traceback import traceback
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.assignment import NodeAssignmentValidator from nailgun.api.v1.validators.assignment import NodeAssignmentValidator
from nailgun.api.validators.assignment import NodeUnassignmentValidator from nailgun.api.v1.validators.assignment import NodeUnassignmentValidator
from nailgun.db.sqlalchemy.models import Node from nailgun.db.sqlalchemy.models import Node

View File

@ -21,13 +21,14 @@ import json
from sqlalchemy import exc as sa_exc from sqlalchemy import exc as sa_exc
import web import web
from nailgun.api.serializers.base import BasicSerializer from nailgun.api.v1.validators.base import BasicValidator
from nailgun.api.validators.base import BasicValidator
from nailgun.db import db from nailgun.db import db
# TODO(enchantner): let's switch to Cluster object in the future # TODO(enchantner): let's switch to Cluster object in the future
from nailgun.db.sqlalchemy.models import Cluster from nailgun.db.sqlalchemy.models import Cluster
from nailgun.objects.serializers.base import BasicSerializer
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.logger import logger from nailgun.logger import logger

View File

@ -22,8 +22,8 @@ import tempfile
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import CapacityLog from nailgun.db.sqlalchemy.models import CapacityLog
from nailgun.objects import Task from nailgun.objects import Task

View File

@ -20,18 +20,18 @@ Handlers dealing with clusters
import traceback import traceback
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import DeferredTaskHandler from nailgun.api.v1.handlers.base import DeferredTaskHandler
from nailgun.api.handlers.base import CollectionHandler from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.handlers.base import SingleHandler from nailgun.api.v1.handlers.base import SingleHandler
from nailgun import objects from nailgun import objects
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.cluster import AttributesValidator from nailgun.api.v1.validators.cluster import AttributesValidator
from nailgun.api.validators.cluster import ClusterValidator from nailgun.api.v1.validators.cluster import ClusterValidator
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import Cluster from nailgun.db.sqlalchemy.models import Cluster
from nailgun.logger import logger from nailgun.logger import logger

View File

@ -18,9 +18,9 @@
Handlers dealing with disks Handlers dealing with disks
""" """
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.node import NodeDisksValidator from nailgun.api.v1.validators.node import NodeDisksValidator
from nailgun import objects from nailgun import objects

View File

@ -27,8 +27,8 @@ import time
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import Node from nailgun.db.sqlalchemy.models import Node
from nailgun.db.sqlalchemy.models import RedHatAccount from nailgun.db.sqlalchemy.models import RedHatAccount

View File

@ -22,16 +22,17 @@ import json
import traceback import traceback
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NeutronNetworkConfigurationSerializer import NeutronNetworkConfigurationSerializer
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NovaNetworkConfigurationSerializer import NovaNetworkConfigurationSerializer
from nailgun.api.validators.network \
from nailgun.api.v1.validators.network \
import NeutronNetworkConfigurationValidator import NeutronNetworkConfigurationValidator
from nailgun.api.validators.network \ from nailgun.api.v1.validators.network \
import NovaNetworkConfigurationValidator import NovaNetworkConfigurationValidator
from nailgun.db import db from nailgun.db import db

View File

@ -22,16 +22,17 @@ from datetime import datetime
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import CollectionHandler from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.handlers.base import SingleHandler from nailgun.api.v1.handlers.base import SingleHandler
from nailgun.api.serializers.node import NodeInterfacesSerializer from nailgun.api.v1.validators.network import NetAssignmentValidator
from nailgun.api.validators.network import NetAssignmentValidator from nailgun.api.v1.validators.node import NodeValidator
from nailgun.api.validators.node import NodeValidator
from nailgun import objects from nailgun import objects
from nailgun.objects.serializers.node import NodeInterfacesSerializer
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import NetworkGroup from nailgun.db.sqlalchemy.models import NetworkGroup
from nailgun.db.sqlalchemy.models import Node from nailgun.db.sqlalchemy.models import Node

View File

@ -19,13 +19,13 @@ Handlers dealing with notifications
""" """
import web import web
from nailgun.api.handlers.base import CollectionHandler from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.handlers.base import SingleHandler from nailgun.api.v1.handlers.base import SingleHandler
from nailgun import objects from nailgun import objects
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.notification import NotificationValidator from nailgun.api.v1.validators.notification import NotificationValidator
from nailgun.db import db from nailgun.db import db

View File

@ -18,9 +18,9 @@ import traceback
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.node import NodesFilterValidator from nailgun.api.v1.validators.node import NodesFilterValidator
from nailgun.db.sqlalchemy.models import Cluster from nailgun.db.sqlalchemy.models import Cluster
from nailgun.db.sqlalchemy.models import Node from nailgun.db.sqlalchemy.models import Node

View File

@ -18,9 +18,9 @@ Handlers dealing with exclusive Red Hat tasks
import traceback import traceback
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.redhat import RedHatAccountValidator from nailgun.api.v1.validators.redhat import RedHatAccountValidator
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import RedHatAccount from nailgun.db.sqlalchemy.models import RedHatAccount
from nailgun.db.sqlalchemy.models import Release from nailgun.db.sqlalchemy.models import Release

View File

@ -22,8 +22,8 @@ import base64
import json import json
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.settings import settings from nailgun.settings import settings

View File

@ -18,10 +18,10 @@
Handlers dealing with releases Handlers dealing with releases
""" """
from nailgun.api.handlers.base import CollectionHandler from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.handlers.base import SingleHandler from nailgun.api.v1.handlers.base import SingleHandler
from nailgun.api.validators.release import ReleaseValidator from nailgun.api.v1.validators.release import ReleaseValidator
from nailgun.objects import Release from nailgun.objects import Release
from nailgun.objects import ReleaseCollection from nailgun.objects import ReleaseCollection

View File

@ -15,11 +15,11 @@
# under the License. # under the License.
import web import web
from nailgun.api.handlers.base import CollectionHandler from nailgun.api.v1.handlers.base import CollectionHandler
from nailgun.api.handlers.base import SingleHandler from nailgun.api.v1.handlers.base import SingleHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.api.validators.task import TaskValidator from nailgun.api.v1.validators.task import TaskValidator
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -18,8 +18,8 @@
Product info handlers Product info handlers
""" """
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.handlers.base import content_json from nailgun.api.v1.handlers.base import content_json
from nailgun.settings import settings from nailgun.settings import settings

View File

@ -16,69 +16,69 @@
import web import web
from nailgun.api.handlers.assignment import NodeAssignmentHandler from nailgun.api.v1.handlers.assignment import NodeAssignmentHandler
from nailgun.api.handlers.assignment import NodeUnassignmentHandler from nailgun.api.v1.handlers.assignment import NodeUnassignmentHandler
from nailgun.api.handlers.capacity import CapacityLogCsvHandler from nailgun.api.v1.handlers.capacity import CapacityLogCsvHandler
from nailgun.api.handlers.capacity import CapacityLogHandler from nailgun.api.v1.handlers.capacity import CapacityLogHandler
from nailgun.api.handlers.cluster import ClusterAttributesDefaultsHandler from nailgun.api.v1.handlers.cluster import ClusterAttributesDefaultsHandler
from nailgun.api.handlers.cluster import ClusterAttributesHandler from nailgun.api.v1.handlers.cluster import ClusterAttributesHandler
from nailgun.api.handlers.cluster import ClusterChangesHandler from nailgun.api.v1.handlers.cluster import ClusterChangesHandler
from nailgun.api.handlers.cluster import ClusterCollectionHandler from nailgun.api.v1.handlers.cluster import ClusterCollectionHandler
from nailgun.api.handlers.cluster import ClusterGeneratedData from nailgun.api.v1.handlers.cluster import ClusterGeneratedData
from nailgun.api.handlers.cluster import ClusterHandler from nailgun.api.v1.handlers.cluster import ClusterHandler
from nailgun.api.handlers.cluster import ClusterResetHandler from nailgun.api.v1.handlers.cluster import ClusterResetHandler
from nailgun.api.handlers.cluster import ClusterStopDeploymentHandler from nailgun.api.v1.handlers.cluster import ClusterStopDeploymentHandler
from nailgun.api.handlers.disks import NodeDefaultsDisksHandler from nailgun.api.v1.handlers.disks import NodeDefaultsDisksHandler
from nailgun.api.handlers.disks import NodeDisksHandler from nailgun.api.v1.handlers.disks import NodeDisksHandler
from nailgun.api.handlers.disks import NodeVolumesInformationHandler from nailgun.api.v1.handlers.disks import NodeVolumesInformationHandler
from nailgun.api.handlers.logs import LogEntryCollectionHandler from nailgun.api.v1.handlers.logs import LogEntryCollectionHandler
from nailgun.api.handlers.logs import LogPackageHandler from nailgun.api.v1.handlers.logs import LogPackageHandler
from nailgun.api.handlers.logs import LogSourceByNodeCollectionHandler from nailgun.api.v1.handlers.logs import LogSourceByNodeCollectionHandler
from nailgun.api.handlers.logs import LogSourceCollectionHandler from nailgun.api.v1.handlers.logs import LogSourceCollectionHandler
from nailgun.api.handlers.network_configuration \ from nailgun.api.v1.handlers.network_configuration \
import NeutronNetworkConfigurationHandler import NeutronNetworkConfigurationHandler
from nailgun.api.handlers.network_configuration \ from nailgun.api.v1.handlers.network_configuration \
import NeutronNetworkConfigurationVerifyHandler import NeutronNetworkConfigurationVerifyHandler
from nailgun.api.handlers.network_configuration \ from nailgun.api.v1.handlers.network_configuration \
import NovaNetworkConfigurationHandler import NovaNetworkConfigurationHandler
from nailgun.api.handlers.network_configuration \ from nailgun.api.v1.handlers.network_configuration \
import NovaNetworkConfigurationVerifyHandler import NovaNetworkConfigurationVerifyHandler
from nailgun.api.handlers.node import NodeAgentHandler from nailgun.api.v1.handlers.node import NodeAgentHandler
from nailgun.api.handlers.node import NodeCollectionHandler from nailgun.api.v1.handlers.node import NodeCollectionHandler
from nailgun.api.handlers.node import NodeHandler from nailgun.api.v1.handlers.node import NodeHandler
from nailgun.api.handlers.node import NodesAllocationStatsHandler from nailgun.api.v1.handlers.node import NodesAllocationStatsHandler
from nailgun.api.handlers.node import NodeCollectionNICsDefaultHandler from nailgun.api.v1.handlers.node import NodeCollectionNICsDefaultHandler
from nailgun.api.handlers.node import NodeCollectionNICsHandler from nailgun.api.v1.handlers.node import NodeCollectionNICsHandler
from nailgun.api.handlers.node import NodeNICsDefaultHandler from nailgun.api.v1.handlers.node import NodeNICsDefaultHandler
from nailgun.api.handlers.node import NodeNICsHandler from nailgun.api.v1.handlers.node import NodeNICsHandler
from nailgun.api.handlers.notifications import NotificationCollectionHandler from nailgun.api.v1.handlers.notifications import NotificationCollectionHandler
from nailgun.api.handlers.notifications import NotificationHandler from nailgun.api.v1.handlers.notifications import NotificationHandler
from nailgun.api.handlers.orchestrator import DefaultDeploymentInfo from nailgun.api.v1.handlers.orchestrator import DefaultDeploymentInfo
from nailgun.api.handlers.orchestrator import DefaultProvisioningInfo from nailgun.api.v1.handlers.orchestrator import DefaultProvisioningInfo
from nailgun.api.handlers.orchestrator import DeploymentInfo from nailgun.api.v1.handlers.orchestrator import DeploymentInfo
from nailgun.api.handlers.orchestrator import DeploySelectedNodes from nailgun.api.v1.handlers.orchestrator import DeploySelectedNodes
from nailgun.api.handlers.orchestrator import ProvisioningInfo from nailgun.api.v1.handlers.orchestrator import ProvisioningInfo
from nailgun.api.handlers.orchestrator import ProvisionSelectedNodes from nailgun.api.v1.handlers.orchestrator import ProvisionSelectedNodes
from nailgun.api.handlers.redhat import RedHatAccountHandler from nailgun.api.v1.handlers.redhat import RedHatAccountHandler
from nailgun.api.handlers.redhat import RedHatSetupHandler from nailgun.api.v1.handlers.redhat import RedHatSetupHandler
from nailgun.api.handlers.registration import FuelKeyHandler from nailgun.api.v1.handlers.registration import FuelKeyHandler
from nailgun.api.handlers.release import ReleaseCollectionHandler from nailgun.api.v1.handlers.release import ReleaseCollectionHandler
from nailgun.api.handlers.release import ReleaseHandler from nailgun.api.v1.handlers.release import ReleaseHandler
from nailgun.api.handlers.tasks import TaskCollectionHandler from nailgun.api.v1.handlers.tasks import TaskCollectionHandler
from nailgun.api.handlers.tasks import TaskHandler from nailgun.api.v1.handlers.tasks import TaskHandler
from nailgun.api.handlers.version import VersionHandler from nailgun.api.v1.handlers.version import VersionHandler
urls = ( urls = (

View File

@ -14,10 +14,10 @@
# under the License. # under the License.
from operator import attrgetter from operator import attrgetter
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.api.validators.json_schema.assignment \ from nailgun.api.v1.validators.json_schema.assignment \
import assignment_format_schema import assignment_format_schema
from nailgun.api.validators.json_schema.assignment \ from nailgun.api.v1.validators.json_schema.assignment \
import unassignment_format_schema import unassignment_format_schema
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import Node from nailgun.db.sqlalchemy.models import Node

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.objects import ClusterCollection from nailgun.objects import ClusterCollection

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.consts import NETWORK_INTERFACE_TYPES from nailgun.consts import NETWORK_INTERFACE_TYPES
from nailgun.consts import OVS_BOND_MODES from nailgun.consts import OVS_BOND_MODES

View File

@ -13,9 +13,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.api.validators.json_schema.disks import disks_simple_format_schema from nailgun.api.v1.validators.json_schema.disks \
from nailgun.api.validators.json_schema.node import node_format_schema import disks_simple_format_schema
from nailgun.api.v1.validators.json_schema.node \
import node_format_schema
from nailgun import consts from nailgun import consts

View File

@ -16,7 +16,7 @@
from nailgun import consts from nailgun import consts
from nailgun import objects from nailgun import objects
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -15,8 +15,8 @@
from sqlalchemy import not_ from sqlalchemy import not_
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.api.validators.cluster import AttributesValidator from nailgun.api.v1.validators.cluster import AttributesValidator
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import Release from nailgun.db.sqlalchemy.models import Release
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -15,7 +15,7 @@
from nailgun import consts from nailgun import consts
from nailgun.api.validators.base import BasicValidator from nailgun.api.v1.validators.base import BasicValidator
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -21,8 +21,8 @@ from web.httpserver import WSGIServer
sys.path.insert(0, os.path.dirname(__file__)) sys.path.insert(0, os.path.dirname(__file__))
from nailgun.api.handlers import forbid_client_caching from nailgun.api.v1.handlers import forbid_client_caching
from nailgun.api.handlers import load_db_driver from nailgun.api.v1.handlers import load_db_driver
from nailgun.db import engine from nailgun.db import engine
from nailgun.logger import HTTPLoggerMiddleware from nailgun.logger import HTTPLoggerMiddleware
from nailgun.logger import logger from nailgun.logger import logger

View File

@ -19,8 +19,8 @@ import json
from nailgun import objects from nailgun import objects
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.api.urls.v1 import urls from nailgun.api.v1.urls import urls
from nailgun.test.base import reverse from nailgun.test.base import reverse

View File

@ -22,12 +22,13 @@ import netaddr
from nailgun import objects from nailgun import objects
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NetworkConfigurationSerializer import NetworkConfigurationSerializer
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NeutronNetworkConfigurationSerializer import NeutronNetworkConfigurationSerializer
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NovaNetworkConfigurationSerializer import NovaNetworkConfigurationSerializer
from nailgun.db.sqlalchemy.models import NetworkGroup from nailgun.db.sqlalchemy.models import NetworkGroup
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.logger import logger from nailgun.logger import logger

View File

@ -25,7 +25,8 @@ from itertools import ifilter
from sqlalchemy.orm import joinedload from sqlalchemy.orm import joinedload
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
from nailgun.db import db from nailgun.db import db
from nailgun.db import NoCacheQuery from nailgun.db import NoCacheQuery
from nailgun.errors import errors from nailgun.errors import errors

View File

@ -18,7 +18,7 @@
Cluster-related objects and collections Cluster-related objects and collections
""" """
from nailgun.api.serializers.cluster import ClusterSerializer from nailgun.objects.serializers.cluster import ClusterSerializer
from nailgun import consts from nailgun import consts

View File

@ -24,7 +24,7 @@ from datetime import datetime
from nailgun import consts from nailgun import consts
from nailgun.api.serializers.node import NodeSerializer from nailgun.objects.serializers.node import NodeSerializer
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy import models from nailgun.db.sqlalchemy import models

View File

@ -27,7 +27,7 @@ from nailgun.objects import NailgunObject
from nailgun.objects import Task from nailgun.objects import Task
from nailgun.api.serializers.notification import NotificationSerializer from nailgun.objects.serializers.notification import NotificationSerializer
class Notification(NailgunObject): class Notification(NailgunObject):

View File

@ -22,7 +22,7 @@ from sqlalchemy import not_
from nailgun import consts from nailgun import consts
from nailgun.api.serializers.release import ReleaseSerializer from nailgun.objects.serializers.release import ReleaseSerializer
from nailgun.db import db from nailgun.db import db

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class ClusterSerializer(BasicSerializer): class ClusterSerializer(BasicSerializer):

View File

@ -16,7 +16,7 @@
from nailgun import objects from nailgun import objects
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class NetworkConfigurationSerializer(BasicSerializer): class NetworkConfigurationSerializer(BasicSerializer):

View File

@ -16,7 +16,7 @@
from nailgun import consts from nailgun import consts
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class NodeSerializer(BasicSerializer): class NodeSerializer(BasicSerializer):

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class NotificationSerializer(BasicSerializer): class NotificationSerializer(BasicSerializer):

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class ReleaseSerializer(BasicSerializer): class ReleaseSerializer(BasicSerializer):

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.serializers.base import BasicSerializer from nailgun.objects.serializers.base import BasicSerializer
class TaskSerializer(BasicSerializer): class TaskSerializer(BasicSerializer):

View File

@ -15,7 +15,7 @@
# under the License. # under the License.
from nailgun.api.serializers.task import TaskSerializer from nailgun.objects.serializers.task import TaskSerializer
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy import models from nailgun.db.sqlalchemy import models

View File

@ -17,10 +17,11 @@
import json import json
import traceback import traceback
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NeutronNetworkConfigurationSerializer import NeutronNetworkConfigurationSerializer
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NovaNetworkConfigurationSerializer import NovaNetworkConfigurationSerializer
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy.models import Cluster from nailgun.db.sqlalchemy.models import Cluster
from nailgun.db.sqlalchemy.models import RedHatAccount from nailgun.db.sqlalchemy.models import RedHatAccount

View File

@ -36,7 +36,7 @@ import web
from webtest import app from webtest import app
import nailgun import nailgun
from nailgun.api.urls.v1 import urls from nailgun.api.v1.urls import urls
from nailgun.db import db from nailgun.db import db
from nailgun.db import flush from nailgun.db import flush

View File

@ -21,7 +21,7 @@ from inspect import getmembers
from inspect import isclass from inspect import isclass
from inspect import ismethod from inspect import ismethod
from nailgun.api.urls.v1 import urls from nailgun.api.v1.urls import urls
from nailgun.autoapidoc import SampleGenerator from nailgun.autoapidoc import SampleGenerator
from nailgun.test.base import BaseIntegrationTest from nailgun.test.base import BaseIntegrationTest
@ -54,7 +54,7 @@ class TestAPIDocGeneration(BaseIntegrationTest):
def test_url_generator(self): def test_url_generator(self):
path = os.path.dirname(os.path.realpath(__file__)) path = os.path.dirname(os.path.realpath(__file__))
path = ('/'.join(path.split('/')[:-2])) + "/api/handlers/" path = ('/'.join(path.split('/')[:-2])) + "/api/v1/handlers/"
classes = self.load_from_path(path) classes = self.load_from_path(path)
names = set() names = set()
unique_classes = [] unique_classes = []

View File

@ -65,7 +65,7 @@ class TestHandlers(BaseIntegrationTest):
self.assertEquals(report['allocation_stats']['allocated'], 0) self.assertEquals(report['allocation_stats']['allocated'], 0)
self.assertEquals(report['allocation_stats']['unallocated'], 1) self.assertEquals(report['allocation_stats']['unallocated'], 1)
@patch('nailgun.api.handlers.version.settings.VERSION', { @patch('nailgun.api.v1.handlers.version.settings.VERSION', {
'release': '0.1b'}) 'release': '0.1b'})
def test_capacity_csv_checksum(self): def test_capacity_csv_checksum(self):
self._create_capacity_log() self._create_capacity_log()

View File

@ -16,10 +16,11 @@
import json import json
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NeutronNetworkConfigurationSerializer import NeutronNetworkConfigurationSerializer
from nailgun.api.serializers.network_configuration \ from nailgun.objects.serializers.network_configuration \
import NovaNetworkConfigurationSerializer import NovaNetworkConfigurationSerializer
from nailgun.db.sqlalchemy.models import NeutronConfig from nailgun.db.sqlalchemy.models import NeutronConfig
from nailgun.db.sqlalchemy.models import NovaNetworkConfig from nailgun.db.sqlalchemy.models import NovaNetworkConfig
from nailgun.test.base import BaseIntegrationTest from nailgun.test.base import BaseIntegrationTest

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.assignment import NodeAssignmentValidator from nailgun.api.v1.validators.assignment import NodeAssignmentValidator
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.test.base import BaseUnitTest from nailgun.test.base import BaseUnitTest

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.cluster import AttributesValidator from nailgun.api.v1.validators.cluster import AttributesValidator
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.test.base import BaseTestCase from nailgun.test.base import BaseTestCase

View File

@ -18,7 +18,7 @@ from contextlib import nested
from mock import Mock from mock import Mock
from mock import patch from mock import patch
from nailgun.api.validators.cluster import ClusterValidator from nailgun.api.v1.validators.cluster import ClusterValidator
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.test.base import BaseTestCase from nailgun.test.base import BaseTestCase
@ -30,7 +30,7 @@ class TestClusterValidator(BaseTestCase):
def test_cluster_exists_validation(self): def test_cluster_exists_validation(self):
with patch( with patch(
'nailgun.api.validators.cluster.ClusterCollection', 'nailgun.api.v1.validators.cluster.ClusterCollection',
Mock() Mock()
) as cc: ) as cc:
cc.filter_by.return_value.first.return_value = 'cluster' cc.filter_by.return_value.first.return_value = 'cluster'
@ -39,8 +39,11 @@ class TestClusterValidator(BaseTestCase):
def test_cluster_non_exists_validation(self): def test_cluster_non_exists_validation(self):
with nested( with nested(
patch('nailgun.api.validators.cluster.ClusterCollection', Mock()), patch(
patch('nailgun.api.validators.cluster.Release', Mock()) 'nailgun.api.v1.validators.cluster.ClusterCollection',
Mock()
),
patch('nailgun.api.v1.validators.cluster.Release', Mock())
) as (cc, r): ) as (cc, r):
try: try:
cc.filter_by.return_value.first.return_value = None cc.filter_by.return_value.first.return_value = None
@ -53,7 +56,7 @@ class TestClusterValidator(BaseTestCase):
def test_release_exists_validation(self): def test_release_exists_validation(self):
with patch( with patch(
'nailgun.api.validators.cluster.ClusterCollection', 'nailgun.api.v1.validators.cluster.ClusterCollection',
Mock() Mock()
) as cc: ) as cc:
cc.filter_by.return_value.first.return_value = None cc.filter_by.return_value.first.return_value = None
@ -61,7 +64,7 @@ class TestClusterValidator(BaseTestCase):
ClusterValidator.validate, self.cluster_data) ClusterValidator.validate, self.cluster_data)
def test_release_non_exists_validation(self): def test_release_non_exists_validation(self):
with patch('nailgun.api.validators.cluster.Release', Mock()) as r: with patch('nailgun.api.v1.validators.cluster.Release', Mock()) as r:
try: try:
r.get_by_uuid.return_value = None r.get_by_uuid.return_value = None
ClusterValidator.validate(self.cluster_data) ClusterValidator.validate(self.cluster_data)

View File

@ -24,11 +24,11 @@ from nailgun.test.base import reverse
class TestFuelKeyHandler(BaseTestCase): class TestFuelKeyHandler(BaseTestCase):
@patch('nailgun.api.handlers.version.settings.VERSION', { @patch('nailgun.api.v1.handlers.version.settings.VERSION', {
'release': '0.1', 'release': '0.1',
'nailgun_sha': '12345' 'nailgun_sha': '12345'
}) })
@patch('nailgun.api.handlers.version.settings.FUEL_KEY', 'uuid') @patch('nailgun.api.v1.handlers.version.settings.FUEL_KEY', 'uuid')
def test_version_handler(self): def test_version_handler(self):
resp = self.app.get( resp = self.app.get(
reverse('FuelKeyHandler'), reverse('FuelKeyHandler'),

View File

@ -16,7 +16,7 @@
import web import web
from nailgun.api.handlers.base import BaseHandler from nailgun.api.v1.handlers.base import BaseHandler
from nailgun.test.base import BaseIntegrationTest from nailgun.test.base import BaseIntegrationTest
from nailgun.test.base import reverse from nailgun.test.base import reverse

View File

@ -19,7 +19,7 @@ import unittest
import web import web
from nailgun.api.handlers import load_db_driver from nailgun.api.v1.handlers import load_db_driver
from nailgun.db import db from nailgun.db import db
from nailgun.db.sqlalchemy import models from nailgun.db.sqlalchemy import models

View File

@ -24,7 +24,7 @@ from mock import Mock
from mock import patch from mock import patch
import nailgun import nailgun
from nailgun.api.handlers.logs import read_backwards from nailgun.api.v1.handlers.logs import read_backwards
from nailgun.db.sqlalchemy.models import RedHatAccount from nailgun.db.sqlalchemy.models import RedHatAccount
from nailgun.db.sqlalchemy.models import Role from nailgun.db.sqlalchemy.models import Role
from nailgun.errors import errors from nailgun.errors import errors
@ -332,8 +332,8 @@ class TestLogs(BaseIntegrationTest):
"id": 1, "id": 1,
"uuid": "00000000-0000-0000-0000-000000000000" "uuid": "00000000-0000-0000-0000-000000000000"
}) })
tm_patcher = patch('nailgun.api.handlers.logs.DumpTaskManager') tm_patcher = patch('nailgun.api.v1.handlers.logs.DumpTaskManager')
th_patcher = patch('nailgun.api.handlers.logs.Task') th_patcher = patch('nailgun.api.v1.handlers.logs.Task')
tm_mocked = tm_patcher.start() tm_mocked = tm_patcher.start()
th_mocked = th_patcher.start() th_mocked = th_patcher.start()
tm_instance = tm_mocked.return_value tm_instance = tm_mocked.return_value
@ -348,7 +348,7 @@ class TestLogs(BaseIntegrationTest):
self.assertEquals(resp.status_code, 202) self.assertEquals(resp.status_code, 202)
def test_log_package_handler_failed(self): def test_log_package_handler_failed(self):
tm_patcher = patch('nailgun.api.handlers.logs.DumpTaskManager') tm_patcher = patch('nailgun.api.v1.handlers.logs.DumpTaskManager')
tm_mocked = tm_patcher.start() tm_mocked = tm_patcher.start()
tm_instance = tm_mocked.return_value tm_instance = tm_mocked.return_value
@ -397,7 +397,7 @@ class TestLogs(BaseIntegrationTest):
response['entries'].reverse() response['entries'].reverse()
self.assertEquals(response['entries'], response_log_entries) self.assertEquals(response['entries'], response_log_entries)
@patch('nailgun.api.handlers.logs.DumpTaskManager') @patch('nailgun.api.v1.handlers.logs.DumpTaskManager')
def test_log_package_handler_with_dump_task_manager_error(self, def test_log_package_handler_with_dump_task_manager_error(self,
dump_manager): dump_manager):
"""Test verifies that 400 status would be returned in case of errors """Test verifies that 400 status would be returned in case of errors

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.validators.redhat import RedHatAccountValidator from nailgun.api.v1.validators.redhat import RedHatAccountValidator
from nailgun.errors import errors from nailgun.errors import errors
from nailgun.test.base import BaseTestCase from nailgun.test.base import BaseTestCase

View File

@ -18,7 +18,7 @@ from mock import Mock
from mock import patch from mock import patch
import nailgun import nailgun
from nailgun.api.handlers.redhat import RedHatSetupHandler from nailgun.api.v1.handlers.redhat import RedHatSetupHandler
from nailgun.db.sqlalchemy.models import RedHatAccount from nailgun.db.sqlalchemy.models import RedHatAccount
from nailgun.db.sqlalchemy.models import Task from nailgun.db.sqlalchemy.models import Task
from nailgun.task.manager import RedHatSetupTaskManager from nailgun.task.manager import RedHatSetupTaskManager
@ -72,8 +72,8 @@ class TestHandlers(BaseIntegrationTest):
@fake_tasks() @fake_tasks()
def test_redhat_account_validation_success(self): def test_redhat_account_validation_success(self):
with patch('nailgun.api.handlers.redhat.db', Mock()): with patch('nailgun.api.v1.handlers.redhat.db', Mock()):
manager = 'nailgun.api.handlers.redhat.RedHatSetupTaskManager' manager = 'nailgun.api.v1.handlers.redhat.RedHatSetupTaskManager'
with patch(manager, Mock()) as mng: with patch(manager, Mock()) as mng:
task = Task() task = Task()
task.id = 0 task.id = 0

View File

@ -23,7 +23,7 @@ from nailgun.test.base import reverse
class TestVersionHandler(BaseIntegrationTest): class TestVersionHandler(BaseIntegrationTest):
@patch('nailgun.api.handlers.version.settings.VERSION', { @patch('nailgun.api.v1.handlers.version.settings.VERSION', {
'release': '0.1b', 'release': '0.1b',
'nailgun_sha': '12345', 'nailgun_sha': '12345',
"astute_sha": "Unknown build", "astute_sha": "Unknown build",

View File

@ -14,13 +14,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from nailgun.api.urls import v1 from nailgun.api.v1 import urls as api_urls
from nailgun.webui import urls as webui_urls from nailgun.webui import urls as webui_urls
def urls(): def urls():
return ( return (
"/api/v1", v1.app(), "/api/v1", api_urls.app(),
"/api", v1.app(), "/api", api_urls.app(),
"", webui_urls.app() "", webui_urls.app()
) )