Skip to content

Commit

Permalink
Enable/disable repos atomically
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee committed Apr 8, 2019
1 parent 529f5a1 commit 0af2769
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion qubes-rpc/qubes.repos.Disable
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import dnf
import iniparse
import os
import sys

base = dnf.Base()
Expand All @@ -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)
5 changes: 4 additions & 1 deletion qubes-rpc/qubes.repos.Enable
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import dnf
import iniparse
import os
import sys

base = dnf.Base()
Expand All @@ -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)

0 comments on commit 0af2769

Please sign in to comment.