diff options
Diffstat (limited to 'os_net_config/impl_eni.py')
-rw-r--r-- | os_net_config/impl_eni.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/os_net_config/impl_eni.py b/os_net_config/impl_eni.py index 3115e04..7eb69f3 100644 --- a/os_net_config/impl_eni.py +++ b/os_net_config/impl_eni.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 @@ -26,8 +26,8 @@ logger = logging.getLogger(__name__) # TODO(?): should move to interfaces.d -def _network_config_path(): - return "/etc/network/interfaces" +def _network_config_path(prefix=''): + return prefix + "/etc/network/interfaces" class ENINetConfig(os_net_config.NetConfig): @@ -37,8 +37,8 @@ class ENINetConfig(os_net_config.NetConfig): /etc/network/interfaces format. """ - def __init__(self, noop=False): - super(ENINetConfig, self).__init__(noop) + def __init__(self, noop=False, root_dir=''): + super(ENINetConfig, self).__init__(noop, root_dir) self.interfaces = {} self.routes = {} self.bridges = {} @@ -214,7 +214,7 @@ class ENINetConfig(os_net_config.NetConfig): iface_data += (route_data or '') new_config += iface_data - if (utils.diff(_network_config_path(), new_config)): + if utils.diff(_network_config_path(self.root_dir), new_config): if activate: for interface in self.interfaces.keys(): self.ifdown(interface) @@ -222,7 +222,7 @@ class ENINetConfig(os_net_config.NetConfig): for bridge in self.bridges.keys(): self.ifdown(bridge, iftype='bridge') - self.write_config(_network_config_path(), new_config) + self.write_config(_network_config_path(self.root_dir), new_config) if activate: for bridge in self.bridges.keys(): @@ -233,4 +233,4 @@ class ENINetConfig(os_net_config.NetConfig): else: logger.info('No interface changes are required.') - return {"/etc/network/interfaces": new_config} + return {_network_config_path(self.root_dir): new_config} |