Code Guidelines
When contributing code to ansible-cmdb, please keep the following in mind:- Code should be reasonably PEP8-like. We’re not too strict on this.
- One logical change per merge request.
- By submitting a merge request or putting code in comments, you automatically grant permission to include this code in ansible-cmdb under the GPLv3 license.
- The copyright for contributed code is retained by the contributor.
- Please don’t be disappointed if your contributions end up unused. We appreciate all contributions, but maintain strict standards for code quality and feature scope.
Development Setup
Set up the Python environment
Export the
PYTHONPATH to run ansible-cmdb directly from the git repository:Install dependencies
Install the required Python packages:For building packages and documentation, you’ll also need:
- git
- make
- python-markdown
- zip
- fakeroot
- alien
- Python ‘wheel’ package
Running Tests
Ansible-cmdb uses sla (the Simple Little Automator) for builds and tests. You don’t need to havesla installed - you can run rules directly in your shell:
Testing Your Changes
When testing releases or your changes, here are some common test scenarios: Testing from GitHub source:Build System
Available Build Targets
The following build targets are available:test- Run testsexample- Generate example CMDBdoc- Generate documentationclean- Remove build artifacts and other trashrelease_src- Create release package (source tar.gz)release_deb- Create release package (Debian/Ubuntu)release_wheel- Create release package (wheel)release- Create all release packagesinstall- Install ansible-cmdbuninstall- Uninstall ansible-cmdb
Building Releases
To build Debian, RedHat and source packages, you’ll need a Debian-based operating system with the dependencies listed above. Build packages with:VERSION is an arbitrary version number.
Submitting Pull Requests
Push and create a pull request
Push your changes to your fork and create a pull request on the main repository:
Reporting Bugs and Feature Requests
When reporting bugs:- Provide output of
ansible-cmdb --debug - Reduce your facts (delete some of the
ansible -m setupoutput files) until you’re left with a single fact file that still reproduces the problem - If possible, attach the problematic fact file
Please do not file feature requests for column additions. Every user has different requirements and adding endless variety of columns is impractical. You can easily add custom columns yourself. Pull requests are welcome if you believe the columns are useful for a wide audience.
License
Ansible-cmdb is licensed under the GPLv3. By contributing, you agree that your contributions will be licensed under the same license.Getting Help
If you have questions about contributing, please:- Check the full documentation
- Open an issue on GitHub
- Review existing pull requests to see how others have contributed