facterpy
========
Python library to provide a cached and dictionary-like interface to [Puppet's facter utility](http://puppetlabs.com/puppet/related-projects/facter).
The facter script is run to gather facts, and YAML output is used if pyYAML is installed.
The library is compatibile with Python 2 and Python 3 and *nix and OS X, although testing hasn't been extensive.
Usage
------
```
>>> import facter
>>> f = facter.Facter()
>>> f["architecture"]
'x86_64'
>>> f.lookup("uptime_seconds")
195106
>>> f.lookup("uptime_seconds")
195106
>>> f.lookup("uptime_seconds", cache=False)
195234
>>> f = facter.Facter(use_yaml=False)
>>> f.lookup("uptime_seconds")
'195301'
>>> f.get("not a fact", "mere opinion")
'mere opinion'
```
More methods exist. Documentation to come.
Install
---------
```
pip install facter
```
or
```
pip install facter[yaml]
```
to include pyYAML
Requirements
-------------
Required:
- facter - must be installed through system packages or Ruby Gems
- [six](https://pypi.python.org/pypi/six/) - Python 2 and 3 compatibility (marked in setup.py)
Optional:
- [pyYAML](http://pyyaml.org/wiki/PyYAML) - For YAML parsing of results
Project State
--------------
This is an alpha/early version and it hasn't been tested much. Please report any issues observed.
========
Python library to provide a cached and dictionary-like interface to [Puppet's facter utility](http://puppetlabs.com/puppet/related-projects/facter).
The facter script is run to gather facts, and YAML output is used if pyYAML is installed.
The library is compatibile with Python 2 and Python 3 and *nix and OS X, although testing hasn't been extensive.
Usage
------
```
>>> import facter
>>> f = facter.Facter()
>>> f["architecture"]
'x86_64'
>>> f.lookup("uptime_seconds")
195106
>>> f.lookup("uptime_seconds")
195106
>>> f.lookup("uptime_seconds", cache=False)
195234
>>> f = facter.Facter(use_yaml=False)
>>> f.lookup("uptime_seconds")
'195301'
>>> f.get("not a fact", "mere opinion")
'mere opinion'
```
More methods exist. Documentation to come.
Install
---------
```
pip install facter
```
or
```
pip install facter[yaml]
```
to include pyYAML
Requirements
-------------
Required:
- facter - must be installed through system packages or Ruby Gems
- [six](https://pypi.python.org/pypi/six/) - Python 2 and 3 compatibility (marked in setup.py)
Optional:
- [pyYAML](http://pyyaml.org/wiki/PyYAML) - For YAML parsing of results
Project State
--------------
This is an alpha/early version and it hasn't been tested much. Please report any issues observed.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
facterpy-0.1.tar.gz
(3.9 kB
view details)
File details
Details for the file facterpy-0.1.tar.gz.
File metadata
- Download URL: facterpy-0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28198e1116fc70d71d319a7e4ca75fb392bd2905d119208d2dab89140addc9c4
|
|
| MD5 |
6710be755069c2f9d308b374fab03567
|
|
| BLAKE2b-256 |
86d3cd9bc1a3547da1788b99d5c6e5af8e8d4a27d132de8b796f9b02943eb7dd
|