mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-06 10:40:32 -07:00
rollback
This commit is contained in:
parent
aa1b757c3d
commit
f09c2a10bc
2 changed files with 9 additions and 7 deletions
|
@ -246,14 +246,13 @@ def main():
|
||||||
vm_id = proxmox.vmname_2_vmid(vm_name)
|
vm_id = proxmox.vmname_2_vmid(vm_name)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
backup_schedule_result = proxmox.backup_present(vm_id, backup_id)
|
result['backup_schedule'] = proxmox.backup_present(vm_id, backup_id)
|
||||||
|
|
||||||
if state == 'absent':
|
if state == 'absent':
|
||||||
backup_schedule_result = proxmox.backup_absent(vm_id, backup_id)
|
result['backup_schedule'] = proxmox.backup_absent(vm_id, backup_id)
|
||||||
|
|
||||||
if backup_schedule_result:
|
if result['backup_schedule']:
|
||||||
result['changed'] = backup_schedule_result
|
result['changed'] = True
|
||||||
result['vm_id'] = vm_id
|
|
||||||
result['message'] = 'The backup schedule has been changed successfully.'
|
result['message'] = 'The backup schedule has been changed successfully.'
|
||||||
else:
|
else:
|
||||||
result['message'] = 'The backup schedule did not change anything.'
|
result['message'] = 'The backup schedule did not change anything.'
|
||||||
|
|
|
@ -158,6 +158,9 @@ BACKUP_JOBS = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXPECTED_UPDATE_BACKUP_SCHEDULE = True
|
||||||
|
EXPECTED_DEL_BACKUP_SCHEDULE = True
|
||||||
|
|
||||||
|
|
||||||
class TestProxmoxBackupScheduleModule(ModuleTestCase):
|
class TestProxmoxBackupScheduleModule(ModuleTestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -201,7 +204,7 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
|
||||||
result = exc_info.value.args[0]
|
result = exc_info.value.args[0]
|
||||||
|
|
||||||
assert result['changed'] is True
|
assert result['changed'] is True
|
||||||
assert result['vm_id'] == 105
|
assert result['backup_schedule'] == EXPECTED_UPDATE_BACKUP_SCHEDULE
|
||||||
|
|
||||||
def test_delete_vmid_from_backup(self):
|
def test_delete_vmid_from_backup(self):
|
||||||
with pytest.raises(AnsibleExitJson) as exc_info:
|
with pytest.raises(AnsibleExitJson) as exc_info:
|
||||||
|
@ -216,7 +219,7 @@ class TestProxmoxBackupScheduleModule(ModuleTestCase):
|
||||||
|
|
||||||
result = exc_info.value.args[0]
|
result = exc_info.value.args[0]
|
||||||
assert result['changed'] is True
|
assert result['changed'] is True
|
||||||
assert result['vm_id'] == 101
|
assert result['backup_schedule'] == EXPECTED_DEL_BACKUP_SCHEDULE
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Reference in a new issue