Package config_management :: Module rhncfg_download_channel
[hide private]
[frames] | no frames]

Source Code for Module config_management.rhncfg_download_channel

 1  # 
 2  # Copyright (c) 2008--2013 Red Hat, Inc. 
 3  # 
 4  # This software is licensed to you under the GNU General Public License, 
 5  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 6  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
 8  # along with this software; if not, see 
 9  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
10  # 
11  # Red Hat trademarks are not licensed under GPLv2. No permission is 
12  # granted to use or replicate Red Hat trademarks that are incorporated 
13  # in this software or its documentation. 
14  # 
15   
16  import os 
17   
18  from config_common import handler_base, utils 
19  from config_common.deploy import deploy_files 
20  from config_common.rhn_log import log_debug, die 
21   
22 -class Handler(handler_base.HandlerBase):
23 _usage_options = "(-t|--topdir=)<top-level-directory> [options] config_channel [ config_channel ... ]" 24 25 _options_table = handler_base.HandlerBase._options_table + [ 26 handler_base.HandlerBase._option_class( 27 '-t', '--topdir', action="store", 28 help="Directory all the file paths are relative to. This option must be set.", 29 ), 30 ] 31
32 - def run(self):
33 log_debug(2) 34 r = self.repository 35 36 if not self.args: 37 die(6, "No config channels specified") 38 39 topdir = self.options.topdir 40 if not topdir: 41 die(7, "--topdir not specified") 42 43 if not os.path.isdir(topdir): 44 die(8, "--topdir specified, but `%s' not a directory" % 45 topdir) 46 47 for ns in self.args: 48 if not r.config_channel_exists(ns): 49 die(6, "Error: config channel %s does not exist" % ns) 50 51 deploy_files(utils.join_path(topdir, ns), r, r.list_files(ns), 52 config_channel=ns)
53