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

cp.get_dir copies down more directories than specified. #6048

Closed
UtahDave opened this issue Jul 8, 2013 · 3 comments · Fixed by #6050
Closed

cp.get_dir copies down more directories than specified. #6048

UtahDave opened this issue Jul 8, 2013 · 3 comments · Fixed by #6050
Assignees
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@UtahDave
Copy link
Contributor

UtahDave commented Jul 8, 2013

Using cp.get_dir like this works:

sudo salt -G 'os:Ubuntu' cp.get_dir salt://wordpress/wordpress/ '/tmp/davetest'

But if in the source directory there is a wordpress directory as well as a wordpress-backup directory, both directories will be copied down to the target directory.

Possible regex not being anchored correctly?

@ghost ghost assigned terminalmage Jul 8, 2013
@terminalmage
Copy link
Contributor

Should be pretty easy to track down.

@UtahDave
Copy link
Contributor Author

UtahDave commented Jul 8, 2013

Found the source of this little gem:

https://github.com/saltstack/salt/blob/develop/salt/fileclient.py#L286

@terminalmage, do you think we should add '/' to the startswith() or switch to a regex ?

terminalmage added a commit to terminalmage/salt that referenced this issue Jul 8, 2013
The get_dir member function of the salt fileclient was doing a simple
check to see if the path of a target file (or empty dir) started with
the specified salt:// path. As a result, salt://foo would match files
like salt://foo.sh or files within the directory salt://foobar/.

This commit adds a check to ensure that these undesired files/dirs are
not considered a match by the fileclient, and thus do not get
copied/replicated on the minion.

Fixes saltstack#6048.
@terminalmage
Copy link
Contributor

Fix is ready.

terminalmage added a commit that referenced this issue Jul 8, 2013
The get_dir member function of the salt fileclient was doing a simple
check to see if the path of a target file (or empty dir) started with
the specified salt:// path. As a result, salt://foo would match files
like salt://foo.sh or files within the directory salt://foobar/.

This commit adds a check to ensure that these undesired files/dirs are
not considered a match by the fileclient, and thus do not get
copied/replicated on the minion.

Fixes #6048.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants