Skip to main content

Human-oriented CLI for interacting with CFEngine policy language, projects, and other CFEngine tools

Project description

CFEngine command line interface (CLI)

A CLI for humans to interact with CFEngine, enabling downloading and installing packages, building policy sets, deploying, and enforcing policy. It is practically a wrapper around our other tools, like cf-agent, cf-hub, cf-remote and cfbs.

Warning: This is an early version. Things might be missing or changed. Proceed with caution and excitement.

Installation

Install using pip:

pip install cfengine

Usage

Run the CFEngine agent - evaluate and enforce policy

cfengine run

CFEngine CLI help

cfengine help

Print CFEngine CLI version

cfengine version

Automatically format source code

cfengine format

Check for errors in source code

cfengine lint

You can also specify filenames or folders;

cfengine lint main.cf

When it finds a mistake, it points out where the problem is like this;

    "Hello, CFEngine"
      ifvarclass => "cfengine";
      ^--------^
Deprecation: Use 'if' instead of 'ifvarclass' at main.cf:5:7
FAIL: main.cf (1 error)
Failure, 1 error in total.

Note that since we use a different parser than cf-agent / cf-promises, they are not 100% in sync. cf-agent could point out something as a syntax error, while cfengine lint does not and vice versa. We aim to make the tree-sitter parser (used in this tool) more strict in general, so that when cfengine lint is happy with your policy, cf-agent will also accept it. (But the opposite is not a goal, that cfengine lint must accept any policy cf-agent would find acceptable).

Build a policy set

cfengine build

(This is equivalent to running cfbs build).

Spawn and install cfengine from a config

this feature is still a work in progress

Given a yaml config:

templates:
  ubuntu:
    provider: vagrant
    vagrant:
      box: ubuntu/focal64

groups:
  myhub:
    role: hub
    source:
      count: 1
      mode: spawn
      spawn: ubuntu

up will spawn the necessary VMs and install cfengine using cf-remote

cfengine up config.yaml

Supported platforms and versions

This tool will only support a limited number of platforms, it is not intended to run everywhere CFEngine runs. Currently we are targeting:

  • Officially supported versions of macOS, Ubuntu, and Fedora.
  • Officially supported versions of Python.

It is not intended to be installed on all hosts in your infrastructure. CFEngine itself supports a wide range of platforms, but this tool is intended to run on your laptop, your workstation, or the hub in your infrastructure, not all the other hosts.

Backwards compatibility

This CLI is entirely intended for humans. If you put it into scripts and automation, expect it to break in the future. In order to make the user experience better, we might add, change, or remove commands. We will also be experimenting with different types of interactive prompts and input.

Development, maintenance, contributions, and releases

Looking for more information related to contributing code, releasing new versions or otherwise maintaining the CFEngine CLI? Please see the HACKING.md file.

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

cfengine-0.16.0.tar.gz (189.5 kB view details)

Uploaded Source

Built Distribution

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

cfengine-0.16.0-py3-none-any.whl (98.4 kB view details)

Uploaded Python 3

File details

Details for the file cfengine-0.16.0.tar.gz.

File metadata

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

File hashes

Hashes for cfengine-0.16.0.tar.gz
Algorithm Hash digest
SHA256 1ae7fc31917d687bf7b9d4257fd84d2b2c34a4ffcf0362cce9de699946bfa02c
MD5 197255dda56570890b0560661af8ce87
BLAKE2b-256 895fdffe8408b17ada80683e64bfec47d0acc8df75d35ca73128ee374e98ef18

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfengine-0.16.0.tar.gz:

Publisher: pypi-publish.yml on cfengine/cfengine-cli

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

File details

Details for the file cfengine-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: cfengine-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 98.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cfengine-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8982a6c938a2b382ffb1a9a6f32a170692daf6e4ec58b64d6d36b94be9cb7f13
MD5 6c4fb78bb06c29c6f42c328eb9e56543
BLAKE2b-256 66b281a9bbe99384c46c4f55205d7e250ba75e63655fd817cd6032976436273d

See more details on using hashes here.

Provenance

The following attestation bundles were made for cfengine-0.16.0-py3-none-any.whl:

Publisher: pypi-publish.yml on cfengine/cfengine-cli

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