Package backend :: Package server :: Package action_extra_data :: Module kickstart_guest
[hide private]
[frames] | no frames]

Source Code for Module backend.server.action_extra_data.kickstart_guest

 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  from spacewalk.common import rhnFlags 
16  from spacewalk.common.rhnLog import log_debug 
17  from spacewalk.server.rhnServer import server_kickstart 
18   
19  __rhnexport__ = ['initiate', 'add_tools_channel', 'schedule_virt_guest_pkg_install'] 
20   
21   
22 -def _action(action_name, server_id, action_id, success_state, success_type):
23 log_debug(3, action_name, server_id, action_id) 24 25 action_status = rhnFlags.get('action_status') 26 27 if action_status == 3: 28 ks_state = 'failed' 29 next_action_type = None 30 else: 31 ks_state = success_state 32 next_action_type = success_type 33 34 server_kickstart.update_kickstart_session(server_id, action_id, 35 action_status, kickstart_state=ks_state, 36 next_action_type=next_action_type)
37 38
39 -def schedule_virt_guest_pkg_install(server_id, action_id, data={}):
40 _action('schedule_virt_guest_pkg_install', server_id, action_id, 41 'complete', None)
42 43
44 -def add_tools_channel(server_id, action_id, data={}):
45 _action('add_tools_channel', server_id, action_id, 46 'complete', 'kickstart_guest.schedule_virt_guest_pkg_install')
47 48
49 -def initiate(server_id, action_id, data={}):
50 _action('initiate', server_id, action_id, 51 'in_progress', 'kickstart_guest.add_tools_channel')
52