Skip to content

Commit 66995c1

Browse files
committed
Fix copy broken paths
1 parent 5b120e3 commit 66995c1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

repos/system_upgrade/common/actors/targetuserspacecreator/libraries/userspacegen.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,9 @@ def _copy_certificates(context, target_userspace):
362362
# error
363363

364364
run(['mv', target_pki, backup_pki])
365-
context.copytree_from('/etc/pki', target_pki)
365+
context.copytree_from('/etc/pki', target_pki, ignore_dangling_symlinks=True)
366366

367+
# TODO(dkubek): is rpm-gpg owned by rpm?
367368
for filepath in files_owned_by_rpms:
368369
src_path = os.path.join(backup_pki, filepath)
369370
dst_path = os.path.join(target_pki, filepath)
@@ -384,6 +385,8 @@ def _copy_certificates(context, target_userspace):
384385
continue
385386

386387
run(['rm', '-rf', dst_path])
388+
parent_dir = os.path.dirname(dst_path)
389+
run(['mkdir', '-p', parent_dir])
387390
run(['cp', '-a', src_path, dst_path])
388391

389392

repos/system_upgrade/common/libraries/mounting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ def copytree_to(self, src, dst):
209209
"""
210210
shutil.copytree(src, self.full_path(dst))
211211

212-
def copytree_from(self, src, dst):
212+
def copytree_from(self, src, dst, ignore_dangling_symlinks=False):
213213
"""
214214
Recursively copy an entire directory tree rooted at src. The destination directory,
215215
named by dst, must not already exist; it will be created as well as missing parent directories.
216216
217217
The destination directory is considered to be on the current system root.
218218
The source directory is considered to be in the isolated environment.
219219
"""
220-
shutil.copytree(self.full_path(src), dst)
220+
shutil.copytree(self.full_path(src), dst, ignore_dangling_symlinks=ignore_dangling_symlinks)
221221

222222
def copy_to(self, src, dst):
223223
"""

0 commit comments

Comments
 (0)