This project has been created to provide salt modules and states for SAP HANA and other SAP applications and the SLE-HA clustering tools. For that, it wraps the shaptools project code. The main idea is to use this module in salt formulas to deploy these applications easily.
INFO: Currently this project has been created as an independent project, but the idea is to merge to the salt project to extend it with these new functionalities.
To run the module functionalities locally run:
cd salt-shaptools
sudo salt-call --local -m modules hana.is_installed
To run the state modules (there is a demo example in the demo folder) run:
cd salt-shaptools
sudo salt-call --retcode-passthrough -l debug -m . state.template demo/primary.sls
To run the module funcionalities in the minions:
- Copy the content of modules in your "salt://_modules/" (by default /srv/salt/_modules)
- Copy the content of states in your "salt://_states/" (by default /srv/salt/_states)
- Synchronize modules with the minions. For that run:
sudo salt-call saltutil.sync_all
- Execute the module functionalities. For that run:
sudo salt-call hana.is_installed
You can have look at: https://docs.saltstack.com/en/latest/topics/development/tests/unit.html
Salt has a quite particular way to execute the tests. As a summary, tests are splitted in integration and unit tests. The first group tests the module using actual salt master/minions, so the setup is more complicated. The unit tests in the other hand only check the code functions.
In order to execute the tests, the test files must be stored in 7392 the salt project tests folder sub-folder (integration or unit, for example). By now, as the project is in a separated repository, the easiest way is to copy our project code to a actual salt repository and run the tests. For that follow the next instructions:
- Download 2 needed extra projects: (saltstack and shaptools)
git clone --depth=50 https://github.com/openSUSE/salt
git clone https://github.com/SUSE/shaptools.git
Your directory layout should looks like ( all the 3 dirs are in same three dir level)
- salt-shaptools
- salt
- shaptools
- Create a virtual environment, inside the
salt-shaptools
dir and install dependencies:
virtualenv saltvirtenv
source saltvirtenv/bin/activate
pip install pyzmq PyYAML pycrypto msgpack-python jinja2 psutil futures tornado pytest-salt mock pytest-cov
pip install -e ../salt
pip install -e ../shaptools
rm ../salt/tests/conftest.py # remove this file from the saltstack repo
- Run the tests. For that:
cd salt-shaptools
sudo chmod 755 tests/run.sh
./tests/run.sh
- Running your modules/states:
For testing/running modules:
salt-call --local saptune.apply_solution "SAP-ASE"
For testing/running states:
salt-call --local state.single saptune.solution_applied "HANA"
List of dependencies are specified in the "Requirements file". Items can be installed using pip:
pip install -r requirements.txt
See the LICENSE file for license rights and limitations.
Xabier Arbulu Insausti (xarbulu@suse.com)
Pull request preferred reviewers for this project:
- Xabier Arbulu Insausti (xarbulu@suse.com)