Package backend :: Package server :: Package action :: Module rhnsd
[hide private]
[frames] | no frames]

Source Code for Module backend.server.action.rhnsd

 1  # 
 2  # Copyright (c) 2008--2015 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  # reboot functions 
16  # 
17  # 
18   
19  from spacewalk.server import rhnSQL 
20  from spacewalk.common.rhnLog import log_debug 
21  from spacewalk.common.rhnException import rhnException 
22   
23  # the "exposed" functions 
24  __rhnexport__ = ['configure'] 
25   
26  _query_lookup_interval = rhnSQL.Statement(""" 
27      select interval, case when restart = 'Y' then 1 else 0 end as restart 
28        from rhnActionDaemonConfig 
29       where action_id = :action_id 
30  """) 
31   
32   
33 -def configure(serverId, actionId, dry_run=0):
34 log_debug(3, dry_run) 35 h = rhnSQL.prepare(_query_lookup_interval) 36 h.execute(action_id=actionId) 37 row = h.fetchone_dict() 38 if not row: 39 raise rhnException("rhnsd reconfig action scheduled, but no entries " 40 "in rhnActionDaemonConfig found") 41 # Format: (interval, restart) 42 return (row['interval'], row['restart'])
43