diff --git a/.gitignore b/.gitignore index 404c377..b95387e 100644 --- a/.gitignore +++ b/.gitignore @@ -171,3 +171,4 @@ cython_debug/ # Changelog plugin cache changelogs/.plugin-cache.yaml +sandbox/ \ No newline at end of file diff --git a/changelogs/fragments/upate_config.yml b/changelogs/fragments/upate_config.yml new file mode 100644 index 0000000..e2134f8 --- /dev/null +++ b/changelogs/fragments/upate_config.yml @@ -0,0 +1,3 @@ +--- +bugfix: + - Check connection \ No newline at end of file diff --git a/plugins/action/dme_config.py b/plugins/action/dme_config.py index 29b63c8..5e68113 100644 --- a/plugins/action/dme_config.py +++ b/plugins/action/dme_config.py @@ -81,7 +81,7 @@ def run(self, tmp=None, task_vars=None): task_vars=task_vars, ) - if self._task.args.get("config"): + if self._task.args.get("config") and conn_request: ( self._result["dme_response"], self._result["changed"], diff --git a/plugins/action/dme_validate.py b/plugins/action/dme_validate.py index c84c1be..22fb86d 100644 --- a/plugins/action/dme_validate.py +++ b/plugins/action/dme_validate.py @@ -119,6 +119,16 @@ def configure_module_rpc(self, dme_request, payload): return api_response, code def run(self, tmp=None, task_vars=None): + """ + Main execution method for the action plugin. + + Args: + tmp: Temporary directory path + task_vars: Task variables + + Returns: + Result dictionary with validation outcomes + """ self._supports_check_mode = False self._result = super(ActionModule, self).run(tmp, task_vars) diff --git a/tests/unit/plugins/modules/test_dme_config_module.py b/tests/unit/plugins/modules/test_dme_config_module.py index f18301d..ea64d0d 100644 --- a/tests/unit/plugins/modules/test_dme_config_module.py +++ b/tests/unit/plugins/modules/test_dme_config_module.py @@ -123,6 +123,18 @@ def test_module_author(self): assert "Sagar Paul" in doc_dict["author"] assert "@KB-perByte" in doc_dict["author"] + def test_examples_yaml_structure_pattern(self): + """Test that examples follow YAML structure.""" + import yaml + + try: + # Examples should be valid YAML + examples_list = yaml.safe_load_all(dme_config.EXAMPLES) + examples = list(examples_list) + assert len(examples) > 0 + except yaml.YAMLError as e: + pytest.fail(f"Examples are not valid YAML: {e}") + def test_examples_show_workflow(self): """Test that examples show the complete workflow.""" examples = dme_config.EXAMPLES