Skip to content

Commit

Permalink
sanity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemorency committed Jan 8, 2025
1 parent 087dd6c commit 510bb52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ action_groups:
- cluster_vcls
- content_library_item_info
- content_template
- esxi_maintenance_mode
- folder_template_from_vm
- guest_info
- license_info
Expand Down
13 changes: 7 additions & 6 deletions plugins/modules/esxi_maintenance_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def enable_maintenance_mode(self):
spec.vsanMode = vim.vsan.host.DecommissionMode()
spec.vsanMode.objectAction = self.params['vsan_compliance_mode']

Check warning on line 157 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L156-L157

Added lines #L156 - L157 were not covered by tests


try:
task = self.host.EnterMaintenanceMode_Task(

Check warning on line 160 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L159-L160

Added lines #L159 - L160 were not covered by tests
self.module.params['timeout'],
Expand All @@ -169,9 +168,10 @@ def enable_maintenance_mode(self):
except TaskError as task_e:
self.module.fail_json(msg=to_native(task_e))
except Exception as generic_exc:
self.module.fail_json(msg="Failed to exit maintenance mode on %s due to exception %s" %
self.module.fail_json(msg=(

Check warning on line 171 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L169-L171

Added lines #L169 - L171 were not covered by tests
"Failed to exit maintenance mode on %s due to exception %s" %
(self.params['esxi_host_name'], to_native(generic_exc))
)
))

return task_result

Check warning on line 176 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L176

Added line #L176 was not covered by tests

Expand All @@ -190,9 +190,10 @@ def disable_maintenance_mode(self):
except TaskError as task_e:
self.module.fail_json(msg=to_native(task_e))
except Exception as generic_exc:
self.module.fail_json(msg="Failed to exit maintenance mode on %s due to exception %s" %
self.module.fail_json(msg=(

Check warning on line 193 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L191-L193

Added lines #L191 - L193 were not covered by tests
"Failed to exit maintenance mode on %s due to exception %s" %
(self.params['esxi_host_name'], to_native(generic_exc))
)
))

return task_result

Check warning on line 198 in plugins/modules/esxi_maintenance_mode.py

View check run for this annotation

Codecov / codecov/patch

plugins/modules/esxi_maintenance_mode.py#L198

Added line #L198 was not covered by tests

Expand All @@ -204,7 +205,7 @@ def main():
esxi_host_name=dict(type='str', required=True, aliases=['name']),
vsan_compliance_mode=dict(type='str', required=False, choices=['ensureObjectAccessibility', 'evacuateAllData', 'noAction']),
enable_maintenance_mode=dict(type='bool', default=True),
evacuate=dict(type='bool', default=True),
evacuate=dict(type='bool', default=False),
timeout=dict(type='int', default=0),
)
},
Expand Down
1 change: 0 additions & 1 deletion tests/unit/plugins/modules/test_esxi_maintenance_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def test_enable(self, mocker):

assert c.value.args[0]["changed"] is True


def test_disable(self, mocker):
self.__prepare(mocker)

Expand Down

0 comments on commit 510bb52

Please sign in to comment.