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

files.sync does not remove existing symlinks #1061

Open
Snektron opened this issue Jan 22, 2024 · 3 comments
Open

files.sync does not remove existing symlinks #1061

Snektron opened this issue Jan 22, 2024 · 3 comments
Labels
Bug Label for all kind of bugs.

Comments

@Snektron
Copy link

Describe the bug

As the title describes, using the files.sync operation on a remote directory which contains symlinks that are not present in the local version, they are not deleted.

To Reproduce

  1. Create a file files/update-motd.d/something (put anything in it, its irrelevant)
  2. For example, run the following against a ubuntu 22.04 host:
files.sync(
    name="Update MOTD",
    src="files/update-motd.d/",
    dest="/etc/update-motd.d",
    delete=True,
)

This will leave the /etc/update-motd.d directory as follows:

/etc/update-motd.d/
  something
  50-landscape-sysinfo

the latter is a symlink. This should be reproducible for any directory which contains such a symlink that is not present locally, though.

Expected behavior

I'm not sure the expected behavior would be to have the symlink be removed, but IMO there should at least be an option for it.

Meta

Running pyinfra v2.9, installed from pip

@Snektron Snektron added the Bug Label for all kind of bugs. label Jan 22, 2024
@sysadmin75
Copy link
Contributor

I see why this is happening. However, I'm not sure how @Fizzadar wants this operation to handle symlinks. It's an easy fix if Fizzadar wants this operation to handle symlinks.

@sysadmin75
Copy link
Contributor

Maybe this isn't as straight forward as I first thought. In any case, we still need to know if the sync operation should be expanded to handle symlinks.

@Fizzadar
Copy link
Member

Fizzadar commented Feb 4, 2024

Yes I think it should. Ideally the sync op should be like rsync’s archive mode I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Label for all kind of bugs.
Projects
None yet
Development

No branches or pull requests

3 participants