Package backend :: Package server :: Package handlers :: Package sat :: Module cert
[hide private]
[frames] | no frames]

Source Code for Module backend.server.handlers.sat.cert

 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  # Satellite only package downloading methods. 
16   
17  # common imports 
18  from spacewalk.common.rhnLog import log_debug 
19  from spacewalk.common.rhnException import rhnException 
20   
21  # server imports 
22  from spacewalk.server import rhnSQL 
23  from auth import Authentication 
24   
25   
26 -class Certificate(Authentication):
27 28 """ Downloads the satellite cert """ 29
30 - def __init__(self):
31 log_debug(3) 32 Authentication.__init__(self) 33 self.functions = [ 34 'download', 35 ]
36
37 - def download(self, system_id):
38 log_debug(3) 39 self.auth_system(system_id) 40 41 server_id = self.server.server['id'] 42 h = rhnSQL.prepare(""" 43 select cert 44 from rhnSatelliteInfo si 45 where si.server_id = :server_id""") 46 h.execute(server_id=server_id) 47 row = h.fetchone_dict() 48 if not row: 49 # This should not happen - we're already authenticated 50 raise rhnException("Satellite cert went away after auth?") 51 52 # Bugzilla #219625 53 # cert is now a blob 54 cert = row['cert'] 55 cert = cert.read() 56 57 return cert
58