Skip to content

Commit

Permalink
stop using fpsync
Browse files Browse the repository at this point in the history
  • Loading branch information
nazunalika committed Nov 13, 2023
1 parent 282eef1 commit 9f87266
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 2 additions & 0 deletions iso/empanadas/empanadas/scripts/finalize_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# All of our options
parser.add_argument('--release', type=str, help="Major Release Version or major-type (eg 9-beta)", required=True)
parser.add_argument('--arch', type=str, help="Architecture")
parser.add_argument('--fpsync', type=str, help="Use fpsync instead of rsync")
parser.add_argument('--logger', type=str)

# Parse them
Expand All @@ -28,6 +29,7 @@
config,
major=major,
arch=results.arch,
fpsync=results.fpsync,
logger=results.logger,
)

Expand Down
8 changes: 5 additions & 3 deletions iso/empanadas/empanadas/util/dnf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
just_pull_everything: bool = False,
extra_dnf_args=None,
reposync_clean_old: bool = False,
fpsync: bool = False,
logger=None
):
self.nofail = nofail
Expand All @@ -76,6 +77,7 @@ def __init__(
self.repoclosure = repoclosure
self.refresh_extra_files = refresh_extra_files
self.refresh_treeinfo = refresh_treeinfo
self.fpsync = fpsync
# Enables podman syncing, which should effectively speed up operations
self.parallel = parallel
# This makes it so every repo is synced at the same time.
Expand Down Expand Up @@ -1406,7 +1408,7 @@ def run_compose_closeout(self):
# Standard ISOs
self.log.info(Color.INFO + 'Starting to sync ISOs to compose')

if os.path.exists('/usr/bin/fpsync'):
if os.path.exists('/usr/bin/fpsync') and self.fpsync:
self.log.info(Color.INFO + 'Starting up fpsync')
message, ret = Shared.fpsync_method(iso_root, sync_iso_root, tmp_dir)
elif os.path.exists('/usr/bin/parallel') and os.path.exists('/usr/bin/rsync'):
Expand All @@ -1430,7 +1432,7 @@ def run_compose_closeout(self):
if os.path.exists(live_root):
self.log.info(Color.INFO + 'Starting to sync live images to compose')

if os.path.exists('/usr/bin/fpsync'):
if os.path.exists('/usr/bin/fpsync') and self.fpsync:
message, ret = Shared.fpsync_method(live_root, sync_live_root, tmp_dir)
elif os.path.exists('/usr/bin/parallel') and os.path.exists('/usr/bin/rsync'):
message, ret = Shared.rsync_method(live_root, sync_live_root)
Expand All @@ -1444,7 +1446,7 @@ def run_compose_closeout(self):
if os.path.exists(images_root):
self.log.info(Color.INFO + 'Starting to sync cloud images to compose')

if os.path.exists('/usr/bin/fpsync'):
if os.path.exists('/usr/bin/fpsync') and self.fpsync:
message, ret = Shared.fpsync_method(images_root, sync_images_root, tmp_dir)
elif os.path.exists('/usr/bin/parallel') and os.path.exists('/usr/bin/rsync'):
message, ret = Shared.rsync_method(images_root, sync_images_root)
Expand Down
23 changes: 20 additions & 3 deletions iso/empanadas/empanadas/util/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,29 @@ def rsync_method(src, dest):
"""
find_cmd = '/usr/bin/find'
parallel_cmd = '/usr/bin/parallel'
rsync_cmd = '/usr/bin/rsync'
cmd = '/usr/bin/rsync'
switches = '-av --chown=10004:10005 --progress --relative --human-readable'
rsync_cmd = '{} {} {}/ {}'.format(cmd, switches, src, dest)

os.makedirs(dest, exist_ok=True)
#os.makedirs(dest, exist_ok=True)
process = subprocess.call(
shlex.split(rsync_cmd),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
if process != 0:
message = 'Syncing (rsync) failed'
retval = process
return message, retval

return 'Not available', 1
if os.path.exists(dest):
message = 'Syncing (rsync) succeeded'
retval = process
else:
message = 'Path synced does not seem to exist for some reason.'
retval = 1

return message, retval

@staticmethod
def s3_determine_latest(s3_bucket, release, arches, filetype, name, logger):
Expand Down

0 comments on commit 9f87266

Please sign in to comment.