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

Fix wrong timestamp when importing packages with rhnpush (bsc#1235970) #9690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

parlt91
Copy link
Contributor

@parlt91 parlt91 commented Jan 27, 2025

What does this PR change?

When using rhnpush the last_modified column would get an incorrect timestamp when using timezones other than UTC on the server.

Remove calculation of the (wrong) timestamp from headerSource.populate() and rely on the trigger creating the timestamp when no value to last modified is provided.

rhn_package_mod_trig_fun()

if tg_op='UPDATE' then
  if new.last_modified = old.last_modified or
     new.last_modified is null then
       new.last_modified := current_timestamp;
  end if;
else
  if new.last_modified is null then
       new.last_modified := current_timestamp; <------
  end if;
end if;
new.modified := current_timestamp;

Tested ISSv1 not affected by this change (using different code to import packages).

GUI diff

No difference.

  • DONE

Documentation

  • No documentation needed: BUGFIX

  • DONE

Test coverage

  • No tests: BUGFIX

  • DONE

Links

Issue(s): https://github.com/SUSE/spacewalk/issues/26231

  • DONE

Changelogs

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

Before you merge

Check How to branch and merge properly!

@parlt91 parlt91 requested a review from a team as a code owner January 27, 2025 16:23
@parlt91 parlt91 requested review from ycedres and meaksh and removed request for a team and ycedres January 27, 2025 16:23
@parlt91 parlt91 force-pushed the fix-rhnpush-last-modified branch from 8048edc to 3e8a492 Compare January 27, 2025 16:29
@parlt91 parlt91 force-pushed the fix-rhnpush-last-modified branch from 3e8a492 to 3188a81 Compare January 27, 2025 16:31
@parlt91 parlt91 requested a review from mcalmer January 27, 2025 16:37
Copy link
Member

@meaksh meaksh left a comment

Choose a reason for hiding this comment

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

LGTM! BTW, I noticed the wrong value for last_modified was also happening for packages that were synced by reposync, and also fixed by this PR.

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