Browse Source

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] a0bc5afe26 (diff-ee824655f36c314a50f7dfe3f4c5ed7b41d4168ce17ec243139c6913192c6d66)

Change-Id: Ied7219f215cbbd7c2eb131234d59992a68f59e81
changes/01/824601/1
Dmitriy Rabotyagov 4 months ago
parent
commit
461379169d
  1. 10
      plugins/action/config_template.py

10
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,

Loading…
Cancel
Save