From 461379169dbcc83cdc73fc7465f7d94c99a06c8e Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 13 Jan 2022 18:05:00 +0200 Subject: [PATCH] Copy refactor of code quality issues The following commit copy implemented by ceph-ansible [1] code quality issues detected by DeepSource: - Use literals instead of function calls to create data structure. - Refactor useless else block in the loop. [1] https://github.com/ceph/ceph-ansible/commit/a0bc5afe26b29c7d1dd9e3102d2c7cfcc6613d87#diff-ee824655f36c314a50f7dfe3f4c5ed7b41d4168ce17ec243139c6913192c6d66 Change-Id: Ied7219f215cbbd7c2eb131234d59992a68f59e81 --- plugins/action/config_template.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/action/config_template.py b/plugins/action/config_template.py index 3abfdc0..d270da2 100644 --- a/plugins/action/config_template.py +++ b/plugins/action/config_template.py @@ -257,8 +257,8 @@ class ConfigTemplateParser(ConfigParser.RawConfigParser): value=value, section=section_bool ) - else: - fp.write("\n") + + fp.write("\n") if self.default_section != 'DEFAULT': if not self._sections.get(self.default_section, False): @@ -493,8 +493,8 @@ class ActionModule(ActionBase): 'data. Sections are case sensitive.' ) raise errors.AnsibleModuleError(error_msg) - else: - config_object.close() + + config_object.close() config_dict_new = OrderedDict() config_defaults = config.defaults() @@ -738,7 +738,7 @@ class ActionModule(ActionBase): return True, dict( source=source, dest=user_dest, - config_overrides=self._task.args.get('config_overrides', dict()), + config_overrides=self._task.args.get('config_overrides', {}), config_type=config_type, searchpath=searchpath, list_extend=list_extend,