Python Module that parses salt returns stored in an external job cache and logs output
Project description
salt-nanny
Python Module that parses salt returns stored in redis and logs output
Example Usage:
Command Line Usage:
salt-nanny localhost minion1 minion2
Look for salt returns in localhost for minions - minion1 & minion2
salt-nanny localhost minion1 minion2 -p 6380 -x 20 -I 5 60 2
This command tells salt-nanny to wait 5, 10, 20, 40 and 60 seconds between each retry initially and then 60s for subsequent retries. Attempt 20 times and then give up. Use port 6380 for redis.
Example Python code:
#!/usr/bin/env python import salt.client from saltnanny import SaltNanny # Initialize SaltNanny with the cache & salt function config = {'type': 'redis', 'host':'localhost', 'port':6379, 'db':'0'} nanny = SaltNanny(config, 'test', 'state.highstate') # Use SaltNanny to track returns to the external job cache salt_nanny.initialize(['minion1', 'minion2']) salt_nanny.track_returns() return_code = salt_nanny.process_returns()
For the example above, the log file in logs/test-state.highstate.log will contain results of the salt highstate
The return code is 0 if all the salt functions for all minions succeded with a return dict containing retcode:0.
SaltNanny also checks state results in case of a highstate. If any one state fails, the retcode is non zero.
Release Notes
v0.1.1 First working version v0.1.2 Make changes in redis key structure for salt 2016 compatibility v0.1.3 Fix bug when reading the redis return v0.1.4 Add facility to read the last redis return without tracking a currently running highstate. v0.1.5 Fix formatting of log message. v0.1.6 Add salt-nanny command line utility to track returns from running highstate. v0.1.7 Update Documentation & improve command line utility
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file saltnanny-0.1.8.tar.gz
.
File metadata
- Download URL: saltnanny-0.1.8.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b79bf2d06d42af04de75f69074dcfe3a5f604de9fb158672b19dcef0520b3970 |
|
MD5 | 03c11549254593f194bb9c2cf16fec9c |
|
BLAKE2b-256 | fbfb1eda487381e393e05792598d82c7f92c9aff349913078ba6beabd8e54b90 |