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

Add permissive sync setting for less lenient validation of Release files #1222

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

hstct
Copy link
Contributor

@hstct hstct commented Jan 20, 2025

No description provided.

@hstct hstct force-pushed the add_permissive_sync branch from 044e806 to 39e878f Compare January 20, 2025 13:43
@hstct hstct marked this pull request as ready for review January 20, 2025 14:35
@hstct hstct force-pushed the add_permissive_sync branch 3 times, most recently from 1dbfaae to e10e998 Compare February 10, 2025 15:31
Copy link
Contributor

@m-bucher m-bucher left a comment

Choose a reason for hiding this comment

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

Some small improvement suggestions. Feel free to convince me otherwise 😄

pulp_deb/app/tasks/synchronizing.py Outdated Show resolved Hide resolved
pulp_deb/app/tasks/synchronizing.py Outdated Show resolved Hide resolved
pulp_deb/app/tasks/synchronizing.py Outdated Show resolved Hide resolved
Comment on lines +1342 to +1338
if "codename" in release_dict:
d_content.content.codename = release_dict["Codename"]
if "suite" in release_dict:
d_content.content.suite = release_dict["Suite"]
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as we do not do anything else in the ifs, this can be simplified to

Suggested change
if "codename" in release_dict:
d_content.content.codename = release_dict["Codename"]
if "suite" in release_dict:
d_content.content.suite = release_dict["Suite"]
d_content.content.codename = release_dict.get("Codename")
d_content.content.suite = release_dict.get("Suite")

Unless d_content.content.codename = None is not the same as not setting it at all 🤔

This would be an additional change to the original code, so I am OK, if this is ignored (for now).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless d_content.content.codename = None is not the same as not setting it at all

Yea, this is the problem and will require further changes.

Comment on lines +33 to +34
fake_file_path = tmp_path / "Release"
artifact._fake_file_path = fake_file_path
Copy link
Contributor

Choose a reason for hiding this comment

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

Not fully sure what this does 😅

Have you considered using mock_open for the file-handler mocking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I test the actual file I/O behavior here. It will create an actual tmp file with the open method. I could mock this but it might hide issues that only occur with real file operations.

@hstct hstct force-pushed the add_permissive_sync branch from e10e998 to 4bacd59 Compare February 11, 2025 09:48
@hstct hstct force-pushed the add_permissive_sync branch from 4bacd59 to 0e9cbe1 Compare February 11, 2025 09:51
@hstct hstct merged commit f801680 into pulp:main Feb 11, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants