Enable/disable repos atomically

pull/48/head
AJ Jordan 5 years ago
parent 529f5a1cd0
commit 0af2769aca
No known key found for this signature in database
GPG Key ID: A4FDB7BE12F63EC3

@ -4,6 +4,7 @@
import dnf
import iniparse
import os
import sys
base = dnf.Base()
@ -20,5 +21,7 @@ with open(repo.repofile) as fp:
ini[reponame]['enabled'] = 0
with open(repo.repofile, 'w') as fp:
with open(repo.repofile + '.new', 'w') as fp:
fp.write(str(ini))
os.rename(repo.repofile + '.new', repo.repofile)

@ -4,6 +4,7 @@
import dnf
import iniparse
import os
import sys
base = dnf.Base()
@ -20,5 +21,7 @@ with open(repo.repofile) as fp:
ini[reponame]['enabled'] = 1
with open(repo.repofile, 'w') as fp:
with open(repo.repofile + '.new', 'w') as fp:
fp.write(str(ini))
os.rename(repo.repofile + '.new', repo.repofile)

Loading…
Cancel
Save