-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storewolf: adds feature to create inventory file symlink #3035
Conversation
dbb6683
to
c97c5ba
Compare
Needs a rebase and |
c97c5ba
to
8365f0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8365f0c
to
9d6274a
Compare
Force pushed to address Ben's comments on deleting the symlink (if it's there) before attempting to create it. |
9d6274a
to
3b3f46b
Compare
Force pushed to address Zac's comment: now use two different
|
f3c66d4
to
29469e5
Compare
Force pushed to add migration and rebase on |
29469e5
to
bdb3ad5
Compare
Force pushed for |
bdb3ad5
to
23ab5a4
Compare
Rebased to fix merge conflict in |
/// On downgrade, the inventory directory (and its content) needs to be | ||
/// deleted (see above). Also note, the "remove_dir_all" function will not | ||
/// **not** follow symbolic links and it will simply remove the symbolic | ||
/// link itself (which is exactly what we want). | ||
fn backward(&mut self, input: MigrationData) -> Result<MigrationData> { | ||
println!( | ||
"Deleting inventory Bottlerocket directory: '{}'", | ||
INVENTORY_SYMLINK_PATH | ||
); | ||
if let Err(e) = fs::remove_dir_all(INVENTORY_SYMLINK_PATH) { | ||
if e.kind() != io::ErrorKind::NotFound { | ||
return Err(e).context(error::RemoveFileSnafu { | ||
path: INVENTORY_SYMLINK_PATH, | ||
}); | ||
} else { | ||
println!("NotFound: '{}'", INVENTORY_SYMLINK_PATH) | ||
} | ||
} | ||
Ok(input) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A migration for this seems like overkill. I'm not opposed to including it but I don't see any real upside.
Signed-off-by: John McBride <[email protected]>
23ab5a4
to
9811bb8
Compare
Force pushed to remove migration per @bcressey! Will merge once tests pass again! |
Issue number:
Closes #2967
Description of changes:
Feature for
storewolf
to create a symlink at a given path and destination:will then create the a symlink to the default file location
/usr/share/bottlerocket/application-inventory.json
. Users may also specify the source location of the inventory file via the optional--inventory-file-path
flag.Testing done:
Built bottlerocket, launched instance and see symlink created correctly:
Contents looks good:
And bootlogs look good:
Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.