[lxc-devel] [PATCH] Only use clear_config_item for lists

Serge Hallyn serge.hallyn at ubuntu.com
Tue Jan 27 20:35:10 UTC 2015


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/python-lxc/lxc/__init__.py | 8 ++++++--
>  src/tests/get_item.c           | 2 +-
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py
> index 47b25b8..d7b0670 100644
> --- a/src/python-lxc/lxc/__init__.py
> +++ b/src/python-lxc/lxc/__init__.py
> @@ -97,8 +97,12 @@ class ContainerNetwork(object):
>          return self.__set_network_item(self.props[key], value)
>  
>      def __clear_network_item(self, key):
> -        return self.container.clear_config_item("lxc.network.%s.%s" % (
> -                                                self.index, key))
> +        if key in ("ipv4", "ipv6"):
> +            return self.container.clear_config_item("lxc.network.%s.%s" % (
> +                                                    self.index, key))
> +        else:
> +            return self.container.set_config_item("lxc.network.%s.%s" % (
> +                                                    self.index, key), "")
>  
>      def __get_network_item(self, key):
>          return self.container.get_config_item("lxc.network.%s.%s" % (
> diff --git a/src/tests/get_item.c b/src/tests/get_item.c
> index abf50e8..943583c 100644
> --- a/src/tests/get_item.c
> +++ b/src/tests/get_item.c
> @@ -249,7 +249,7 @@ int main(int argc, char *argv[])
>  		ret = 1;
>  		goto out;
>  	}
> -	if (!c->clear_config_item(c, "lxc.network.0.ipv4.gateway")) {
> +	if (!c->set_config_item(c, "lxc.network.0.ipv4.gateway", "")) {
>  		fprintf(stderr, "%d: failed clearing ipv4.gateway\n", __LINE__);
>  		ret = 1;
>  		goto out;
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list