From 103b87aa82cfd298b664fe1314e987bd953ec20d Mon Sep 17 00:00:00 2001 From: Frederic Lepied Date: Thu, 5 Feb 2015 22:17:42 +0100 Subject: Allow to specify the root directory of the filesystem Change-Id: Ice1b8d17804cf7a0aafd308945a5e960fe927bbc --- os_net_config/impl_ifcfg.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'os_net_config/impl_ifcfg.py') diff --git a/os_net_config/impl_ifcfg.py b/os_net_config/impl_ifcfg.py index 0fe8cc5..99273bc 100644 --- a/os_net_config/impl_ifcfg.py +++ b/os_net_config/impl_ifcfg.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2014 Red Hat, Inc. +# Copyright 2014-2015 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -45,8 +45,8 @@ def cleanup_pattern(): class IfcfgNetConfig(os_net_config.NetConfig): """Configure network interfaces using the ifcfg format.""" - def __init__(self, noop=False): - super(IfcfgNetConfig, self).__init__(noop) + def __init__(self, noop=False, root_dir=''): + super(IfcfgNetConfig, self).__init__(noop, root_dir) self.interface_data = {} self.route_data = {} self.bridge_data = {} @@ -250,8 +250,8 @@ class IfcfgNetConfig(os_net_config.NetConfig): for interface_name, iface_data in self.interface_data.iteritems(): route_data = self.route_data.get(interface_name, '') - interface_path = ifcfg_config_path(interface_name) - route_path = route_config_path(interface_name) + interface_path = self.root_dir + ifcfg_config_path(interface_name) + route_path = self.root_dir + route_config_path(interface_name) all_file_names.append(interface_path) all_file_names.append(route_path) if (utils.diff(interface_path, iface_data) or @@ -265,8 +265,8 @@ class IfcfgNetConfig(os_net_config.NetConfig): for bridge_name, bridge_data in self.bridge_data.iteritems(): route_data = self.route_data.get(bridge_name, '') - bridge_path = bridge_config_path(bridge_name) - bridge_route_path = route_config_path(bridge_name) + bridge_path = self.root_dir + bridge_config_path(bridge_name) + bridge_route_path = self.root_dir + route_config_path(bridge_name) all_file_names.append(bridge_path) all_file_names.append(bridge_route_path) if (utils.diff(bridge_path, bridge_data) or -- cgit 1.2.3-korg