Skip to content

Docs on lockfile creation are outdated #2702

Open
@lmbarros

Description

@lmbarros

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions