LGTM: Fix multiple use before assignment

- Move assignment before try/finally block
- Add raise to indicate control flow change
- Add default value

https://pagure.io/freeipa/issue/7344

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Christian Heimes committed 2018-01-09 07:53:28 +01:00
1 parent dc599e0797
commit 73ee9ff40e
9 files changed
+45 -25

No files matched your search

+2 -1
View File
@@ -600,8 +600,9 @@ def modify_sssd_conf(host, domain, mod_dict, provider='ipa',
:param provider_subtype: backend subtype (e.g. id or sudo), will be added
to the domain config if not present
"""
fd, temp_config_file = tempfile.mkstemp()
os.close(fd)
try:
temp_config_file = tempfile.mkstemp()[1]
current_config = host.transport.get_file_contents(paths.SSSD_CONF)
with open(temp_config_file, 'wb') as f: