mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixing issue related to writing ini files
When the file is opened with rwa+ and the update file size is smaller than the original the ini file can become corrupt. The issue was noticed when we had comments at the top of /etc/yum/pluginconf.d/rhnplugin.conf after using the rhn_register module the file became correct. rwa+ also make no sense as the file is only written too and why would any appending need to happen?
This commit is contained in:
parent
9d95ea0832
commit
3506febbb9
1 changed files with 1 additions and 1 deletions
|
@ -66,7 +66,7 @@ class RegistrationBase(object):
|
||||||
cfg.set('main', 'enabled', 1)
|
cfg.set('main', 'enabled', 1)
|
||||||
else:
|
else:
|
||||||
cfg.set('main', 'enabled', 0)
|
cfg.set('main', 'enabled', 0)
|
||||||
fd = open(plugin_conf, 'rwa+')
|
fd = open(plugin_conf, 'w+')
|
||||||
cfg.write(fd)
|
cfg.write(fd)
|
||||||
fd.close()
|
fd.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue