DevC
DevC

Reputation: 7423

SaltStack diff of minion state using Python

I am writing custom wrapper for SaltStack in python, I couldn't figure from the Salt documentation any way that I can get the diff of state of a minion.

What I mean is when we run the state from CLI, it shows the diff in different colors and I am trying to show only the difference, not the whole.

CLI command:

salt '*' state.highstate test=True

I figured from CLI it is possible using --state-verbose=False, is there any way to use the same flag with Python?

Upvotes: 0

Views: 353

Answers (2)

Eric_H
Eric_H

Reputation: 35

Using the python client, you can just add "test=true" as a kwarg to your localclient.cmd().

https://docs.saltstack.com/en/2015.8/ref/clients/index.html#salt-s-client-interfaces

Does that solve the issue? If you need an example, I'll add one as soon as I get to my laptop.

Upvotes: 0

guettli
guettli

Reputation: 27806

Are you looking for the history of changes and want to store them in a database?

The matching page is this: https://docs.saltstack.com/en/latest/topics/jobs/job_cache.html

The Salt Master maintains a job cache of all job executions which can be queried via the jobs runner. This job cache is called the Default Job Cache.

AFAIK there is no easy way to get a nice GUI which shows you the changes which are done during the last time.

Upvotes: 2

Related Questions