Browse Source

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
changes/76/256376/3
Boden R 6 years ago
parent
commit
70fa532032
  1. 3
      setup.cfg
  2. 18
      tools/python_nsxadmin/admin/__init__.py
  3. 5
      vmware_nsx/shell/__init__.py
  4. 0
      vmware_nsx/shell/admin/README.rst
  5. 0
      vmware_nsx/shell/admin/__init__.py
  6. 0
      vmware_nsx/shell/admin/plugins/__init__.py
  7. 0
      vmware_nsx/shell/admin/plugins/common/__init__.py
  8. 0
      vmware_nsx/shell/admin/plugins/common/constants.py
  9. 0
      vmware_nsx/shell/admin/plugins/common/formatters.py
  10. 0
      vmware_nsx/shell/admin/plugins/common/utils.py
  11. 0
      vmware_nsx/shell/admin/plugins/nsxv/__init__.py
  12. 0
      vmware_nsx/shell/admin/plugins/nsxv/resources/__init__.py
  13. 10
      vmware_nsx/shell/admin/plugins/nsxv/resources/backup_edges.py
  14. 8
      vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py
  15. 10
      vmware_nsx/shell/admin/plugins/nsxv/resources/edges.py
  16. 10
      vmware_nsx/shell/admin/plugins/nsxv/resources/spoofguard_policy.py
  17. 0
      vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py
  18. 0
      vmware_nsx/shell/admin/plugins/nsxv3/__init__.py
  19. 0
      vmware_nsx/shell/admin/plugins/nsxv3/resources/__init__.py
  20. 8
      vmware_nsx/shell/admin/plugins/nsxv3/resources/securitygroups.py
  21. 0
      vmware_nsx/shell/admin/version.py
  22. 8
      vmware_nsx/shell/nsxadmin.py

3
setup.cfg

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

18
tools/python_nsxadmin/admin/__init__.py

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

5
vmware_nsx/shell/__init__.py

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

0
tools/python_nsxadmin/README.rst → vmware_nsx/shell/admin/README.rst

0
tools/python_nsxadmin/__init__.py → vmware_nsx/shell/admin/__init__.py

0
tools/python_nsxadmin/admin/plugins/__init__.py → vmware_nsx/shell/admin/plugins/__init__.py

0
tools/python_nsxadmin/admin/plugins/common/__init__.py → vmware_nsx/shell/admin/plugins/common/__init__.py

0
tools/python_nsxadmin/admin/plugins/common/constants.py → vmware_nsx/shell/admin/plugins/common/constants.py

0
tools/python_nsxadmin/admin/plugins/common/formatters.py → vmware_nsx/shell/admin/plugins/common/formatters.py

0
tools/python_nsxadmin/admin/plugins/common/utils.py → vmware_nsx/shell/admin/plugins/common/utils.py

0
tools/python_nsxadmin/admin/plugins/nsxv/__init__.py → vmware_nsx/shell/admin/plugins/nsxv/__init__.py

0
tools/python_nsxadmin/admin/plugins/nsxv/resources/__init__.py → vmware_nsx/shell/admin/plugins/nsxv/resources/__init__.py

10
tools/python_nsxadmin/admin/plugins/nsxv/resources/backup_edges.py → vmware_nsx/shell/admin/plugins/nsxv/resources/backup_edges.py

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

8
tools/python_nsxadmin/admin/plugins/nsxv/resources/dhcp_binding.py → vmware_nsx/shell/admin/plugins/nsxv/resources/dhcp_binding.py

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

10
tools/python_nsxadmin/admin/plugins/nsxv/resources/edges.py → vmware_nsx/shell/admin/plugins/nsxv/resources/edges.py

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

10
tools/python_nsxadmin/admin/plugins/nsxv/resources/spoofguard_policy.py → vmware_nsx/shell/admin/plugins/nsxv/resources/spoofguard_policy.py

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

0
tools/python_nsxadmin/admin/plugins/nsxv/resources/utils.py → vmware_nsx/shell/admin/plugins/nsxv/resources/utils.py

0
tools/python_nsxadmin/admin/plugins/nsxv3/__init__.py → vmware_nsx/shell/admin/plugins/nsxv3/__init__.py

0
tools/python_nsxadmin/admin/plugins/nsxv3/resources/__init__.py → vmware_nsx/shell/admin/plugins/nsxv3/resources/__init__.py

8
tools/python_nsxadmin/admin/plugins/nsxv3/resources/securitygroups.py → vmware_nsx/shell/admin/plugins/nsxv3/resources/securitygroups.py

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

0
tools/python_nsxadmin/admin/version.py → vmware_nsx/shell/admin/version.py

8
tools/python_nsxadmin/admin/shell.py → vmware_nsx/shell/nsxadmin.py

@ -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()))
Loading…
Cancel
Save