Skip to content

bisos-pip/facterModule

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bisos.facter: Adoption and adaptation of facter to Python and as Command-Services

Blee Panel Controls:Show-All : Overview : Content : (1) : S&Q : Save : Quit : Bury
Panel Links:Repo Blee PanelBlee Panel
See Also:At PYPI : bisos.PyCS

Overview

bisos.facter provides access to facter information through python.

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 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). Use of bisos.facter as a service, can facilitate central management of multiple systems.

Table of Contents

About facter

Facter is part of puppet, but it can also be used without puppet. Facter gathers information about the system as sets of hierarchical variables.

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.

Part of 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.
BISOS is a foundation for The Libre-Halaal ByStar Digital Ecosystem which is described as a cure for losses of autonomy and privacy in a book titled: Nature of Polyexistentials

bisos.facter is part of BISOS. Within BISOS, bisos.cmdb uses bisos.facter for Configuration Management DataBase purposes.

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:

  1. Provide access to facter facilities through native python.
  2. Provide local access to facter facilities on CLI.
  3. Provide remote access to facter facilities through remote invocation of python Expectation Complete Operations using rpyc.
  4. 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 are 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.

Installation With pip

If you need access to bisos.facter as a python module, you can install it with pip:

pip install bisos.facter

Installation 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
  • facter-roInv.cs
  • facter-roPerf.cs

These are all one file with 3 names. facter-roInv.cs and facter-roPerf.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

Local Usage (system command-line)

facter.cs does the equivalent of facter.

bin/facter.cs

Remote Usage (as a service – Performer+Invoker)

You can also run:

Performer

Invoke performer as:

bin/facter-roPerf.cs

Invoker

bin/facter-roInv.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 ./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/facter-roPerf.cs ./bin/facter-roInv.cs)

The 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.facter_csu and bisos.banna.bannaPortNu modules.

./py3/bisos/facter/facter.py (COMEEGA Python)

The 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/facter_conv.py (Conventional Python)

The file ./py3/bisos/facter/facter_conv.py is same as ./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 facter_conv.py can be considered as conventional sample code.

./py3/bisos/facter/facter_csu.py

The 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 facter_csu.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 ./py3/setup.py files that are driven by ./py3/pypiProc.sh.

The ./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 ./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 ./py3/panels/_nodeBase_/fullUsagePanel-en.org for a starting point.

Support

For support, criticism, comments and questions; please contact the author/maintainer
Mohsen Banan at: http://mohsen.1.banan.byname.net/contact

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.

About

Loadable Modules That Process Facter Information

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published