Skip to main content

Simple module containing various types of resource to manage files.

Project description

inmanta-module-files

pypi version build status

This package is an adapter that is meant to be used with the inmanta orchestrator: https://docs.inmanta.com

Features

This module allows to manage files, on a unix host. It contains the following resources:

  1. files::Directory: to manage a directory, its existence, permissions and ownership.
  2. files::TextFile: to manage a simple text file, its existence, content, permissions and ownership. This should not be used for big files, as the content of the file is embedded in the resource itself.
  3. files::HostFile: to manage hosts file entries (i.e. /etc/hosts), but allowing the file to be managed by other tools. The resource makes sure to only modify the entries defined in its desired state and leave the rest untouched.
  4. files::JsonFile and files::SharedJsonFile: to manage json file entries. Similarly to files::HostFile, only change in the file what is present in the desired state. The file can then still be modified by other tools.
  5. files::SystemdUnitFile: an entity representing a unit file, which exposes it most useful properties directly in the model. After being exported, this resource becomes nothing more than a text file.
  6. files::Symlink: to manage a symlink, its existence and ownership.

Example

The following example makes sure that the directory /tmp/test/a exists, and creates a text file in it.

import mitogen
import files

import std

host = std::Host(
    name="localhost",
    os=std::linux,
    via=mitogen::Local(),
)

dir = files::Directory(
    host=host,
    path="/tmp/test/a",
    # The directory that is managed is /tmp/test/a, but the resource
    # will also make sure that any of its parent directories exists as well
    create_parents=true,
)

file = files::TextFile(
    host=host,
    path=f"{dir.path}/file.txt",
    content="test",
    # The file requires the directory to be created first
    requires=[dir],
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inmanta_module_files-2.7.1.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inmanta_module_files-2.7.1-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file inmanta_module_files-2.7.1.tar.gz.

File metadata

  • Download URL: inmanta_module_files-2.7.1.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inmanta_module_files-2.7.1.tar.gz
Algorithm Hash digest
SHA256 3373c9a82647f01e452b4f4aae5cda712e0c55785df3cbcc4c6821128153f9f1
MD5 8b5febae39b08246e6d62b8c757191b0
BLAKE2b-256 53aad2bc33e0cbe0a37a0919c8953dc4362ad83de1eb97091369fff975e2d15b

See more details on using hashes here.

Provenance

The following attestation bundles were made for inmanta_module_files-2.7.1.tar.gz:

Publisher: continuous-delivery.yml on edvgui/inmanta-module-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inmanta_module_files-2.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for inmanta_module_files-2.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad636b4b1a42c8f835e039283d977e6ddc1463fb434b0278adffbd32f351d77
MD5 20fc100492cfe8de7410c886c33e6afc
BLAKE2b-256 ebf941debd8c2da448fdc02e694bd0bfe2e2878bab9359404cc246e3071d644a

See more details on using hashes here.

Provenance

The following attestation bundles were made for inmanta_module_files-2.7.1-py3-none-any.whl:

Publisher: continuous-delivery.yml on edvgui/inmanta-module-files

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page