-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added high-level methods to execute the channel enabling and disablin…
…g actions. Use the quick-and-dirty manager.py script to test them: ./manager.py enable semplice-devel ./manager.py enable semplice-jessie ./manager.py disable jessie ./manager.py enable semplice-current Signed-off-by: Eugenio Paolantonio (g7) <[email protected]>
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/python3 | ||
# -*- coding: utf-8 -*- | ||
|
||
import libchannels.discovery | ||
import libchannels.resolver | ||
import libchannels.actions | ||
|
||
import sys | ||
|
||
if len(sys.argv) < 3: | ||
print("You should specify the action and the channel to execute the action on!") | ||
sys.exit(1) | ||
|
||
action = libchannels.actions.ActionType.DISABLE if sys.argv[1] == "disable" else libchannels.actions.ActionType.ENABLE | ||
channel = sys.argv[2] | ||
|
||
# Discovery | ||
discovery = libchannels.discovery.ChannelDiscovery() | ||
discovery.discover() | ||
|
||
# Resolver | ||
resolver = libchannels.resolver.DependencyResolver(discovery.cache) | ||
|
||
# Actions | ||
actions = libchannels.actions.Actions(discovery, resolver) | ||
|
||
#print(action) | ||
if action == libchannels.actions.ActionType.DISABLE: | ||
actions.disable_channel(channel) | ||
else: | ||
actions.enable_channel(channel) |