Skip to main content

Systemd Unitfile Linter

Project description

Build status PyPI version Python version Downloads Language grade: Python

Systemd Unitfile Linter

Usage

usage: systemdlint [-h] [--nodropins] [--rootpath ROOTPATH]
                   [--sversion SVERSION] [--output OUTPUT]
                   files [files ...]

Systemd Unitfile Linter

positional arguments:
  files                Files to parse

optional arguments:
  -h, --help           show this help message and exit
  --nodropins          Ignore Drop-Ins for parsing
  --rootpath ROOTPATH  Root path
  --sversion SVERSION  Version of Systemd to be used
  --output OUTPUT      Where to flush the findings (default: stderr)

Installation

PyPi

simply run

pip3 install systemdlint

From source

  • Install the needed requirements by running pip3 install systemdunitparser anytree

  • git clone this repository

  • cd to <clone folder>/systemdlint

  • run sudo ./build.sh

Output

The tool will return

{file}:{line}:{severity} [{id}] - {message}

example:

/lib/systemd/system/console-shell.service:18:info [NoFailureCheck] - Return-code check is disabled. Errors are not reported
/lib/systemd/system/plymouth-halt.service:11:info [NoFailureCheck] - Return-code check is disabled. Errors are not reported
/lib/systemd/system/systemd-ask-password-console.service:12:warning [ReferencedUnitNotFound] - The Unit 'systemd-vconsole-setup.service' referenced was not found in filesystem
/lib/systemd/system/basic.target:19:warning [ReferencedUnitNotFound] - The Unit 'tmp.mount' referenced was not found in filesystem

Detectable Errors

  • ConflictingOptions - The set option somehow is in conflict with another unit

  • ErrorCyclicDependency - Unit creates a cyclic dependency

  • ExecNotFound - The referenced executable was not found on system

  • FullPrivileges - An executable is run with full privileges

  • InvalidNumericBase - A numeric value doesn’t match because it needs to be a multiple of X

  • InvalidSetting - The option doesn’t match the section

  • InvalidValue - An invalid value is set

  • MandatoryOptionMissing - A mandatory option was missing in the file

  • Multiplicity - The option is not valid for the given amount of options in this context

  • NoExecutable - The referenced executable is NOT executable

  • NoFailureCheck - An executable is run without checking for failures

  • OptionDeprecated - The used option is not available anymore in this version

  • OptionTooNew - The used option will be available in a later version than used

  • ReferencedUnitNotFound - The unit referenced was not found in system

  • SettingRequires - The option requires another option to be set

  • SettingRestricted - The option can’t be set due to another option

  • SyntaxError - The file is not parsable

  • UnitSectionMissing - The Unit-section is missing in the file

  • UnknownUnitType - The file extension of the file is not a known systemd one

  • WrongFileMask - The file has a risky filemode set

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

systemdlint-1.1.6.tar.gz (29.6 kB view details)

Uploaded Source

File details

Details for the file systemdlint-1.1.6.tar.gz.

File metadata

  • Download URL: systemdlint-1.1.6.tar.gz
  • Upload date:
  • Size: 29.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.5

File hashes

Hashes for systemdlint-1.1.6.tar.gz
Algorithm Hash digest
SHA256 90351baa4a5d29d75e978e1dfb8d6dc25bcb1dc63406867a6ba6a19ca226d87a
MD5 b94820be167f4a2eed4cca3d111043be
BLAKE2b-256 803cd91ce5e6f0d47d091789bacc2f0773adac41ca0901f4e6a96c026797b199

See more details on using hashes here.

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