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

Source Code for Module config_management.rhncfg_revisions

 1  # 
 2  # Copyright (c) 2008--2016 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  from config_common import handler_base, cfg_exceptions 
17  from config_common.rhn_log import log_debug, die 
18   
19 -class Handler(handler_base.HandlerBase):
20 _usage_options = "[options] file [ file ... ]" 21 22 _options_table = handler_base.HandlerBase._options_table + [ 23 handler_base.HandlerBase._option_class( 24 '-c', '--channel', action="store", 25 help="Use this config channel", 26 ), 27 ]
28 - def run(self):
29 log_debug(2) 30 r = self.repository 31 32 channel = self.options.channel 33 if not channel: 34 die(6, "Config channel not specified") 35 36 if not self.args: 37 die(7, "No files specified") 38 39 print("Analyzing files in config channel %s" % channel) 40 for f in self.args: 41 if not r.has_file(channel, f): 42 die(8, "Config channel %s does not contain file %s" % 43 (channel, f)) 44 try: 45 revisions = r.get_file_revisions(channel, f) 46 except cfg_exceptions.RepositoryFileMissingError: 47 print("%s: not in config channel" % f) 48 continue 49 print("%s: %s" % (f, " ".join([str(x) for x in revisions])))
50