Skip to content

Commit

Permalink
channel: add a new SourceEntry if a disabled one is not present.
Browse files Browse the repository at this point in the history
Signed-off-by: Eugenio Paolantonio (g7) <[email protected]>
  • Loading branch information
g7 committed Apr 20, 2015
1 parent 080e0a9 commit c6413a6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libchannels/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ def enable(self):
"""

for repository, source_entry in self.repositories.items():
source_entry.set_enabled(True)
if type(source_entry) == SourceEntry:
source_entry.set_enabled(True)
else:
# Manually add the entry
self.repositories[repository] = libchannels.common.sourceslist.add(
"deb",
self[repository]["default_mirror"],
self[repository]["codename"],
self[repository]["components"].split(" "), # FIXME
comment=repository,
file="/etc/apt/sources.list.d/%s.list" % self.channel_name
)

libchannels.common.sourceslist.save()

Expand Down
6 changes: 6 additions & 0 deletions sample.channel
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ default_mirror = http://a.sample.chann.nl/debian/
origin = Me
codename = unstable
components = main

[repo2]
default_mirror = http://repo2.two/debian/
origin = Me
codename = unstable
components = main

0 comments on commit c6413a6

Please sign in to comment.