[Kimchi-devel] [wok] Move network and netinfo modules to kimchi plugin

Aline Manera alinefm at linux.vnet.ibm.com
Wed Aug 5 12:31:43 UTC 2015



On 10/07/2015 18:12, Lucio Correia wrote:
> The modules network and netinfo are specific to kimchi. This
> patch moves them from wok to kimchi plugin and adapts the
> respective imports.
>
> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
>   plugins/kimchi/model/host.py           |    2 +-
>   plugins/kimchi/model/interfaces.py     |    2 +-
>   plugins/kimchi/model/networks.py       |    4 ++--
>   {src/wok => plugins/kimchi}/netinfo.py |    0
>   {src/wok => plugins/kimchi}/network.py |    0
>   plugins/kimchi/tests/test_model.py     |    2 +-
>   6 files changed, 5 insertions(+), 5 deletions(-)
>   rename {src/wok => plugins/kimchi}/netinfo.py (100%)
>   rename {src/wok => plugins/kimchi}/network.py (100%)
>
> diff --git a/plugins/kimchi/model/host.py b/plugins/kimchi/model/host.py
> index 3ff034c..8c891a1 100644
> --- a/plugins/kimchi/model/host.py
> +++ b/plugins/kimchi/model/host.py
> @@ -25,7 +25,6 @@ import time
>   from cherrypy.process.plugins import BackgroundTask
>   from collections import defaultdict
>
> -from wok import netinfo
>   from wok.basemodel import Singleton
>   from wok.exception import InvalidOperation, InvalidParameter
>   from wok.exception import NotFoundError, OperationFailed
> @@ -34,6 +33,7 @@ from wok.xmlutils.utils import xpath_get_text
>
>   import hostdev
>   from .. import disks
> +from .. import netinfo

Why are we not using the full import path?

from wok.plugins.kimchi import netinfo

>   from ..repositories import Repositories
>   from ..swupdate import SoftwareUpdate
>   from config import CapabilitiesModel
> diff --git a/plugins/kimchi/model/interfaces.py b/plugins/kimchi/model/interfaces.py
> index 81b379a..149afe3 100644
> --- a/plugins/kimchi/model/interfaces.py
> +++ b/plugins/kimchi/model/interfaces.py
> @@ -17,9 +17,9 @@
>   # License along with this library; if not, write to the Free Software
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>
> -from wok import netinfo
>   from wok.exception import NotFoundError
>
> +from .. import netinfo
>   from networks import NetworksModel
>
>
> diff --git a/plugins/kimchi/model/networks.py b/plugins/kimchi/model/networks.py
> index 57af9e7..621055e 100644
> --- a/plugins/kimchi/model/networks.py
> +++ b/plugins/kimchi/model/networks.py
> @@ -23,8 +23,6 @@ import sys
>   import time
>   from xml.sax.saxutils import escape
>
> -from wok import netinfo
> -from wok import network as knetwork
>   from wok.config import PluginPaths
>   from wok.exception import InvalidOperation, InvalidParameter
>   from wok.exception import MissingParameter, NotFoundError, OperationFailed
> @@ -32,6 +30,8 @@ from wok.rollbackcontext import RollbackContext
>   from wok.utils import run_command, wok_log
>   from wok.xmlutils.utils import xpath_get_text
>
> +from .. import netinfo
> +from .. import network as knetwork
>   from ..osinfo import defaults as tmpl_defaults
>   from ..xmlutils.network import create_vlan_tagged_bridge_xml
>   from ..xmlutils.network import to_network_xml
> diff --git a/src/wok/netinfo.py b/plugins/kimchi/netinfo.py
> similarity index 100%
> rename from src/wok/netinfo.py
> rename to plugins/kimchi/netinfo.py
> diff --git a/src/wok/network.py b/plugins/kimchi/network.py
> similarity index 100%
> rename from src/wok/network.py
> rename to plugins/kimchi/network.py
> diff --git a/plugins/kimchi/tests/test_model.py b/plugins/kimchi/tests/test_model.py
> index c70e4fb..027b3c2 100644
> --- a/plugins/kimchi/tests/test_model.py
> +++ b/plugins/kimchi/tests/test_model.py
> @@ -28,7 +28,6 @@ import unittest
>   import uuid
>
>   import wok.objectstore
> -from wok import netinfo
>   from wok.basemodel import Singleton
>   from wok.config import config
>   from wok.exception import InvalidOperation
> @@ -36,6 +35,7 @@ from wok.exception import InvalidParameter, NotFoundError, OperationFailed
>   from wok.rollbackcontext import RollbackContext
>   from wok.utils import add_task
>
> +from wok.plugins.kimchi import netinfo
>   from wok.plugins.kimchi.osinfo import get_template_default
>   from wok.plugins.kimchi.model import model
>   from wok.plugins.kimchi.model.libvirtconnection import LibvirtConnection




More information about the Kimchi-devel mailing list