Utils

Utility functions

saltfactories.utils.random_string(prefix, size=6, uppercase=True, lowercase=True, digits=True)[source]

Generates a random string.

Parameters
  • prefix (str) – The prefix for the random string

  • size (int) – The size of the random string

  • uppercase (bool) – If true, include upper-cased ascii chars in choice sample

  • lowercase (bool) – If true, include lower-cased ascii chars in choice sample

  • digits (bool) – If true, include digits in choice sample

Return str

The random string

saltfactories.utils.format_callback_to_string(callback, args=None, kwargs=None)[source]

Convert a callback, its arguments and keyword arguments to a string suitable for logging purposes

Parameters
  • callback (Callable,str) – The callback function

  • args (list,tuple) – The callback arguments

  • kwargs (dict) – The callback keyword arguments

Return type

str