Func-inventory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

It's time to showcase another neat app written using func. It's "func-inventory". Func-inventory is just 153 lines of Python, and I wrote the initial version in about half of a day. I'm not saying that to brag, I'm saying that because this means func is *REALLY* simple to build new applications on. What does Func-inventory do? It's an app that allows for inventorying (and inventory tracking) of anything. Anything that has a func module can be stored, and the inventory is kept over time in version control, to see what items have been added or changed.

We're going to ship func-inventory in the func RPM, so it will be part of the standard toolset.

How about an example?

# func-inventory --verbose

Simple enough? By default, running func-inventory updates everything that is known about all things func (on all minions) into a tree in /var/lib/func/inventory.

Type "tree /var/lib/func/inventory" to see what I'm talking about. Bonus feature: Unless you specify "--no-git", this directory is automagically managed with git version control, so you can view changes using tools like "git log", "gitk" (a GUI app), or (if you set it up) GitWeb. For those unfamiliar with git, git is a powerful distributed version control system used by the Linux kernel. It supports writing arbitrary triggers, so you could have git email you reports of when your configuration changes. We may include some of those scripts with func, or we may eventually come up with some more advanced (module-specific) triggers for func to use to report on inventory changes.

The app also has lots of other shiny options, some of which are shown below. You can read the "func-inventory" manpage for more details.

func-inventory --tree /opt/put/my/files/here --server-spec "mailservers*.example.org" --modules hardware,packages --verbose

This would dump the inventory data of only your mailservers (and only from two func modules, hardware and packages) to the directory specified above.

One note ... Currently by default, we index all modules that have an info() method. Since some modules change state too often to be part of inventory, we'll most likely have an inventory() method in the future, which will frequently be aliased (but not always) to what info() returns now. You can also override the methods and modules
being inventoried on the command line.

I've only lightly tested the option handling so far (testing/upgrades to this are on the list for this week), though if anyone would like to play with it, just install the latest func, install git-core on the minion, and have at it.
Thanks!

--Michael


[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux