1
2
3
4
5
6
7
8
9
10
11
12
13
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
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