mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 02:30:22 -07:00
Allow Proxmox Snapshot Restoring (#4377)
* Allow restoring of snapshots * Fix formatting * Add documentation for new feature * Revert unrelated reformatting * Add documentation for snapshot change * Remove redundant multiple call to status API * Remove unneccesary indent * Add documentation for timeout fix * Update changelog fragment to reflect real changes Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelog fragment to reflect real changes Co-authored-by: Felix Fontein <felix@fontein.de> * Add Tests for Snapshot rollback * Update tests/unit/plugins/modules/cloud/misc/test_proxmox_snap.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update changelogs/fragments/4377-allow-proxmox-snapshot-restoring.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/cloud/misc/proxmox_snap.py Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
c8c2636676
commit
dbad1e0f11
3 changed files with 82 additions and 10 deletions
|
@ -91,3 +91,26 @@ def test_remove_snapshot_check_mode(connect_mock, capfd, mocker):
|
|||
out, err = capfd.readouterr()
|
||||
assert not err
|
||||
assert not json.loads(out)['changed']
|
||||
|
||||
|
||||
@patch('ansible_collections.community.general.plugins.module_utils.proxmox.ProxmoxAnsible._connect')
|
||||
def test_rollback_snapshot_check_mode(connect_mock, capfd, mocker):
|
||||
set_module_args({"hostname": "test-lxc",
|
||||
"api_user": "root@pam",
|
||||
"api_password": "secret",
|
||||
"api_host": "127.0.0.1",
|
||||
"state": "rollback",
|
||||
"snapname": "test",
|
||||
"timeout": "1",
|
||||
"force": True,
|
||||
"_ansible_check_mode": True})
|
||||
proxmox_utils.HAS_PROXMOXER = True
|
||||
connect_mock.side_effect = lambda: fake_api(mocker)
|
||||
with pytest.raises(SystemExit) as results:
|
||||
proxmox_snap.main()
|
||||
|
||||
out, err = capfd.readouterr()
|
||||
assert not err
|
||||
output = json.loads(out)
|
||||
assert not output['changed']
|
||||
assert output['msg'] == "Snapshot test does not exist"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue