bisos.facter: Adoption and adaptation of facter to Python and as Command-Services
Project description
Overview
bisos.facter is a python package that uses the PyCS-Framework for adoption and adaptation of facter to python and PyCS-Framework. It is a BISOS-Capability and a Standalone-BISOS-Package.
bisos.facter provides access to facter information through python.
bisos.facter is based on the PyCS-Foundation and can be used both as a Command and as a Service (invoke/perform model of remote operations) using RPYC for central management of multiple systems.
Table of Contents TOC
About facter
Facter gathers information about the system, which can be used as variables. Facter is part of puppet, but it can also be used without puppet.
To install facter:
sudo apt-get install -y facter
Facter is a ruby package. This bisos.facter python package provides access to facter information through python both locally and remotely.
About BISOS — ByStar Internet Services Operating System
Layered on top of Debian, BISOS: (By* Internet Services Operating System) is a unified and universal framework for developing both internet services and software-service continuums that use internet services. See Bootstrapping ByStar, BISOS and Blee for information about getting started with BISOS.
Within BISOS, bisos.cmdb uses bisos.facter for Configuration Management DataBase purposes.
bisos.facter as a PyCS facility is a small piece of a much bigger picture. BISOS is a foundation for The Libre-Halaal ByStar Digital Ecosystem which is described as a cure for losses of autonomy and privacy that we are experiencing in a book titled: Nature of Polyexistentials
bisos.facter is a Command-Services PyCS Facility
bisos.facter can be used locally on command-line or remotely as a service. bisos.facter is a PyCS multi-unit command-service. PyCS is a framework that converges development of CLI and Services. PyCS is an alternative to FastAPI, Typer and Click.
bisos.facter uses the PyCS-Framework to:
Provide access to facter facilities through native python.
Provide local access to facter facilities on CLI.
Provide remote access to facter facilities through remote invocation of python Expectation Complete Operations using rpyc.
Provide remote access to facter facilities on CLI.
What is unique in the PyCS-Framework is that these four models are all a single abstraction.
The core of PyCS-Framework is the bisos.b package (the PyCS-Foundation). See https://github.com/bisos-pip/b for an overview.
bisos.facter as a Standalone Piece of BISOS
bisos.facter is a standalone piece of BISOS. It can be used as a self-contained Python package separate from BISOS. Follow the installation and usage instructions below for your own use.
Installation
The sources for the bisos.facter pip package is maintained at: https://github.com/bisos-pip/facter.
The bisos.facter pip package is available at PYPI as https://pypi.org/project/bisos.facter
You can install bisos.facter with pip or pipx.
With pip
If you need access to bisos.facter as a python module, you can install it with pip:
pip install bisos.facter
With pipx
If you only need access to bisos.facter on command-line, you can install it with pipx:
pipx install bisos.facter
The following commands are made available:
facter.cs
roInv-facter.cs
roPerf-facter.cs
These are all one file with 3 names. roInv-facter.cs and roPerf-facter.cs are sym-links to facter.cs
Post Installation Basic Testing
After the installation, run some basic tests:
facter.cs
facter networking.interfaces.lo.bindings
Usage
Locally (system command-line)
facter.cs does the equivalent of facter.
bin/facter.cs
Remotely (as a service – Performer+Invoker)
You can also run:
Performer
Invoke performer as:
bin/roPerf-facter.cs
Invoker
bin/roInv-facter.cs
Use by python script
bisos.facter Source Code is in written in COMEEGA (Collaborative Org-Mode Enhanced Emacs Generalized Authorship) – https://github.com/bx-blee/comeega.
The primary API for bisos.facter is file:./py3/bisos/facter/facter_csu.py. It is self documented in COMEEGA.
bisos.facter as an Example of Command Services (PyCS) – Code Walkthrough
An overview of the relevant files of the bisos.facter package is provided below.
./py3/bin/facter.cs (./bin/roPerf-facter.cs ./bin/roInv-facter.cs)
The file file:./py3/bin/facter.cs is a CS-MU (Command-Services Multi-Unit). It is fundamentally a boiler plate that has the main framework org-mode Dynamic Block and which imports its commands from bisos.facter.factercsu and bisos.banna.bannaPortNu modules.
./py3/bisos/facter/facter.py (COMEEGA Python)
The file file:./py3/bisos/facter/facter.py includes functions that run a sub-process with “facter –json”, obtain the json result as a collection of namedtuples. This can then be subjected to caching and then retrieved based on string representations mapping to namedtuples.
./py3/bisos/facter/facterconv.py (Conventional Python)
The file file:./py3/bisos/facter/facter_conv.py is same as file:./py3/bisos/facter/facter.py without use of COMEEGA. Without Emacs, it is not easy to read the COMEEGA files and some people prefer not to use or know about COMEEGA. In such situations facterconv.py can be considered as conventional sample code.
./py3/bisos/facter/factercsu.py
The file file:./py3/bisos/facter/facter_csu.py is a CS-U (Command-Services Unit). It includes definitions of commands and their CLI params and args.
Implementation of commands in factercsu.py rely on facilities provided in facter.py.
PyPi and Github Packaging
All bisos-pip repos in the https://github.com/bisos-pip github organization follow the same structure. They all have file:./py3/setup.py files that are driven by file:./py3/pypiProc.sh.
The file:./py3/setup.py file is a series of consistent org-mode Dynamic Block that automatically determine the module name and the installed and pypi revisions.
The file:./py3/pypiProc.sh uses setup.py and pushes to pypi when desired and allows for isolated testing using pipx.
Documentation and Blee-Panels
bisos.facter is part of ByStar Digital Ecosystem http://www.by-star.net.
This module’s primary documentation is in the form of Blee-Panels. Additional information is also available in: http://www.by-star.net/PLPC/180047
bisos.facter Blee-Panels
bisos.facter Blee-Panles are in ./panels directory. From within Blee and BISOS these panles are accessible under the Blee “Panels” menu.
See file:./py3/panels/_nodeBase_/fullUsagePanel-en.org for a starting point.
Support
Planned Improvements
One material use of bisos.facter is to facilitate developement of an automated Configuration Management DataBase (CMDB) as a centralized facility that organizes information about system, including the relationships between hardware, software, and networks. On a per-system base, bisos.facter can obtain much of that information and through PyCS it can deliver that information remotely to centralized CMDBs. In this context CMDBs generally function as invokers and we need to facilitate ever present bisos.facter performers.
The CMDB invoker part is implemented as bisos.cmdb.
Each BISOS platform needs to run an instance under systemd. I have done something similar to this for bisos.marmee. That piece need to be absorbed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.