[Kimchi-devel] [PATCH][Kimchi 2/2] Move 'template.conf' to /etc

Aline Manera alinefm at linux.vnet.ibm.com
Fri Mar 18 13:49:33 UTC 2016


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 03/17/2016 07:49 PM, Rodrigo Trujillo wrote:
> 'template.conf' is being written in /etc/wok/plugins.d, which is not the
> correct path, since template.conf is only related to Kimchi, wok does
> not make use of it.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   Makefile.am                   | 7 +++++--
>   contrib/kimchi.spec.fedora.in | 1 -
>   contrib/kimchi.spec.suse.in   | 1 -
>   model/networks.py             | 4 ++--
>   model/storagepools.py         | 5 ++---
>   osinfo.py                     | 3 ++-
>   tests/test_model.py           | 8 ++++----
>   7 files changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index 8382a31..1b46773 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -32,8 +32,11 @@ endif
>   wokdir = $(pythondir)/wok
>   kimchidir = $(pythondir)/wok/plugins/kimchi
>
> -confdir = $(sysconfdir)/wok/plugins.d
> -dist_conf_DATA = kimchi.conf template.conf
> +wokconfdir = $(sysconfdir)/wok/plugins.d
> +dist_wokconf_DATA = kimchi.conf
> +
> +confdir = $(sysconfdir)/kimchi
> +dist_conf_DATA = template.conf
>
>   AUTOMAKE_OPTIONS = foreign
>
> diff --git a/contrib/kimchi.spec.fedora.in b/contrib/kimchi.spec.fedora.in
> index c2111f9..292ad03 100644
> --- a/contrib/kimchi.spec.fedora.in
> +++ b/contrib/kimchi.spec.fedora.in
> @@ -81,7 +81,6 @@ rm -rf $RPM_BUILD_ROOT
>   %{_prefix}/share/locale/*/LC_MESSAGES/kimchi.mo
>   %{_datadir}/wok/plugins/kimchi/
>   %{_sysconfdir}/wok/plugins.d/kimchi.conf
> -%{_sysconfdir}/wok/plugins.d/template.conf
>   %{_sysconfdir}/kimchi/
>   %{_sharedstatedir}/kimchi/
>   %{_sysconfdir}/systemd/system/wokd.service.d/kimchi.conf
> diff --git a/contrib/kimchi.spec.suse.in b/contrib/kimchi.spec.suse.in
> index 59207fd..7a57538 100644
> --- a/contrib/kimchi.spec.suse.in
> +++ b/contrib/kimchi.spec.suse.in
> @@ -68,7 +68,6 @@ rm -rf $RPM_BUILD_ROOT
>   %{_prefix}/share/locale/*/LC_MESSAGES/kimchi.mo
>   %{_datadir}/wok/plugins/kimchi/
>   %{_sysconfdir}/wok/plugins.d/kimchi.conf
> -%{_sysconfdir}/wok/plugins.d/template.conf
>   %{_sysconfdir}/kimchi/
>   %{_var}/lib/kimchi/
>   %{_sysconfdir}/systemd/system/wokd.service.d/kimchi.conf
> diff --git a/model/networks.py b/model/networks.py
> index f42be77..2664af3 100644
> --- a/model/networks.py
> +++ b/model/networks.py
> @@ -24,7 +24,6 @@ import time
>   from libvirt import VIR_INTERFACE_XML_INACTIVE
>   from xml.sax.saxutils import escape
>
> -from wok.config import PluginPaths
>   from wok.exception import InvalidOperation, InvalidParameter
>   from wok.exception import MissingParameter, NotFoundError, OperationFailed
>   from wok.utils import run_command, wok_log
> @@ -32,6 +31,7 @@ from wok.xmlutils.utils import xpath_get_text
>
>   from wok.plugins.kimchi import netinfo
>   from wok.plugins.kimchi import network as knetwork
> +from wok.plugins.kimchi.config import kimchiPaths
>   from wok.plugins.kimchi.model.config import CapabilitiesModel
>   from wok.plugins.kimchi.osinfo import defaults as tmpl_defaults
>   from wok.plugins.kimchi.xmlutils.interface import get_iface_xml
> @@ -58,7 +58,7 @@ class NetworksModel(object):
>
>           error_msg = ("Please, check the configuration in %s/template.conf to "
>                        "ensure it lists only valid networks." %
> -                     PluginPaths('kimchi').conf_dir)
> +                     kimchiPaths.sysconf_dir)
>
>           for net_name in networks:
>               try:
> diff --git a/model/storagepools.py b/model/storagepools.py
> index 20c1cd0..cf3ed21 100644
> --- a/model/storagepools.py
> +++ b/model/storagepools.py
> @@ -22,13 +22,12 @@ import lxml.etree as ET
>   import sys
>   from lxml.builder import E
>
> -from wok.config import PluginPaths
>   from wok.exception import InvalidOperation, MissingParameter
>   from wok.exception import NotFoundError, OperationFailed
>   from wok.utils import add_task, run_command, wok_log
>   from wok.xmlutils.utils import xpath_get_text
>
> -from wok.plugins.kimchi.config import config, get_kimchi_version
> +from wok.plugins.kimchi.config import config, get_kimchi_version, kimchiPaths
>   from wok.plugins.kimchi.model.config import CapabilitiesModel
>   from wok.plugins.kimchi.model.host import DeviceModel
>   from wok.plugins.kimchi.model.libvirtstoragepool import StoragePoolDef
> @@ -83,7 +82,7 @@ class StoragePoolsModel(object):
>
>           error_msg = ("Please, check the configuration in %s/template.conf to "
>                        "ensure it has a valid storage pool." %
> -                     PluginPaths('kimchi').conf_dir)
> +                     kimchiPaths.sysconf_dir)
>
>           conn = self.conn.get()
>           for pool_name in pools:
> diff --git a/osinfo.py b/osinfo.py
> index 7560657..7b80f29 100644
> --- a/osinfo.py
> +++ b/osinfo.py
> @@ -26,6 +26,7 @@ from configobj import ConfigObj
>   from distutils.version import LooseVersion
>
>   from wok.config import PluginPaths
> +from wok.plugins.kimchi.config import kimchiPaths
>
>
>   SUPPORTED_ARCHS = {'x86': ('i386', 'i686', 'x86_64'),
> @@ -136,7 +137,7 @@ def _get_tmpl_defaults():
>       default_config = ConfigObj(tmpl_defaults)
>
>       # Load template configuration file
> -    config_file = os.path.join(PluginPaths('kimchi').conf_dir, 'template.conf')
> +    config_file = os.path.join(kimchiPaths.sysconf_dir, 'template.conf')
>       config = ConfigObj(config_file)
>
>       # Merge default configuration with file configuration
> diff --git a/tests/test_model.py b/tests/test_model.py
> index fc7ee10..b461172 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -651,9 +651,9 @@ class ModelTests(unittest.TestCase):
>                                "format = %s\n\n[graphics]\n\n[processor]\n"\
>                                % vol_format
>
> -        config_file = os.path.join(paths.conf_dir, 'template.conf')
> +        config_file = os.path.join(paths.sysconf_dir, 'template.conf')
>           config_bkp_file = \
> -            os.path.join(paths.conf_dir, 'template.conf-unit_test_bkp')
> +            os.path.join(paths.sysconf_dir, 'template.conf-unit_test_bkp')
>
>           os.rename(config_file, config_bkp_file)
>
> @@ -663,9 +663,9 @@ class ModelTests(unittest.TestCase):
>           osinfo.defaults = osinfo._get_tmpl_defaults()
>
>       def _restore_template_conf_file(self):
> -        config_file = os.path.join(paths.conf_dir, 'template.conf')
> +        config_file = os.path.join(paths.sysconf_dir, 'template.conf')
>           config_bkp_file = \
> -            os.path.join(paths.conf_dir, 'template.conf-unit_test_bkp')
> +            os.path.join(paths.sysconf_dir, 'template.conf-unit_test_bkp')
>           os.rename(config_bkp_file, config_file)
>           osinfo.defaults = osinfo._get_tmpl_defaults()
>




More information about the Kimchi-devel mailing list