Returns a comparison between two snapshots config Configuration name. num_pre first snapshot ID to compare. Default is last snapshot num_post last snapshot ID to compare. Default is 0 (current state) CLI Example: .. code-block:: bash sal
(config="root", num_pre=None, num_post=None)
| 641 | |
| 642 | |
| 643 | def status(config="root", num_pre=None, num_post=None): |
| 644 | """ |
| 645 | Returns a comparison between two snapshots |
| 646 | |
| 647 | config |
| 648 | Configuration name. |
| 649 | |
| 650 | num_pre |
| 651 | first snapshot ID to compare. Default is last snapshot |
| 652 | |
| 653 | num_post |
| 654 | last snapshot ID to compare. Default is 0 (current state) |
| 655 | |
| 656 | CLI Example: |
| 657 | |
| 658 | .. code-block:: bash |
| 659 | |
| 660 | salt '*' snapper.status |
| 661 | salt '*' snapper.status num_pre=19 num_post=20 |
| 662 | """ |
| 663 | try: |
| 664 | pre, post = _get_num_interval(config, num_pre, num_post) |
| 665 | snapper.CreateComparison(config, int(pre), int(post)) |
| 666 | files = snapper.GetFiles(config, int(pre), int(post)) |
| 667 | status_ret = {} |
| 668 | subvolume = list_configs()[config]["SUBVOLUME"] |
| 669 | for file in files: |
| 670 | # In case of SUBVOLUME is included in filepath we remove it |
| 671 | # to prevent from filepath starting with double '/' |
| 672 | _filepath = ( |
| 673 | file[0][len(subvolume) :] if file[0].startswith(subvolume) else file[0] |
| 674 | ) |
| 675 | status_ret[os.path.normpath(subvolume + _filepath)] = { |
| 676 | "status": status_to_string(file[1]) |
| 677 | } |
| 678 | return status_ret |
| 679 | except dbus.DBusException as exc: |
| 680 | raise CommandExecutionError( |
| 681 | "Error encountered while listing changed files: {}".format( |
| 682 | _dbus_exception_to_reason(exc, locals()) |
| 683 | ) |
| 684 | ) |
| 685 | |
| 686 | |
| 687 | def changed_files(config="root", num_pre=None, num_post=None): |
no test coverage detected