Move python_nsxadmin out of a top-level namespace

It is not a good idea to have a top-level "tools" namespace, this
name is too generic and already taken in PyPi (see
https://pypi.python.org/pypi/tools).

This patch moves python_nsxadmin to the vmware_nsx.tools namespace,
adjusting all imports and making sure setup.cfg is adapted
accordingly.

Change-Id: I75922db2010194fe59db424cc4615c7ba57c1b81
This commit is contained in:
Boden R 2015-12-17 15:34:45 -07:00
parent 9595e99ad9
commit 70fa532032
22 changed files with 32 additions and 48 deletions

View File

@ -21,14 +21,13 @@ classifier =
[files]
packages =
vmware_nsx
tools
data_files =
etc/neutron/plugins/vmware = etc/nsx.ini
[entry_points]
console_scripts =
neutron-check-nsx-config = vmware_nsx.check_nsx_config:main
nsxadmin = tools.python_nsxadmin.admin.shell:main
nsxadmin = vmware_nsx.shell.nsxadmin:main
neutron.db.alembic_migrations =
vmware-nsx = vmware_nsx.db.migration:alembic_migrations
neutron.core_plugins =

View File

@ -1,18 +0,0 @@
# Copyright 2015 VMware, Inc. 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.
import logging
logging.basicConfig(format='%(message)s', level=logging.INFO)
logging.getLogger('requests').setLevel(logging.WARNING)

View File

@ -13,12 +13,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
import sys
from neutronclient import shell
from vmware_nsx.shell import commands as cmd
logging.basicConfig(format='%(message)s', level=logging.INFO)
logging.getLogger('requests').setLevel(logging.WARNING)
class NsxManage(shell.NeutronShell):

View File

@ -15,12 +15,12 @@
import logging
from tools.python_nsxadmin.admin.plugins.common import constants
from tools.python_nsxadmin.admin.plugins.common import formatters
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import tools.python_nsxadmin.admin.plugins.common.utils as admin_utils
import tools.python_nsxadmin.admin.plugins.nsxv.resources.utils as utils
import tools.python_nsxadmin.admin.shell as shell
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
import vmware_nsx.shell.nsxadmin as shell
from neutron.callbacks import registry
from neutron.common import exceptions

View File

@ -16,11 +16,11 @@
import logging
import pprint
from tools.python_nsxadmin.admin.plugins.common import constants
import tools.python_nsxadmin.admin.plugins.common.utils as admin_utils
import tools.python_nsxadmin.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.common import constants
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
import tools.python_nsxadmin.admin.shell as shell
import vmware_nsx.shell.nsxadmin as shell
from neutron.callbacks import registry
from neutron.db import db_base_plugin_v2

View File

@ -16,12 +16,12 @@
import logging
import pprint
from tools.python_nsxadmin.admin.plugins.common import constants
from tools.python_nsxadmin.admin.plugins.common import formatters
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import tools.python_nsxadmin.admin.plugins.common.utils as admin_utils
import tools.python_nsxadmin.admin.plugins.nsxv.resources.utils as utils
import tools.python_nsxadmin.admin.shell as shell
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
import vmware_nsx.shell.nsxadmin as shell
from neutron.callbacks import registry
from neutron.common import exceptions

View File

@ -15,13 +15,13 @@
import logging
from tools.python_nsxadmin.admin.plugins.common import constants
from tools.python_nsxadmin.admin.plugins.common import formatters
import tools.python_nsxadmin.admin.plugins.common.utils as admin_utils
import tools.python_nsxadmin.admin.plugins.nsxv.resources.utils as utils
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
import tools.python_nsxadmin.admin.shell as shell
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
import vmware_nsx.shell.nsxadmin as shell
from neutron.callbacks import registry

View File

@ -14,10 +14,10 @@
import logging
from tools.python_nsxadmin.admin.plugins.common import constants
from tools.python_nsxadmin.admin.plugins.common import formatters
from tools.python_nsxadmin.admin.plugins.common import utils as admin_utils
from tools.python_nsxadmin.admin import shell
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
from vmware_nsx.shell.admin.plugins.common import utils as admin_utils
from vmware_nsx.shell import nsxadmin as shell
from neutron.callbacks import registry
from neutron import context as neutron_context

View File

@ -41,8 +41,8 @@ from vmware_nsx.common import config # noqa
from oslo_config import cfg
from oslo_log import _options
from tools.python_nsxadmin.admin.plugins.common import constants
from tools.python_nsxadmin.admin import version
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin import version
# Suppress the Insecure request warning
requests.packages.urllib3.disable_warnings()
@ -110,7 +110,7 @@ def _get_plugin():
def _get_plugin_dir():
plugin_dir = os.path.dirname(os.path.realpath(__file__)) + "/plugins"
plugin_dir = os.path.dirname(os.path.realpath(__file__)) + "/admin/plugins"
return '{}/{}/resources'.format(plugin_dir, _get_plugin())
@ -151,7 +151,7 @@ def _init_resource_plugin():
for resource in resources:
if resource != '__init__':
importlib.import_module("." + resource,
"tools.python_nsxadmin.admin.plugins."
"vmware_nsx.shell.admin.plugins."
"{}.resources".format(_get_plugin()))