Skip to content
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

Added Manifest file to manage files on disk #994

Open
wants to merge 16 commits into
base: v3
Choose a base branch
from
Open

Conversation

RRashmit
Copy link

@RRashmit RRashmit commented Feb 21, 2025

Proposed changes

Testing:

Adding certs
Successfully added certs in the location and updated the manifest file. (Contains both referenced/unreferenced files)
image
Deleting certs
Restarted the agent and performed deletion
Successfully deleted the files from the location
and sucessfully updated the manifest file.
Rollback action
Successfully Rollback

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@github-actions github-actions bot added the chore Pull requests for routine tasks label Feb 21, 2025
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Mar 3, 2025
@RRashmit RRashmit changed the title Manifest file poc Added Manifest file to manage files on disk Mar 4, 2025
@RRashmit RRashmit self-assigned this Mar 4, 2025
@RRashmit RRashmit added v3.x Issues and Pull Requests related to the major version v3 and removed documentation Improvements or additions to documentation chore Pull requests for routine tasks labels Mar 4, 2025
@github-actions github-actions bot added the chore Pull requests for routine tasks label Mar 4, 2025
@RRashmit RRashmit marked this pull request as ready for review March 5, 2025 15:59
@RRashmit RRashmit requested a review from a team as a code owner March 5, 2025 15:59
// Update map of current files on disk
fms.UpdateCurrentFilesOnDisk(files.ConvertToMapOfFiles(fileOverview.GetFiles()))
manifestFileErr := fms.UpdateManifestFile(files.ConvertToMapOfFiles(fileOverview.GetFiles()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing, could the converting of the map to files be done once

Suggested change
manifestFileErr := fms.UpdateManifestFile(files.ConvertToMapOfFiles(fileOverview.GetFiles()))
files := files.ConvertToMapOfFiles(fileOverview.GetFiles())
fms.UpdateCurrentFilesOnDisk(files)
manifestFileErr := fms.UpdateManifestFile(files)

// if file is in currentFiles but not in modified files, file has been deleted
manifestFiles, manifestFileErr := fms.getManifestFile(currentFiles)

if manifestFileErr != nil && manifestFiles == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be || ? Or can there be an error but we are still able to read the files ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually caters all other scenarios when there is actual error in getting the manifest file except the first time when the file is still to be created (in that case manifestFiles won't be nil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants