.. versionadded:: 2015.5.2 .. versionchanged:: 2018.3.0 Function has been renamed from ``test.rand_str`` to ``test.random_hash`` Generates a random number between 1 and ``size``, then returns a hash of that number. If no ``hash_type`` is passed, the ``hash_type`` sp
(size=9999999999, hash_type=None)
| 515 | |
| 516 | |
| 517 | def random_hash(size=9999999999, hash_type=None): |
| 518 | """ |
| 519 | .. versionadded:: 2015.5.2 |
| 520 | .. versionchanged:: 2018.3.0 |
| 521 | Function has been renamed from ``test.rand_str`` to |
| 522 | ``test.random_hash`` |
| 523 | |
| 524 | Generates a random number between 1 and ``size``, then returns a hash of |
| 525 | that number. If no ``hash_type`` is passed, the ``hash_type`` specified by the |
| 526 | Minion's :conf_minion:`hash_type` config option is used. |
| 527 | |
| 528 | CLI Example: |
| 529 | |
| 530 | .. code-block:: bash |
| 531 | |
| 532 | salt '*' test.random_hash |
| 533 | salt '*' test.random_hash hash_type=sha512 |
| 534 | """ |
| 535 | if not hash_type: |
| 536 | hash_type = __opts__.get("hash_type", DEFAULT_HASH_TYPE) |
| 537 | return salt.utils.hashutils.random_hash(size=size, hash_type=hash_type) |
| 538 | |
| 539 | |
| 540 | def exception(message="Test Exception"): |