Skip to main content

Saltypie - salt-api client and state return parser.

Installation

   pip install saltypie

Local client example

Code:

from saltypie import Salt
from saltypie.output import StateOutput


salt = Salt(
    url='https://192.168.70.11:8000',
    username='saltapiuser',
    passwd='abc123',
    trust_host=True
)

ret = salt.execute(
    client=Salt.CLIENT_LOCAL,
    target='*',
    fun='state.apply',
    pillar={'sleep': 1}
)

sout = StateOutput(ret)
print(sout)

Output:

+ minion01 ---------------------------------------------------------+
| State                         Plot          %       ms     Result |
+-------------------------------------------------------------------+
| test succeed with changes     ||||||||||||  42.13%  0.404  True   |
| test succeed without changes  ||||||||      29.61%  0.284  True   |
| test no operation             ||||||||      28.26%  0.271  True   |
+-------------------------------------------------------------------+
| Total elapsed time: 0.96ms                                        |
+-------------------------------------------------------------------+

Runner client example

Code:

from saltypie import Salt
from saltypie.output import OrchestrationOutput

salt = Salt(
    url='https://192.168.70.10:8000',
    username='saltapiuser',
    passwd='abc123',
    trust_host=True
)
salt.eauth = 'pam'

ret = salt.execute(
    client=Salt.CLIENT_RUNNER,
    fun='state.orch',
    args=['orch_fail'],
    pillar={'sleep': 1}
)

orchout = OrchestrationOutput(ret, salt)
print(orchout.summary_table(max_bar_size=100, time_unit='s'))

Output:

   + Orchestration -----------------------------------------------------------------+
   | Step                        Plot                       %       Time(s)  Result |
   +--------------------------------------------------------------------------------+
   | Step01                      |||||||||||||||||||||||||  25.20%   5.13    True   |
   | Step02                      ||||||||||||||||||||||||   24.69%   5.03    True   |
   | Step03                      ||||||||||||||||||||||||   24.79%   5.05    True   |
   | Step04                      |||||||||||||||||||||||||  25.32%   5.16    False  |
   +--------------------------------------------------------------------------------+
   | Total elapsed time: 20.37s                                                     |
   +--------------------------------------------------------------------------------+

Terminal safe mode

All output classes have the safe property that is set to False if the terminal encoding is dectected to be utf-8. To always use safe mode set it to True:

Example:

from saltypie import Salt
from saltypie.output import StateOutput, OrchestrationOutput

sout = StateOutput(ret)
sout.safe = True
# play with the tables here ...

orchout = OrchestrationOutput(ret, salt)
orchout.safe = True
# play with the tables here ...

Disable table coloring

Set the output object colored property to False:

Example:

from saltypie import Salt
from saltypie.output import OrchestrationOutput

orchout = OrchestrationOutput(ret, salt)
orchout.colored = False
# play with the tables here ...

More examples

https://gitlab.com/cathaldallan/saltypie/tree/master/examples

Documentation

https://cathaldallan.gitlab.io/saltypie/

Metadata

Release files for saltypie 0.14.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for saltypie 0.14.0
File Size Uploaded Provenance Actions
saltypie-0.14.0.tar.gz 13.2 kB Without provenance Details for saltypie-0.14.0.tar.gz

Release files / saltypie-0.14.0.tar.gz

Download URL saltypie-0.14.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bc1b6220f9826f313c7cc444b2e4d7f34666f05eeca0969f0218570d86d4828b
BLAKE2b-256 checksum
How to use checksums
53c91c7f45552a6e6931873c42a9ee83d6667ec3c7cc030e72137e9092fe8457
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0.post20190503 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/2.7.16

Security for saltypie 0.14.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.14.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page