Skip to content

Commit

Permalink
Merge pull request #662 from amazonlinux/updog-migration-extension
Browse files Browse the repository at this point in the history
updog: only remove known extensions from migration filenames
  • Loading branch information
tjkirch authored Jan 17, 2020
2 parents 97370d1 + 6790bed commit ad58567
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions workspaces/updater/updog/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ fn write_target_to_disk<P: AsRef<Path>>(
.read_target(target)
.context(error::Metadata)?
.context(error::TargetNotFound { target })?;
// Note: the file extension for the compression type we're using should be removed in
// retrieve_migrations below.
let mut reader = lz4::Decoder::new(reader).context(error::Lz4Decode { target })?;
let mut f = OpenOptions::new()
.write(true)
Expand Down Expand Up @@ -300,10 +302,12 @@ fn retrieve_migrations(
}

// download each migration, making sure they are executable and removing
// any extension (eg, .lz4)
// known extensions from our compression, e.g. .lz4
for name in migration_targets(*start, *target, &manifest)? {
let mut destination = dir.join(&name);
destination.set_extension("");
if destination.extension() == Some("lz4".as_ref()) {
destination.set_extension("");
}
write_target_to_disk(repository, &name, &destination)?;
fs::set_permissions(&destination, Permissions::from_mode(0o755))
.context(error::SetPermissions { path: destination })?;
Expand Down

0 comments on commit ad58567

Please sign in to comment.