Package: pyconverge
|GitHub tag| |GitHub release| |PyPI| |Py Versions||Build Status| |Coverage Status| |Quality Gate| |Code Smells| |FileComplexity| |Vulnerabilities| |Technical Dept| |Lines of code|converge========*Resolve Data from Abstract Hierarchies and Templates*Managing configuration is hard. More often than not you have highkey/values duplication and storage.`DRY <https://en.wikipedia.org/wiki/Don't_repeat_yourself>`__ yourtears, it's time for some hierarchical magic, so you can get back to theimportant stuff.This is where **converge** comes in. There are a few basic concepts whenusing or extend converge: \* Readers: get data from your backends \*Filters: filter data before or after resolution (*example: search &replace values, inject data post resolution*) \* Resolvers: convertabstract data to resolved data \* Writers: output your data to theformat and backend you needAbstract hierarchies of data chewed up and spit out to your liking.Getting started===============install pyconverge, this will add the ``converge`` command to yourclasspath using setup.py/PyPi.. code:: bashpip install pyconvergeconverge versionconverge --helpCreate a converge.yaml.template file in your project working directory,modify and move it to converge.yaml.. code:: bash# create the converge.yaml.template fileconverge init conf# modify your converge parametersvim converge.yaml.template# activate convergemv converge.yaml.template converge.yaml# verify the integrity of your configuration fileconverge checkTry it out! You chould have a bunch more options!.. code:: bashconverge --helpExample: Simple testing=======================create a converge.yaml as described above.. code:: bashconverge init confmv converge.yaml.template converge.yamlconverge checkCreate a sample repository structure.. code:: bashconverge init repository target_directory# you should now have the following structurefind target_directory/ -type d# this is where the application centric data goes./data./data/default./data/default/shared./data/default/app# the hierarchy file is situated here./hierarchy# target (or host for most) centric data resides here./targets./targets/hosts./targets/mappingConfiguration=============converge.yaml-------------This file is a bit peculiar, it allows you to add programs, options,configurations on the fly. Let's try it out before adding theconverge.yaml:.. code:: bashconverge --help# positional arguments:#  {init,check,version}#    init                initialize configuration or repository#    check               run sanity check on configuration#    version             get converge version and build informationPut the following in a converge.yaml:.. code:: yamlconf:default:logging_level: "INFO"programs:# user commandamazingcommand:# arguments expected by the commandargs:- "argument_one"- "argument_two"# description for the python helpdescription: "application description"modes:amazing_mode_one:- "com.insane.class.path.Class1"- "com.insane.class.path.Class2"amazing_mode_two:- "com.insane.class.path.Class1"- "com.insane.class.path.Class3"Now you should see a new option:.. code:: bashconverge --help# positional arguments:#  {init,check,version,amazingcommand}#    init                initialize configuration or repository#    check               run sanity check on configuration#    version             get converge version and build information#    amazingcommand      application description <-- MAGIC STUFF with description!!And even more so there are sub-options available too:.. code:: bashconverge amazingcommand --help# usage: converge-runner.py amazingcommand [-h]#                                         argument_one argument_two#                                         {amazing_mode_two,amazing_mode_one}## positional arguments:#  argument_one#  argument_two#  {amazing_mode_two,amazing_mode_one}Classpath Execution Explained-----------------------------Those classpaths you listed under the modes, will be executed expectinga method matching the following:.. code:: pythondef run(self, data, conf, **kwargs):"""Args:data (dict): The data object that is passes and returned from all class runsconf (dict): Dictionary of all configurations found in converge.yaml (directories, logging etc)kwargs (object): magical python variable variable variables.Returns:dict: the data object that will be passed to all following class-runs."""return dataExample: Configuration for Java property files==============================================A rough overview================A general example in diagram form:.. figure:: docs/converge-diagram.png:alt: Converge OverviewAlt textA Brief History of Pain=======================You may have hit some (or all) of these stages in the pursuit ofconfigurability:*In short: from the file, to the GUI, back to the file you idiot.*#wevecomefullcircle \* Externalize configuration from your applications,to avoid re-releases due to simple conf tuning \* Realizing that you'renow managing a million de-centralized files with no similar structure \*Create or use a centralized, GUI/DB based configuration managementsystem (woohoo! configuration liberation!) \* Realizing that you aremissing flexibility, automation is complex, added abstraction layers arepainful.The better model is to accept any data format, process it and output itas you wish.Files are better because: \* you can use time tested versioning systemslike git or mercurial to branch, release, rollback, check history \* youcan automate the modification of files with any tool you want \* doingmigrations/deployment/modifications on DB values/REST endpoints sucks(unnecessarily complex).. |GitHub tag| image:: https://img.shields.io/github/tag/drewboswell/converge.svg:target:.. |GitHub release| image:: https://img.shields.io/github/release/drewboswell/converge.svg:target:.. |PyPI| image:: https://img.shields.io/pypi/v/pyconverge.svg:target: https://pypi.python.org/pypi/pyconverge/.. |Py Versions| image:: https://img.shields.io/pypi/pyversions/pyconverge.svg:target: https://pypi.python.org/pypi/pyconverge/.. |Build Status| image:: https://travis-ci.org/drewboswell/converge.svg?branch=master:target: https://travis-ci.org/drewboswell/converge.. |Coverage Status| image:: https://coveralls.io/repos/github/drewboswell/converge/badge.svg?branch=master:target: https://coveralls.io/github/drewboswell/converge?branch=master.. |Quality Gate| image:: https://sonarqube.com/api/badges/gate?key=drewboswell_converge:target: https://sonarqube.com/dashboard/index/drewboswell_converge.. |Code Smells| image:: https://sonarqube.com/api/badges/measure?key=drewboswell_converge&metric=code_smells:target: https://sonarqube.com/dashboard/index/drewboswell_converge.. |File Complexity| image:: https://sonarqube.com/api/badges/measure?key=drewboswell_converge&metric=file_complexity:target: https://sonarqube.com/dashboard/index/drewboswell_converge.. |Vulnerabilities| image:: https://sonarqube.com/api/badges/measure?key=drewboswell_converge&metric=vulnerabilities:target: https://sonarqube.com/dashboard/index/drewboswell_converge.. |Technical Dept| image:: https://sonarqube.com/api/badges/measure?key=drewboswell_converge&metric=sqale_debt_ratio:target: https://sonarqube.com/dashboard/index/drewboswell_converge.. |Lines of code| image:: https://sonarqube.com/api/badges/measure?key=drewboswell_converge&metric=ncloc:target: https://sonarqube.com/dashboard/index/drewboswell_converge