@@ -104,14 +104,14 @@ def add(self, config_dict):
104
104
105
105
def backup (self , backup_config_dir = True ):
106
106
if backup_config_dir :
107
- self ._copy_tree (os .path .join (self .prefix , "etc/netplan" ),
108
- os .path .join (self .temp_etc , "netplan" ))
109
- self ._copy_tree (os .path .join (self .prefix , "run/NetworkManager/system-connections" ),
110
- os .path .join (self .temp_run , "NetworkManager" , "system-connections" ),
111
- missing_ok = True )
112
- self ._copy_tree (os .path .join (self .prefix , "run/systemd/network" ),
113
- os .path .join (self .temp_run , "systemd" , "network" ),
114
- missing_ok = True )
107
+ self .copy_tree (os .path .join (self .prefix , "etc/netplan" ),
108
+ os .path .join (self .temp_etc , "netplan" ))
109
+ self .copy_tree (os .path .join (self .prefix , "run/NetworkManager/system-connections" ),
110
+ os .path .join (self .temp_run , "NetworkManager" , "system-connections" ),
111
+ missing_ok = True )
112
+ self .copy_tree (os .path .join (self .prefix , "run/systemd/network" ),
113
+ os .path .join (self .temp_run , "systemd" , "network" ),
114
+ missing_ok = True )
115
115
116
116
def revert (self ):
117
117
try :
@@ -122,12 +122,12 @@ def revert(self):
122
122
temp_networkd_path = "{}/systemd/network" .format (self .temp_run )
123
123
if os .path .exists (temp_nm_path ):
124
124
shutil .rmtree (os .path .join (self .prefix , "run/NetworkManager/system-connections" ))
125
- self ._copy_tree (temp_nm_path ,
126
- os .path .join (self .prefix , "run/NetworkManager/system-connections" ))
125
+ self .copy_tree (temp_nm_path ,
126
+ os .path .join (self .prefix , "run/NetworkManager/system-connections" ))
127
127
if os .path .exists (temp_networkd_path ):
128
128
shutil .rmtree (os .path .join (self .prefix , "run/systemd/network" ))
129
- self ._copy_tree (temp_networkd_path ,
130
- os .path .join (self .prefix , "run/systemd/network" ))
129
+ self .copy_tree (temp_networkd_path ,
130
+ os .path .join (self .prefix , "run/systemd/network" ))
131
131
except Exception as e : # pragma: nocover (only relevant to filesystem failures)
132
132
# If we reach here, we're in big trouble. We may have wiped out
133
133
# file NM or networkd are using, and we most likely removed the
@@ -152,7 +152,7 @@ def __del__(self):
152
152
def _copy_file (self , src , dst ):
153
153
shutil .copy (src , dst )
154
154
155
- def _copy_tree (self , src , dst , missing_ok = False , ** kwargs ):
155
+ def copy_tree (self , src , dst , missing_ok = False , ** kwargs ):
156
156
try :
157
157
shutil .copytree (src , dst , copy_function = copy_with_ownership , ** kwargs )
158
158
except FileNotFoundError :
0 commit comments