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

RemoveOldRepodataStep for yum publisher #1056

Merged
merged 1 commit into from
Aug 15, 2017

Conversation

midnightercz
Copy link
Contributor

New publish step removes repodata older than threshold which is by default 14 days.

closes #2788
https://pulp.plan.io/issues/2788

@mention-bot
Copy link

@midnightercz, thanks for your PR! By analyzing the history of the files in this pull request, we identified @asmacdo, @mhrivnak and @goosemania to be potential reviewers.

@pulpbot
Copy link
Member

pulpbot commented Jun 16, 2017

Can one of the admins verify this patch?

1 similar comment
@pulpbot
Copy link
Member

pulpbot commented Jun 16, 2017

Can one of the admins verify this patch?

@bmbouter
Copy link
Member

ok test

Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

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

Thanks @midnightercz. I kicked off the unit tests, so we'll see how they go. Since this is new functionality can this be documented with:

  • documentation in the yum publisher stating this behavior
  • a release note that also links to the yum publisher docs

Also the 14 days is more than a default, it's hard coded. Should this be user configurable? It seems like it should be. What do you think?

@pulpbot
Copy link
Member

pulpbot commented Jun 21, 2017

Can one of the admins verify this patch?

@midnightercz
Copy link
Contributor Author

We chose 14 days as maximal threshold. I'm not sure where we originally get this value. Threshold is configurable via remove_old_repodata_threshold attribute. I will work on docs. I also notice a left some debug prints in the code, so I will push new update anyway.

If ``remove_old_repodata`` is true, this attribute specify maximal age of
repodata in seconds that are not removed during publish. Default is 2 weeks.


Copy link
Member

Choose a reason for hiding this comment

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

Can L#640 - L#642 be removed?


``remove_old_repodata_threshold``
If ``remove_old_repodata`` is true, this attribute specify maximal age of
repodata in seconds that are not removed during publish. Default is 2 weeks.
Copy link
Member

@bmbouter bmbouter Jun 28, 2017

Choose a reason for hiding this comment

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

s/Default is/Hard coded to/. Since it can't be changed by the user we need to claim it's hard coded not a default that is configurable.

@bmbouter
Copy link
Member

Can you add your name to the AUTHORS file in the root of the repo?

@bmbouter
Copy link
Member

A release note is needed for pulp_rpm also. Can you add a description of the feature to the 2.14 release notes? https://github.com/pulp/pulp_rpm/blob/master/docs/user-guide/release-notes/2.14.x.rst

Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

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

I left four easy to handle comments. Can those be handled? Then I think this will be ready for merging. Thanks @midnightercz !

@bmbouter
Copy link
Member

There are also flake8 environment errors. The test runners run tests and check for flake8. Those need to all show green before we can merge.

matched = exp.match(fname)
if matched:
delta = datetime.datetime.today() -\
datetime.datetime.fromtimestamp(os.path.getmtime(f))
Copy link

Choose a reason for hiding this comment

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

Does this depend on https://pulp.plan.io/issues/2783 being implemented first? Without that, the mtime will always be equal to the time of the CopyDirectoryStep and so I expect this will never remove anything.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure so I'm defer to @midnightercz

@@ -10,3 +10,6 @@ New Features

* New parameter for rsync distributor ``rsync_extra_args`` allows user to
specify custom arguments for rsync call during publish operations.

* New publish step RemoveOldRepodataStep removes expired repodata at the end
Copy link
Member

Choose a reason for hiding this comment

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

s/expired repodata/repodata older than 14 days/

Copy link
Member

Choose a reason for hiding this comment

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

Please add a sentence that says Enable this step with these new distributor options. and have the 'these new distributor options' part link to your new settings in the docs please.


``remove_old_repodata``
Boolean flag to indicate whether or not repodata passed expiration are removed
during publish. Files that present in repomd.xml are preserved no matter of
Copy link
Member

Choose a reason for hiding this comment

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

Can you add two sentences in the middle here: If not present it defaults to False. The default expiration is 14 days.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If not present it defaults to True


``remove_old_repodata_threshold``
If ``remove_old_repodata`` is true, this attribute specify maximal age of
repodata in seconds that are not removed during publish. Hard coded to 2 weeks.
Copy link
Member

Choose a reason for hiding this comment

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

s/Hard coded to 2 weeks//.

Copy link
Contributor

@mhrivnak mhrivnak Jul 14, 2017

Choose a reason for hiding this comment

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

I also suggest sticking to the units that we expect it to be expressed in. In case the default is too cumbersome to express in seconds, then I'd change the units to something that better matches the default. Otherwise express the default in seconds.

:returns: return if step should clean old repodata or not
:rtype: bool
"""
return not self.get_config().get('remove_old_repodata', True)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like it's going to remove old metadata by default. Is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Member

Choose a reason for hiding this comment

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

ok cool, ty I see the docs you wrote also reflect that so we're good there.


``remove_old_repodata_threshold``
If ``remove_old_repodata`` is true, this attribute specify maximal age of
repodata in seconds that are not removed during publish. Thisttribute defaults
Copy link
Member

Choose a reason for hiding this comment

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

s/Thisttribute/This attribute/

@@ -10,3 +10,6 @@ New Features

* New parameter for rsync distributor ``rsync_extra_args`` allows user to
specify custom arguments for rsync call during publish operations.

* New publish step RemoveOldRepodataStep removes repodata older than 14 days
Copy link
Member

Choose a reason for hiding this comment

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

Can a sentence be added here with links to the options saying something like: Configure this behavior with these options and link to the options.

Copy link
Member

Choose a reason for hiding this comment

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

i don't think this is necessary, people know where to look for distributor's options docs.

Copy link
Member

Choose a reason for hiding this comment

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

This can be skipped if you want. I was thinking it would just make the docs more awesome.

@ipanova
Copy link
Member

ipanova commented Aug 2, 2017

@midnightercz please address the comments once you have time, we are looking forward to see this merged. Thank you for collaboration and contributions 🎉 🎉

@bmbouter
Copy link
Member

bmbouter commented Aug 2, 2017

Also since this missed the 2.14 release branch point, master is now 2.15. Because of this, the release notes in this PR need to be updated to move from 2.14 to 2.15 prior to merging.

New publish step removes repodata older than threshold which is by default 14 days.

closes pulp#2788
https://pulp.plan.io/issues/2788
Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

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

@midnightercz thanks for all the changes. This looks good to me.

@bmbouter
Copy link
Member

@ipanova Would you be willing to merge whenever you think its ready?

@ipanova ipanova merged commit 299b926 into pulp:master Aug 15, 2017
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.

7 participants