If we can get a version provided at installation time or from Git, use that instead, otherwise we carry on.
(saltstack_version)
| 680 | |
| 681 | |
| 682 | def __get_version(saltstack_version): |
| 683 | """ |
| 684 | If we can get a version provided at installation time or from Git, use |
| 685 | that instead, otherwise we carry on. |
| 686 | """ |
| 687 | _hardcoded_version_file = os.path.join( |
| 688 | os.path.dirname(os.path.abspath(__file__)), "_version.txt" |
| 689 | ) |
| 690 | if not os.path.exists(_hardcoded_version_file): |
| 691 | return __discover_version(saltstack_version) |
| 692 | with open( # pylint: disable=resource-leakage |
| 693 | _hardcoded_version_file, encoding="utf-8" |
| 694 | ) as rfh: |
| 695 | return SaltStackVersion.parse(rfh.read().strip()) |
| 696 | |
| 697 | |
| 698 | # Get additional version information if available |
no test coverage detected