@@ -30,7 +30,6 @@ def setUp(self):
30
30
self .workdir = tempfile .TemporaryDirectory ()
31
31
self .configmanager = ConfigManager (prefix = self .workdir .name , extra_files = {})
32
32
os .makedirs (os .path .join (self .workdir .name , "etc/netplan" ))
33
- os .makedirs (os .path .join (self .workdir .name , "run/systemd/network" ))
34
33
os .makedirs (os .path .join (self .workdir .name , "run/NetworkManager/system-connections" ))
35
34
with open (os .path .join (self .workdir .name , "newfile.yaml" ), 'w' ) as fd :
36
35
print ('''network:
@@ -185,8 +184,6 @@ def setUp(self):
185
184
veth0-peer2:
186
185
peer: veth0-peer1
187
186
''' , file = fd )
188
- with open (os .path .join (self .workdir .name , "run/systemd/network/01-pretend.network" ), 'w' ) as fd :
189
- print ("pretend .network" , file = fd )
190
187
with open (os .path .join (self .workdir .name , "run/NetworkManager/system-connections/pretend" ), 'w' ) as fd :
191
188
print ("pretend NM config" , file = fd )
192
189
@@ -266,36 +263,33 @@ def test_add(self):
266
263
267
264
def test_backup_missing_dirs (self ):
268
265
backup_dir = self .configmanager .tempdir
269
- shutil .rmtree (os .path .join (self .workdir .name , "run/systemd/network " ))
266
+ shutil .rmtree (os .path .join (self .workdir .name , "run/NetworkManager/system-connections " ))
270
267
self .configmanager .backup (backup_config_dir = False )
271
- self .assertTrue (os .path .exists (os .path .join (backup_dir , "run/NetworkManager/system-connections/pretend" )))
272
268
# no source dir means no backup as well
273
- self .assertFalse (os .path .exists (os .path .join (backup_dir , "run/systemd/network/01- pretend.network " )))
269
+ self .assertFalse (os .path .exists (os .path .join (backup_dir , "run/NetworkManager/system-connections/ pretend" )))
274
270
self .assertFalse (os .path .exists (os .path .join (backup_dir , "etc/netplan/test.yaml" )))
275
271
276
272
def test_backup_without_config_file (self ):
277
273
backup_dir = self .configmanager .tempdir
278
274
self .configmanager .backup (backup_config_dir = False )
279
275
self .assertTrue (os .path .exists (os .path .join (backup_dir , "run/NetworkManager/system-connections/pretend" )))
280
- self .assertTrue (os .path .exists (os .path .join (backup_dir , "run/systemd/network/01-pretend.network" )))
281
276
self .assertFalse (os .path .exists (os .path .join (backup_dir , "etc/netplan/test.yaml" )))
282
277
283
278
def test_backup_with_config_file (self ):
284
279
backup_dir = self .configmanager .tempdir
285
280
self .configmanager .backup (backup_config_dir = True )
286
281
self .assertTrue (os .path .exists (os .path .join (backup_dir , "run/NetworkManager/system-connections/pretend" )))
287
- self .assertTrue (os .path .exists (os .path .join (backup_dir , "run/systemd/network/01-pretend.network" )))
288
282
self .assertTrue (os .path .exists (os .path .join (backup_dir , "etc/netplan/test.yaml" )))
289
283
290
284
def test_revert (self ):
291
285
self .configmanager .backup ()
292
- with open (os .path .join (self .workdir .name , "run/systemd/network/01- pretend.network " ), 'a+' ) as fd :
286
+ with open (os .path .join (self .workdir .name , "run/NetworkManager/system-connections/ pretend" ), 'a+' ) as fd :
293
287
print ("CHANGED" , file = fd )
294
- with open (os .path .join (self .workdir .name , "run/systemd/network/01- pretend.network " ), 'r' ) as fd :
288
+ with open (os .path .join (self .workdir .name , "run/NetworkManager/system-connections/ pretend" ), 'r' ) as fd :
295
289
lines = fd .readlines ()
296
290
self .assertIn ("CHANGED\n " , lines )
297
291
self .configmanager .revert ()
298
- with open (os .path .join (self .workdir .name , "run/systemd/network/01- pretend.network " ), 'r' ) as fd :
292
+ with open (os .path .join (self .workdir .name , "run/NetworkManager/system-connections/ pretend" ), 'r' ) as fd :
299
293
lines = fd .readlines ()
300
294
self .assertNotIn ("CHANGED\n " , lines )
301
295
0 commit comments