[sparkiegeek,r=james-page] Refactoring to support use of library code from hooks and actions.

This change moves a number of pieces from out of the hooks directory including:

    swift_storage* other than actual hooks
    charmhelpers

so that they can be re-used from actions and hooks more easily.
This commit is contained in:
James Page 2015-08-11 11:08:15 +01:00
commit 317a2ca3af
80 changed files with 15 additions and 14 deletions

View File

@ -4,4 +4,4 @@ exclude_lines =
if __name__ == .__main__.:
include=
hooks/swift_storage_*
lib/swift_storage_*

5
Makefile Normal file → Executable file
View File

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

View File

@ -1,5 +1,5 @@
branch: lp:charm-helpers
destination: hooks/charmhelpers
destination: charmhelpers
include:
- core
- cli

1
hooks/charmhelpers Symbolic link
View File

@ -0,0 +1 @@
../charmhelpers/

1
hooks/lib Symbolic link
View File

@ -0,0 +1 @@
../lib

View File

@ -3,7 +3,7 @@
import os
import sys
from swift_storage_utils import (
from lib.swift_storage_utils import (
PACKAGES,
RESTART_MAP,
SWIFT_SVCS,

0
lib/__init__.py Normal file
View File

View File

@ -1,6 +1,6 @@
[nosesetests]
[nosetests]
verbosity=2
with-coverage=1
cover-erase=1
cover-package=hooks
cover-package=lib,hooks.swift_storage_hooks

View File

@ -1,2 +0,0 @@
import sys
sys.path.append('hooks')

View File

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

View File

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

View File

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