2
# -*- coding: utf-8 -*-
4
# Copyright (C) 2014 Canonical Ltd.
5
# Author: Timothy Chavez <timothy.chavez@canonical.com>
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; version 3 of the License.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
sys.path.insert(0, "lib")
25
from systemimage import config
26
from systemimage import tree
30
parser = argparse.ArgumentParser(description="Remove an update channel.")
31
parser.add_argument("--name", dest="name", required=True,
32
help="The name of the update channel")
33
args = parser.parse_args()
35
conf = config.Config()
37
print "I: Removing channel: {0}".format(args.name)
39
lock_file = os.path.join(conf.state_path, "global.lock")
40
fd = open(lock_file, "w")
43
fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
45
print("E: Something else holds the global lock. Exiting.")
50
pub.remove_channel(args.name)
52
print "E: {0}".format(err.message),
60
if __name__ == "__main__":