Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Saltypie - salt-api wrapper 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.12.0rc1

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.12.0rc1
File Size Uploaded
saltypie-0.12.0rc1.tar.gz 12.1 kB Details

Release files / saltypie-0.12.0rc1.tar.gz

Download URL saltypie-0.12.0rc1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
539420f938f2d1dca2e6a927ef772a10912feba30958952db89a7bf07bf6e58a
BLAKE2b-256 checksum
How to use checksums
8803132774b585d916b957415436267cb1796d170f01da680bf6244cc237dfad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3.post20190116 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release history Release notifications | RSS feed

0.14.0

1 release file

0.13.2

1 release file

0.13.1

1 release file

0.13.0

1 release file

0.12.0

1 release file

This release

0.12.0rc1 This release

1 release file

0.11.3

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

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