MCPcopy Index your code
hub / github.com/saltstack/salt / obfuscate

Function obfuscate

salt/modules/pillar.py:379–430  ·  view source on GitHub ↗

.. versionadded:: 2015.8.0 Same as :py:func:`items`, but replace pillar values with a simple type indication. This is useful to avoid displaying sensitive information on console or flooding the console with long output, such as certificates. For many debug or control purposes,

(
    *args,
    pillar=None,
    pillar_enc=None,
    pillarenv=None,
    saltenv=None,
    unmask=None,
)

Source from the content-addressed store, hash-verified

377
378
379def obfuscate(
380 *args,
381 pillar=None,
382 pillar_enc=None,
383 pillarenv=None,
384 saltenv=None,
385 unmask=None,
386):
387 """
388 .. versionadded:: 2015.8.0
389
390 Same as :py:func:`items`, but replace pillar values with a simple type indication.
391
392 This is useful to avoid displaying sensitive information on console or
393 flooding the console with long output, such as certificates.
394 For many debug or control purposes, the stakes lie more in dispatching than in
395 actual values.
396
397 In case the value is itself a collection type, obfuscation occurs within the value.
398 For mapping types, keys are not obfuscated.
399 Here are some examples:
400
401 * ``'secret password'`` becomes ``'<str>'``
402 * ``['secret', 1]`` becomes ``['<str>', '<int>']``
403 * ``{'login': 'somelogin', 'pwd': 'secret'}`` becomes
404 ``{'login': '<str>', 'pwd': '<str>'}``
405
406 unmask
407 Forwarded to :py:func:`items` when sourcing the pillar data. The
408 returned structure is then obfuscated, so the practical effect of
409 this flag is limited; it is accepted for API consistency with the
410 other ``pillar`` functions.
411
412 .. versionadded:: 3008.2
413
414 CLI Examples:
415
416 .. code-block:: bash
417
418 salt '*' pillar.obfuscate
419
420 """
421 return _obfuscate_inner(
422 items(
423 *args,
424 pillar=pillar,
425 pillar_enc=pillar_enc,
426 pillarenv=pillarenv,
427 saltenv=saltenv,
428 unmask=unmask,
429 )
430 )
431
432
433# naming chosen for consistency with grains.ls, although it breaks the short

Callers

nothing calls this directly

Calls 2

_obfuscate_innerFunction · 0.85
itemsFunction · 0.70

Tested by

no test coverage detected