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

feat: switch from .last-upload.results to .lastupload #71

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

ptoscano
Copy link
Collaborator

@ptoscano ptoscano commented Aug 5, 2024

The file /etc/insights-client/.last-upload.results is watched to determine when was the last upload done. A couple of important notes about it:

  1. even though it is read (and parsed), its content is actually never used currently
  2. the file is written by insights-client (better: insights-core) only when legacy_upload is true (which is the default as of this writing)

While (1) is not much an issue, (2) means that the displaying of the last upload (timestamp) to Insights is not available when switching insights-client to non-legacy-upload.

To avoid both the issues, switch from .last-upload.results to /etc/insights-client/.lastupload:

  • .lastupload is always written, no matter the mode, and its modification timestamp is indeed accurate
  • stop reading the file at all, saving a bit of resources

There should be no behaviour changes.

The file /etc/insights-client/.last-upload.results is watched to
determine when was the last upload done. A couple of important notes
about it:
1) even though it is read (and parsed), its content is actually never
   used currently
2) the file is written by insights-client (better: insights-core) only
   when "legacy_upload" is true (which is the default as of this
   writing)

While (1) is not much an issue, (2) means that the displaying of the
last upload (timestamp) to Insights is not available when switching
insights-client to non-legacy-upload.

To avoid both the issues, switch from .last-upload.results to
/etc/insights-client/.lastupload:
- .lastupload is always written, no matter the mode, and its
  modification timestamp is indeed accurate
- stop reading the file at all, saving a bit of resources

There should be no behaviour changes.
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 5, 2024

The code is used to show the "Last upload to Insights" detail, which is checked by TestSubscriptions.testInsights. Hence, if that test passes, things should still work as expected.

@martinpitt
Copy link
Contributor

This looks fine, thanks! In the future you'll be able to get the stat information directly, but that requires a relatively new bridge.

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants