diff --git a/.coveragerc b/.coveragerc index 37585cd..e40c062 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,4 +4,4 @@ exclude_lines = if __name__ == .__main__.: include= hooks/swift_storage_* - + lib/swift_storage_* diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index a6f7000..c35ab4c --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ PYTHON := /usr/bin/env python lint: - @flake8 --exclude hooks/charmhelpers hooks - @flake8 --exclude hooks/charmhelpers unit_tests tests + @flake8 lib + @flake8 hooks + @flake8 unit_tests tests @charm proof unit_test: diff --git a/charm-helpers-hooks.yaml b/charm-helpers-hooks.yaml index e6ab8ff..450e250 100644 --- a/charm-helpers-hooks.yaml +++ b/charm-helpers-hooks.yaml @@ -1,5 +1,5 @@ branch: lp:charm-helpers -destination: hooks/charmhelpers +destination: charmhelpers include: - core - cli diff --git a/hooks/charmhelpers/__init__.py b/charmhelpers/__init__.py similarity index 100% rename from hooks/charmhelpers/__init__.py rename to charmhelpers/__init__.py diff --git a/hooks/charmhelpers/cli/__init__.py b/charmhelpers/cli/__init__.py similarity index 100% rename from hooks/charmhelpers/cli/__init__.py rename to charmhelpers/cli/__init__.py diff --git a/hooks/charmhelpers/cli/benchmark.py b/charmhelpers/cli/benchmark.py similarity index 100% rename from hooks/charmhelpers/cli/benchmark.py rename to charmhelpers/cli/benchmark.py diff --git a/hooks/charmhelpers/cli/commands.py b/charmhelpers/cli/commands.py similarity index 100% rename from hooks/charmhelpers/cli/commands.py rename to charmhelpers/cli/commands.py diff --git a/hooks/charmhelpers/cli/host.py b/charmhelpers/cli/host.py similarity index 100% rename from hooks/charmhelpers/cli/host.py rename to charmhelpers/cli/host.py diff --git a/hooks/charmhelpers/cli/unitdata.py b/charmhelpers/cli/unitdata.py similarity index 100% rename from hooks/charmhelpers/cli/unitdata.py rename to charmhelpers/cli/unitdata.py diff --git a/hooks/charmhelpers/contrib/__init__.py b/charmhelpers/contrib/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/__init__.py rename to charmhelpers/contrib/__init__.py diff --git a/hooks/charmhelpers/contrib/charmsupport/__init__.py b/charmhelpers/contrib/charmsupport/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/charmsupport/__init__.py rename to charmhelpers/contrib/charmsupport/__init__.py diff --git a/hooks/charmhelpers/contrib/charmsupport/nrpe.py b/charmhelpers/contrib/charmsupport/nrpe.py similarity index 100% rename from hooks/charmhelpers/contrib/charmsupport/nrpe.py rename to charmhelpers/contrib/charmsupport/nrpe.py diff --git a/hooks/charmhelpers/contrib/charmsupport/volumes.py b/charmhelpers/contrib/charmsupport/volumes.py similarity index 100% rename from hooks/charmhelpers/contrib/charmsupport/volumes.py rename to charmhelpers/contrib/charmsupport/volumes.py diff --git a/hooks/charmhelpers/contrib/hahelpers/__init__.py b/charmhelpers/contrib/hahelpers/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/hahelpers/__init__.py rename to charmhelpers/contrib/hahelpers/__init__.py diff --git a/hooks/charmhelpers/contrib/hahelpers/apache.py b/charmhelpers/contrib/hahelpers/apache.py similarity index 100% rename from hooks/charmhelpers/contrib/hahelpers/apache.py rename to charmhelpers/contrib/hahelpers/apache.py diff --git a/hooks/charmhelpers/contrib/hahelpers/ceph.py b/charmhelpers/contrib/hahelpers/ceph.py similarity index 100% rename from hooks/charmhelpers/contrib/hahelpers/ceph.py rename to charmhelpers/contrib/hahelpers/ceph.py diff --git a/hooks/charmhelpers/contrib/hahelpers/cluster.py b/charmhelpers/contrib/hahelpers/cluster.py similarity index 100% rename from hooks/charmhelpers/contrib/hahelpers/cluster.py rename to charmhelpers/contrib/hahelpers/cluster.py diff --git a/hooks/charmhelpers/contrib/network/__init__.py b/charmhelpers/contrib/network/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/network/__init__.py rename to charmhelpers/contrib/network/__init__.py diff --git a/hooks/charmhelpers/contrib/network/ip.py b/charmhelpers/contrib/network/ip.py similarity index 100% rename from hooks/charmhelpers/contrib/network/ip.py rename to charmhelpers/contrib/network/ip.py diff --git a/hooks/charmhelpers/contrib/openstack/__init__.py b/charmhelpers/contrib/openstack/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/__init__.py rename to charmhelpers/contrib/openstack/__init__.py diff --git a/hooks/charmhelpers/contrib/openstack/alternatives.py b/charmhelpers/contrib/openstack/alternatives.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/alternatives.py rename to charmhelpers/contrib/openstack/alternatives.py diff --git a/hooks/charmhelpers/contrib/openstack/amulet/__init__.py b/charmhelpers/contrib/openstack/amulet/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/amulet/__init__.py rename to charmhelpers/contrib/openstack/amulet/__init__.py diff --git a/hooks/charmhelpers/contrib/openstack/amulet/deployment.py b/charmhelpers/contrib/openstack/amulet/deployment.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/amulet/deployment.py rename to charmhelpers/contrib/openstack/amulet/deployment.py diff --git a/hooks/charmhelpers/contrib/openstack/amulet/utils.py b/charmhelpers/contrib/openstack/amulet/utils.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/amulet/utils.py rename to charmhelpers/contrib/openstack/amulet/utils.py diff --git a/hooks/charmhelpers/contrib/openstack/context.py b/charmhelpers/contrib/openstack/context.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/context.py rename to charmhelpers/contrib/openstack/context.py diff --git a/hooks/charmhelpers/contrib/openstack/files/__init__.py b/charmhelpers/contrib/openstack/files/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/files/__init__.py rename to charmhelpers/contrib/openstack/files/__init__.py diff --git a/hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh b/charmhelpers/contrib/openstack/files/check_haproxy.sh similarity index 100% rename from hooks/charmhelpers/contrib/openstack/files/check_haproxy.sh rename to charmhelpers/contrib/openstack/files/check_haproxy.sh diff --git a/hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh b/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh similarity index 100% rename from hooks/charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh rename to charmhelpers/contrib/openstack/files/check_haproxy_queue_depth.sh diff --git a/hooks/charmhelpers/contrib/openstack/ip.py b/charmhelpers/contrib/openstack/ip.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/ip.py rename to charmhelpers/contrib/openstack/ip.py diff --git a/hooks/charmhelpers/contrib/openstack/neutron.py b/charmhelpers/contrib/openstack/neutron.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/neutron.py rename to charmhelpers/contrib/openstack/neutron.py diff --git a/hooks/charmhelpers/contrib/openstack/templates/__init__.py b/charmhelpers/contrib/openstack/templates/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/__init__.py rename to charmhelpers/contrib/openstack/templates/__init__.py diff --git a/hooks/charmhelpers/contrib/openstack/templates/ceph.conf b/charmhelpers/contrib/openstack/templates/ceph.conf similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/ceph.conf rename to charmhelpers/contrib/openstack/templates/ceph.conf diff --git a/hooks/charmhelpers/contrib/openstack/templates/git.upstart b/charmhelpers/contrib/openstack/templates/git.upstart similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/git.upstart rename to charmhelpers/contrib/openstack/templates/git.upstart diff --git a/hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg b/charmhelpers/contrib/openstack/templates/haproxy.cfg similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg rename to charmhelpers/contrib/openstack/templates/haproxy.cfg diff --git a/hooks/charmhelpers/contrib/openstack/templates/openstack_https_frontend b/charmhelpers/contrib/openstack/templates/openstack_https_frontend similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/openstack_https_frontend rename to charmhelpers/contrib/openstack/templates/openstack_https_frontend diff --git a/hooks/charmhelpers/contrib/openstack/templates/openstack_https_frontend.conf b/charmhelpers/contrib/openstack/templates/openstack_https_frontend.conf similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/openstack_https_frontend.conf rename to charmhelpers/contrib/openstack/templates/openstack_https_frontend.conf diff --git a/hooks/charmhelpers/contrib/openstack/templates/section-keystone-authtoken b/charmhelpers/contrib/openstack/templates/section-keystone-authtoken similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/section-keystone-authtoken rename to charmhelpers/contrib/openstack/templates/section-keystone-authtoken diff --git a/hooks/charmhelpers/contrib/openstack/templates/section-rabbitmq-oslo b/charmhelpers/contrib/openstack/templates/section-rabbitmq-oslo similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/section-rabbitmq-oslo rename to charmhelpers/contrib/openstack/templates/section-rabbitmq-oslo diff --git a/hooks/charmhelpers/contrib/openstack/templates/section-zeromq b/charmhelpers/contrib/openstack/templates/section-zeromq similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templates/section-zeromq rename to charmhelpers/contrib/openstack/templates/section-zeromq diff --git a/hooks/charmhelpers/contrib/openstack/templating.py b/charmhelpers/contrib/openstack/templating.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/templating.py rename to charmhelpers/contrib/openstack/templating.py diff --git a/hooks/charmhelpers/contrib/openstack/utils.py b/charmhelpers/contrib/openstack/utils.py similarity index 100% rename from hooks/charmhelpers/contrib/openstack/utils.py rename to charmhelpers/contrib/openstack/utils.py diff --git a/hooks/charmhelpers/contrib/python/__init__.py b/charmhelpers/contrib/python/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/python/__init__.py rename to charmhelpers/contrib/python/__init__.py diff --git a/hooks/charmhelpers/contrib/python/packages.py b/charmhelpers/contrib/python/packages.py similarity index 100% rename from hooks/charmhelpers/contrib/python/packages.py rename to charmhelpers/contrib/python/packages.py diff --git a/hooks/charmhelpers/contrib/storage/__init__.py b/charmhelpers/contrib/storage/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/__init__.py rename to charmhelpers/contrib/storage/__init__.py diff --git a/hooks/charmhelpers/contrib/storage/linux/__init__.py b/charmhelpers/contrib/storage/linux/__init__.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/linux/__init__.py rename to charmhelpers/contrib/storage/linux/__init__.py diff --git a/hooks/charmhelpers/contrib/storage/linux/ceph.py b/charmhelpers/contrib/storage/linux/ceph.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/linux/ceph.py rename to charmhelpers/contrib/storage/linux/ceph.py diff --git a/hooks/charmhelpers/contrib/storage/linux/loopback.py b/charmhelpers/contrib/storage/linux/loopback.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/linux/loopback.py rename to charmhelpers/contrib/storage/linux/loopback.py diff --git a/hooks/charmhelpers/contrib/storage/linux/lvm.py b/charmhelpers/contrib/storage/linux/lvm.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/linux/lvm.py rename to charmhelpers/contrib/storage/linux/lvm.py diff --git a/hooks/charmhelpers/contrib/storage/linux/utils.py b/charmhelpers/contrib/storage/linux/utils.py similarity index 100% rename from hooks/charmhelpers/contrib/storage/linux/utils.py rename to charmhelpers/contrib/storage/linux/utils.py diff --git a/hooks/charmhelpers/core/__init__.py b/charmhelpers/core/__init__.py similarity index 100% rename from hooks/charmhelpers/core/__init__.py rename to charmhelpers/core/__init__.py diff --git a/hooks/charmhelpers/core/decorators.py b/charmhelpers/core/decorators.py similarity index 100% rename from hooks/charmhelpers/core/decorators.py rename to charmhelpers/core/decorators.py diff --git a/hooks/charmhelpers/core/files.py b/charmhelpers/core/files.py similarity index 100% rename from hooks/charmhelpers/core/files.py rename to charmhelpers/core/files.py diff --git a/hooks/charmhelpers/core/fstab.py b/charmhelpers/core/fstab.py similarity index 100% rename from hooks/charmhelpers/core/fstab.py rename to charmhelpers/core/fstab.py diff --git a/hooks/charmhelpers/core/hookenv.py b/charmhelpers/core/hookenv.py similarity index 100% rename from hooks/charmhelpers/core/hookenv.py rename to charmhelpers/core/hookenv.py diff --git a/hooks/charmhelpers/core/host.py b/charmhelpers/core/host.py similarity index 100% rename from hooks/charmhelpers/core/host.py rename to charmhelpers/core/host.py diff --git a/hooks/charmhelpers/core/services/__init__.py b/charmhelpers/core/services/__init__.py similarity index 100% rename from hooks/charmhelpers/core/services/__init__.py rename to charmhelpers/core/services/__init__.py diff --git a/hooks/charmhelpers/core/services/base.py b/charmhelpers/core/services/base.py similarity index 100% rename from hooks/charmhelpers/core/services/base.py rename to charmhelpers/core/services/base.py diff --git a/hooks/charmhelpers/core/services/helpers.py b/charmhelpers/core/services/helpers.py similarity index 100% rename from hooks/charmhelpers/core/services/helpers.py rename to charmhelpers/core/services/helpers.py diff --git a/hooks/charmhelpers/core/strutils.py b/charmhelpers/core/strutils.py similarity index 100% rename from hooks/charmhelpers/core/strutils.py rename to charmhelpers/core/strutils.py diff --git a/hooks/charmhelpers/core/sysctl.py b/charmhelpers/core/sysctl.py similarity index 100% rename from hooks/charmhelpers/core/sysctl.py rename to charmhelpers/core/sysctl.py diff --git a/hooks/charmhelpers/core/templating.py b/charmhelpers/core/templating.py similarity index 100% rename from hooks/charmhelpers/core/templating.py rename to charmhelpers/core/templating.py diff --git a/hooks/charmhelpers/core/unitdata.py b/charmhelpers/core/unitdata.py similarity index 100% rename from hooks/charmhelpers/core/unitdata.py rename to charmhelpers/core/unitdata.py diff --git a/hooks/charmhelpers/fetch/__init__.py b/charmhelpers/fetch/__init__.py similarity index 100% rename from hooks/charmhelpers/fetch/__init__.py rename to charmhelpers/fetch/__init__.py diff --git a/hooks/charmhelpers/fetch/archiveurl.py b/charmhelpers/fetch/archiveurl.py similarity index 100% rename from hooks/charmhelpers/fetch/archiveurl.py rename to charmhelpers/fetch/archiveurl.py diff --git a/hooks/charmhelpers/fetch/bzrurl.py b/charmhelpers/fetch/bzrurl.py similarity index 100% rename from hooks/charmhelpers/fetch/bzrurl.py rename to charmhelpers/fetch/bzrurl.py diff --git a/hooks/charmhelpers/fetch/giturl.py b/charmhelpers/fetch/giturl.py similarity index 100% rename from hooks/charmhelpers/fetch/giturl.py rename to charmhelpers/fetch/giturl.py diff --git a/hooks/charmhelpers/payload/__init__.py b/charmhelpers/payload/__init__.py similarity index 100% rename from hooks/charmhelpers/payload/__init__.py rename to charmhelpers/payload/__init__.py diff --git a/hooks/charmhelpers/payload/execd.py b/charmhelpers/payload/execd.py similarity index 100% rename from hooks/charmhelpers/payload/execd.py rename to charmhelpers/payload/execd.py diff --git a/hooks/charmhelpers b/hooks/charmhelpers new file mode 120000 index 0000000..8f067ed --- /dev/null +++ b/hooks/charmhelpers @@ -0,0 +1 @@ +../charmhelpers/ \ No newline at end of file diff --git a/hooks/lib b/hooks/lib new file mode 120000 index 0000000..dc598c5 --- /dev/null +++ b/hooks/lib @@ -0,0 +1 @@ +../lib \ No newline at end of file diff --git a/hooks/swift_storage_hooks.py b/hooks/swift_storage_hooks.py index 909f728..2274faf 100755 --- a/hooks/swift_storage_hooks.py +++ b/hooks/swift_storage_hooks.py @@ -3,7 +3,7 @@ import os import sys -from swift_storage_utils import ( +from lib.swift_storage_utils import ( PACKAGES, RESTART_MAP, SWIFT_SVCS, diff --git a/lib/__init__.py b/lib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hooks/misc_utils.py b/lib/misc_utils.py similarity index 100% rename from hooks/misc_utils.py rename to lib/misc_utils.py diff --git a/hooks/swift_storage_context.py b/lib/swift_storage_context.py similarity index 100% rename from hooks/swift_storage_context.py rename to lib/swift_storage_context.py diff --git a/hooks/swift_storage_utils.py b/lib/swift_storage_utils.py similarity index 100% rename from hooks/swift_storage_utils.py rename to lib/swift_storage_utils.py diff --git a/setup.cfg b/setup.cfg index e5cf628..bcdc262 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ -[nosesetests] +[nosetests] verbosity=2 with-coverage=1 cover-erase=1 -cover-package=hooks +cover-package=lib,hooks.swift_storage_hooks diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py index f80aab3..e69de29 100644 --- a/unit_tests/__init__.py +++ b/unit_tests/__init__.py @@ -1,2 +0,0 @@ -import sys -sys.path.append('hooks') diff --git a/unit_tests/test_swift_storage_context.py b/unit_tests/test_swift_storage_context.py index 057fc20..1cd3aee 100644 --- a/unit_tests/test_swift_storage_context.py +++ b/unit_tests/test_swift_storage_context.py @@ -1,7 +1,7 @@ from mock import MagicMock from test_utils import CharmTestCase, patch_open -import swift_storage_context as swift_context +import lib.swift_storage_context as swift_context TO_PATCH = [ diff --git a/unit_tests/test_swift_storage_relations.py b/unit_tests/test_swift_storage_relations.py index 980dfdb..3947be9 100644 --- a/unit_tests/test_swift_storage_relations.py +++ b/unit_tests/test_swift_storage_relations.py @@ -2,16 +2,16 @@ from mock import patch, MagicMock from test_utils import CharmTestCase, patch_open -import swift_storage_utils as utils +import lib.swift_storage_utils as utils _reg = utils.register_configs utils.register_configs = MagicMock() -import swift_storage_hooks as hooks +import hooks.swift_storage_hooks as hooks utils.register_configs = _reg -from swift_storage_utils import PACKAGES +from lib.swift_storage_utils import PACKAGES TO_PATCH = [ 'CONFIGS', diff --git a/unit_tests/test_swift_storage_utils.py b/unit_tests/test_swift_storage_utils.py index b4e2c6f..1a1e3b8 100644 --- a/unit_tests/test_swift_storage_utils.py +++ b/unit_tests/test_swift_storage_utils.py @@ -4,7 +4,7 @@ import tempfile from mock import call, patch, MagicMock from test_utils import CharmTestCase, patch_open -import swift_storage_utils as swift_utils +import lib.swift_storage_utils as swift_utils TO_PATCH = [