Skip to content

Commit

Permalink
Merge pull request #39 from felixs88/bugfix
Browse files Browse the repository at this point in the history
Issue Fix for NFS exports
  • Loading branch information
Bhavneet-Sharma authored Jan 17, 2024
2 parents 61892f8 + 83de8ff commit 1c36360
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 42 deletions.
7 changes: 0 additions & 7 deletions plugins/modules/nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,13 +519,6 @@ def get_nfs_export(self, nfs_export_name, nfs_export_id, export_parent,
export_parent, nas_server,
path)

if exports_list and not export_details:
error_msg = "Entered filesystem/snapshot/nas_server/" \
"path do not match with the corresponding " \
"NFS Export details. Please provide valid " \
"parameters."
self.module.fail_json(msg=error_msg)

# Add the export path
if export_details:
nas_details = self.provisioning.get_nas_server_details(
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/plugins/module_utils/mock_nfs_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ class MockNfsApi:

]

@staticmethod
def get_nfs_export_failed_msg():
return "Entered filesystem/snapshot/nas_server/path do not match with the corresponding NFS Export details."

@staticmethod
def get_nfs_export_wo_nas_failed_msg():
return "Please provide NAS Server details along with filesystem"
Expand Down
31 changes: 0 additions & 31 deletions tests/unit/plugins/modules/test_nfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,35 +57,6 @@ def test_get_nfs_name_response(self, nfs_module_mock):
assert self.get_module_args['nfs_export_name'] == nfs_module_mock.module.exit_json.call_args[1]['nfs_export_details']['name']
nfs_module_mock.provisioning.get_nfs_export_details_by_name.assert_called()

def test_get_nfs_name_invalid_nas_response(self, nfs_module_mock):
self.get_module_args.update({
'nfs_export_name': "sample_nfs_export",
'nas_server': " ",
'state': "present"
})
nfs_module_mock.module.params = self.get_module_args
nfs_module_mock.provisioning.get_nfs_export_details_by_name = MagicMock(
return_value=MockNfsApi.NFS_DETAILS_BY_NAME)
nfs_module_mock.perform_module_operation()
print(nfs_module_mock.module.fail_json.call_args[1]['msg'])
assert MockNfsApi.get_nfs_export_failed_msg() in \
nfs_module_mock.module.fail_json.call_args[1]['msg']

def test_get_nfs_name_with_other_nas_response(self, nfs_module_mock):
self.get_module_args.update({
'nfs_export_name': "sample_nfs_export",
'nas_server': "Sample_nas_server_2",
'state': "present"
})
nfs_module_mock.module.params = self.get_module_args
nfs_module_mock.provisioning.get_nfs_export_details_by_name = MagicMock(
return_value=MockNfsApi.NFS_DETAILS_BY_NAME)
nfs_module_mock.provisioning.get_nas_server_details = MagicMock(
return_value=MockNfsApi.NAS_SERVER_DETAILS_2)
nfs_module_mock.perform_module_operation()
assert MockNfsApi.get_nfs_export_failed_msg() in \
nfs_module_mock.module.fail_json.call_args[1]['msg']

def test_get_nfs_name_nas_id_response(self, nfs_module_mock):
self.get_module_args.update({
'nfs_export_name': "sample_nfs_export",
Expand Down Expand Up @@ -316,7 +287,6 @@ def test_modify_nfs_add_ipv6_hosts_exception(self, nfs_module_mock):
nfs_module_mock.provisioning.get_nas_server_details = MagicMock(
return_value=MockNfsApi.NAS_SERVER_DETAILS)
nfs_module_mock.perform_module_operation()
print(nfs_module_mock.module.fail_json.call_args[1]['msg'])
assert MockNfsApi.add_invalid_ipv6_hosts_failed_msg() in \
nfs_module_mock.module.fail_json.call_args[1]['msg']

Expand Down Expand Up @@ -377,7 +347,6 @@ def test_remove_hosts_wo_hosts_nfs_response(self, nfs_module_mock):
nfs_module_mock.provisioning.get_nas_server_details = MagicMock(
return_value=MockNfsApi.NAS_SERVER_DETAILS)
nfs_module_mock.perform_module_operation()
print(nfs_module_mock.module.fail_json.call_args[1]['msg'])
assert MockNfsApi.remove_nfs_export_hosts_without_hosts_failed_msg() in \
nfs_module_mock.module.fail_json.call_args[1]['msg']

Expand Down

0 comments on commit 1c36360

Please sign in to comment.