Enable/disable repos atomically
This commit is contained in:
parent
529f5a1cd0
commit
0af2769aca
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import dnf
|
import dnf
|
||||||
import iniparse
|
import iniparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
base = dnf.Base()
|
base = dnf.Base()
|
||||||
@ -20,5 +21,7 @@ with open(repo.repofile) as fp:
|
|||||||
|
|
||||||
ini[reponame]['enabled'] = 0
|
ini[reponame]['enabled'] = 0
|
||||||
|
|
||||||
with open(repo.repofile, 'w') as fp:
|
with open(repo.repofile + '.new', 'w') as fp:
|
||||||
fp.write(str(ini))
|
fp.write(str(ini))
|
||||||
|
|
||||||
|
os.rename(repo.repofile + '.new', repo.repofile)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import dnf
|
import dnf
|
||||||
import iniparse
|
import iniparse
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
base = dnf.Base()
|
base = dnf.Base()
|
||||||
@ -20,5 +21,7 @@ with open(repo.repofile) as fp:
|
|||||||
|
|
||||||
ini[reponame]['enabled'] = 1
|
ini[reponame]['enabled'] = 1
|
||||||
|
|
||||||
with open(repo.repofile, 'w') as fp:
|
with open(repo.repofile + '.new', 'w') as fp:
|
||||||
fp.write(str(ini))
|
fp.write(str(ini))
|
||||||
|
|
||||||
|
os.rename(repo.repofile + '.new', repo.repofile)
|
||||||
|
Loading…
Reference in New Issue
Block a user