docs icon indicating copy to clipboard operation
docs copied to clipboard

Docs on lockfile creation are outdated

Open lmbarros opened this issue 1 year ago • 1 comments

Our Update Locking docs provide some code snippets to show users how to create lockfiles correctly in some languages. I found that at least two of these snippets are outdated.

The shell snippet uses lockfile, which AFAICT was part of procmail, which is unmaintained for a long time. I am not sure what would be the modern replacement. Maybe the utilities in the lockfile-progs package -- though it doesn't seem to be available for Alpine Linux, so I am not sure it is a good choice.

The Python snipped still uses Python 2 syntax, and is based on a library that appears to be deprecated. I am not a Python connoisseur, but I did some tests (using the newer filelock library) and this looks like the modern equivalent:

from filelock import FileLock

lock = FileLock("/tmp/balena/updates.lock")
with lock:
    print(lock.lock_file, 'is locked.')

About this issue tracker

Before creating a issue, check for duplicates. If there is another issue describing the same bug or problem, please add comments to pre-existing issues or link them to add more context.

While creating a new issue, always make sure to provide as much context as possible with an expected solution or change that you would like to see in the documentation. This helps contributors understand the issue and execute a better solution.

If applicable, please add additional links to GitHub projects, forums.balena.io threads, gist.github.com, Google Drive attachments, screenshots, JF/FD/Front threads for reference, etc.

Thank you for creating an issue and helping us improve balenaCloud's documentation!

lmbarros avatar May 11 '23 20:05 lmbarros

@cywang117 @kb2ma @pipex I understand lockfile and its creation are under the domain of the supervisor. Can we make improvements to these examples mentioned in this issue to provide updated information for our users.

vipulgupta2048 avatar May 29 '23 07:05 vipulgupta2048