Skip to main content

Return facts of server

Project description

Returns facts of local machine.

Installation

pip install facts

CLI Usage

Get all facts:

facts all

Get one fact:

fact read foo

Set one custom fact:

fact write foo 'It is nice'

When value is a mapping, then you can choose between 2 merging strategies:

fact write foo '{is: bar}' --format yaml --replace
fact write foo '{not: baz}' --format yaml --merge

Delete a custom fact:

fact delete foo

Targeting

By convention key facts can’t have colon marks. Because facts can be nested, and it’s possible to target these sub data. Each parts must be seperated by a colon. For example if:

fact read foo

returns:

is: bar
not: baz

Then:

fact read foo:is

returns:

bar

But:

fact read foo:wrong:key

will return nothing.

Matching

It is also possible to check if a certain fact turns out true:

fact match foo:is:bar

Extending

You can extend with your own facts. Any python modules under ~/.facts/grafts will be loaded. For example:

# ~/.facts/grafts/my_grafts.py

from . import graft

@graft
def hello_world():
    return {
        'hello': 'world'
    }

Will append the fact hello with the value world.

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

facts-0.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

facts-0.1-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file facts-0.1.tar.gz.

File metadata

  • Download URL: facts-0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for facts-0.1.tar.gz
Algorithm Hash digest
SHA256 25bf0415841bf7091a539194bb189202dffe8ee12504e1a0b3bfa24775207660
MD5 5ec59ee1c3e09c31035cdff9da9268d8
BLAKE2b-256 835efdef4283a73ad9eaedaae6c1731b6c2749f90278d538d157846c189d40fe

See more details on using hashes here.

File details

Details for the file facts-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for facts-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c665db4611aaec350c45c7958e572803320af47de76d5dfcf3b0568afe49d753
MD5 3b0a54cb5f9509958ba1b84a355deca2
BLAKE2b-256 4e8e5295b428d5872adca4e948c388666908927d1ab4a9d03681581a3366fa64

See more details on using hashes here.

Supported by

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