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 bug in keep_source for non-templated salt:// file sources #49164

Merged
merged 3 commits into from Aug 18, 2018

Conversation

Projects
None yet
3 participants
@terminalmage
Copy link
Contributor

commented Aug 16, 2018

Unless the file is one of A) a remote file source (http/https/ftp/etc.) or B) being templated, then file.get_managed does not cache the file. Thus, the variable we rely on to tell us the cached path is an empty string, and we don't remove it even though the file would eventually later be cached when we run file.manage_file. This adds some additional logic to ensure that we do check if the file has been cached if sfn is an empty string.

Fixes #49154.

terminalmage added some commits Aug 16, 2018

Fix bug in keep_source for non-templated salt:// file sources
Unless the file is one of A) a remote file source (http/https/ftp/etc.)
or B) being templated, then `file.get_managed` does not cache the file.
Thus, the variable we rely on to tell us the cached path is an empty
string, and we don't remove it even though the file would eventually
later be cached when we run `file.manage_file`. This adds some
additional logic to ensure that we do check if the file has been cached
if `sfn` is an empty string.
@@ -723,6 +723,29 @@ def test_managed_source_hash_indifferent_case(self):
if os.path.exists(name):
os.remove(name)

@with_tempfile

This comment has been minimized.

Copy link
@terminalmage

terminalmage Aug 17, 2018

Author Contributor

@rallytime this will need to become @with_tempfile() (i.e. with parenthesis) once merged into 2018.3.

@cachedout
Copy link
Collaborator

left a comment

Nice find here.

Mike Place
@Ch3LL

Ch3LL approved these changes Aug 17, 2018

@cachedout cachedout merged commit 0157eac into saltstack:2017.7 Aug 18, 2018

6 of 8 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has failed
Details
WIP ready for review
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-centos-7 The py3-centos-7 job has passed
Details

@terminalmage terminalmage deleted the terminalmage:issue49154 branch Aug 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.