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

Excluding relative dirs in state.file.retention_schedule #48662

Merged
merged 2 commits into from Jul 31, 2018

Conversation

Projects
None yet
4 participants
@slaws
Contributor

slaws commented Jul 18, 2018

What does this PR do?

It makes salt.state.file.retention_schedule ignoring relative directories . and .. when using it without specifying a strpformat (using getmtime() )

What issues does this PR fix or reference?

This commit should resolve #48637

Previous Behavior

. and .. were treated like the other files

New Behavior

. and .. are ignored.

Tests written?

No

Commits signed with GPG?

Yes

@@ -3737,6 +3737,8 @@ def get_file_time_from_strptime(f):
return (None, None)
def get_file_time_from_mtime(f):
if f == '.' or f == '..':

This comment has been minimized.

@rares-pop

rares-pop Jul 19, 2018

Contributor

do we need this for get_file_time_from_strptime() too?

This comment has been minimized.

@slaws

slaws Jul 19, 2018

Contributor

I don't think so.
. and .. normally raise a ValueError at datetime.strptime because it will not match strptime_format.
As a result these directories will be ignored.

@rallytime rallytime requested a review from terminalmage Jul 20, 2018

@@ -3737,6 +3737,8 @@ def get_file_time_from_strptime(f):
return (None, None)
def get_file_time_from_mtime(f):
if f == '.' or f == '..':
return (None,None)

This comment has been minimized.

@terminalmage

terminalmage Jul 20, 2018

Member

You need a space after the comma, otherwise pylint will complain.

@rallytime rallytime requested a review from terminalmage Jul 23, 2018

@rallytime rallytime merged commit 136ff67 into saltstack:2017.7 Jul 31, 2018

7 of 8 checks passed

jenkins/pr/py3-centos-7 The py3-centos-7 job has failed
Details
WIP ready for review
Details
continuous-integration/jenkins/pr-merge This commit looks good
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment