示例#1
0
def reboot(server_id, action_id, data={}):
    log_debug(3, action_id)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id, action_id,
        action_status, kickstart_state='restarted',
        next_action_type=None)
示例#2
0
def _next_kickstart_step(server_id, action_id, action_status):
    if action_status == 3:  # Failed
        # Nothing more to do here
        return server_kickstart.update_kickstart_session(
            server_id,
            action_id,
            action_status,
            kickstart_state='complete',
            next_action_type=None)

    # Fetch kickstart session id
    ks_session_id = server_kickstart.get_kickstart_session_id(
        server_id, action_id)

    if ks_session_id is None:
        return server_kickstart.update_kickstart_session(
            server_id,
            action_id,
            action_status,
            kickstart_state='complete',
            next_action_type=None)

    # Get the current server profile
    server_profile = server_kickstart.get_server_package_profile(server_id)

    server_kickstart.schedule_config_deploy(server_id,
                                            action_id,
                                            ks_session_id,
                                            server_profile=server_profile)
    return ks_session_id
示例#3
0
def initiate(server_id, action_id, data={}):
    log_debug(3, action_id)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id, action_id,
                                              action_status, kickstart_state='injected',
                                              next_action_type='reboot.reboot')
示例#4
0
def reboot(server_id, action_id, data={}):
    log_debug(3, action_id)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id, action_id,
        action_status, kickstart_state='restarted',
        next_action_type=None)
示例#5
0
def initiate(server_id, action_id, data={}):
    log_debug(3, action_id)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id, action_id,
        action_status, kickstart_state='injected',
        next_action_type='reboot.reboot')
示例#6
0
 def _invalidate_child_actions(self, action_id):
     f_action_ids = rhnAction.invalidate_action(self.server_id, action_id)
     for f_action_id in f_action_ids:
         # Invalidate any kickstart session that depends on this action
         server_kickstart.update_kickstart_session(self.server_id,
                                                   f_action_id, action_status=3, kickstart_state='failed',
                                                   next_action_type=None)
     return f_action_ids
示例#7
0
 def _invalidate_child_actions(self, action_id):
     f_action_ids = rhnAction.invalidate_action(self.server_id, action_id)
     for f_action_id in f_action_ids:
         # Invalidate any kickstart session that depends on this action
         server_kickstart.update_kickstart_session(self.server_id,
                                                   f_action_id, action_status=3, kickstart_state='failed',
                                                   next_action_type=None)
     return f_action_ids
示例#8
0
def deploy(server_id, action_id, data={}):
    log_debug(3)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id,
                                              action_id, action_status, kickstart_state='complete',
                                              next_action_type=None)
    return
示例#9
0
def deploy(server_id, action_id, data={}):
    log_debug(3)

    action_status = rhnFlags.get('action_status')
    server_kickstart.update_kickstart_session(server_id,
            action_id, action_status, kickstart_state='complete',
            next_action_type=None)
    return
示例#10
0
def _action(action_name, server_id, action_id, success_state, success_type):
    log_debug(3, action_name, server_id, action_id)

    action_status = rhnFlags.get('action_status')

    if action_status == 3:
        ks_state = 'failed'
        next_action_type = None
    else:
        ks_state = success_state
        next_action_type = success_type

    server_kickstart.update_kickstart_session(server_id, action_id,
                                              action_status, kickstart_state=ks_state,
                                              next_action_type=next_action_type)
示例#11
0
def update(server_id, action_id, data={}):
    log_debug(3, server_id, action_id)

    action_status = rhnFlags.get('action_status')

    if action_status == 3:
        # Action failed
        kickstart_state = 'failed'
        next_action_type = None
    else:
        kickstart_state = 'deployed'

        # This is horrendous, but in order to fix it I would have to change almost all of the
        # actions code, which we don't have time to do for the 500 beta. --wregglej
        try:
            ks_session_type = server_kickstart.get_kickstart_session_type(
                server_id, action_id)
        except rhnException:
            re = sys.exc_info()[1]
            ks_session_type = None

        if ks_session_type is None:
            next_action_type = "None"
        elif ks_session_type == 'para_guest':
            next_action_type = 'kickstart_guest.initiate'
        else:
            next_action_type = 'kickstart.initiate'

    log_debug(4, "next_action_type: %s" % next_action_type)

    # More hideous hacked together code to get around our inflexible actions "framework".
    # If next_action_type is "None", we're assuming that we're *not* in a kickstart session
    # at this point, so we don't want to update a non-existant kickstart session.
    # I feel so dirty.  --wregglej
    if next_action_type != "None":
        server_kickstart.update_kickstart_session(
            server_id,
            action_id,
            action_status,
            kickstart_state=kickstart_state,
            next_action_type=next_action_type)

        _mark_dep_failures(server_id, action_id, data)
示例#12
0
def _next_kickstart_step(server_id, action_id, action_status):
    if action_status == 3: # Failed
        # Nothing more to do here
        return server_kickstart.update_kickstart_session(server_id,
            action_id, action_status, kickstart_state='complete',
            next_action_type=None)

    # Fetch kickstart session id
    ks_session_id = server_kickstart.get_kickstart_session_id(server_id,
        action_id)

    if ks_session_id is None:
        return server_kickstart.update_kickstart_session(server_id,
            action_id, action_status, kickstart_state='complete',
            next_action_type=None)

    # Get the current server profile
    server_profile = server_kickstart.get_server_package_profile(server_id)

    server_kickstart.schedule_config_deploy(server_id, action_id,
        ks_session_id, server_profile=server_profile)
    return ks_session_id
示例#13
0
def update(server_id, action_id, data={}):
    log_debug(3, server_id, action_id)

    action_status = rhnFlags.get('action_status')

    if action_status == 3:
        # Action failed
        kickstart_state = 'failed'
        next_action_type = None
    else:
        kickstart_state = 'deployed'

        # This is horrendous, but in order to fix it I would have to change almost all of the
        # actions code, which we don't have time to do for the 500 beta. --wregglej
        try:
            ks_session_type = server_kickstart.get_kickstart_session_type(server_id, action_id)
        except rhnException:
            re = sys.exc_info()[1]
            ks_session_type = None

        if ks_session_type is None:
            next_action_type = "None"
        elif ks_session_type == 'para_guest':
            next_action_type = 'kickstart_guest.initiate'
        else:
            next_action_type = 'kickstart.initiate'

    log_debug(4, "next_action_type: %s" % next_action_type)

    # More hideous hacked together code to get around our inflexible actions "framework".
    # If next_action_type is "None", we're assuming that we're *not* in a kickstart session
    # at this point, so we don't want to update a non-existant kickstart session.
    # I feel so dirty.  --wregglej
    if next_action_type != "None":
        server_kickstart.update_kickstart_session(server_id, action_id,
                                                  action_status, kickstart_state=kickstart_state,
                                                  next_action_type=next_action_type)

        _mark_dep_failures(server_id, action_id, data)
示例#14
0
        if ks_session_type is None:
            next_action_type = "None"
        elif ks_session_type == 'para_guest':
            next_action_type = 'kickstart_guest.initiate'
        else:
            next_action_type = 'kickstart.initiate'

    log_debug(4, "next_action_type: %s" % next_action_type)

    #More hideous hacked together code to get around our inflexible actions "framework".
    #If next_action_type is "None", we're assuming that we're *not* in a kickstart session
    #at this point, so we don't want to update a non-existant kickstart session.
    #I feel so dirty.  --wregglej
    if next_action_type != "None":
        server_kickstart.update_kickstart_session(server_id, action_id,
            action_status, kickstart_state=kickstart_state,
            next_action_type=next_action_type)

        _mark_dep_failures(server_id, action_id, data)

def remove(server_id, action_id, data={}):
    log_debug(3, action_id, data.get('name'))
    _mark_dep_failures(server_id, action_id, data)


_query_delete_dep_failures = rhnSQL.Statement("""
    delete from rhnActionPackageRemovalFailure
    where server_id = :server_id and action_id = :action_id
""")
_query_insert_dep_failures = rhnSQL.Statement("""
    insert into rhnActionPackageRemovalFailure (
示例#15
0
        if ks_session_type is None:
            next_action_type = "None"
        elif ks_session_type == 'para_guest':
            next_action_type = 'kickstart_guest.initiate'
        else:
            next_action_type = 'kickstart.initiate'

    log_debug(4, "next_action_type: %s" % next_action_type)

    #More hideous hacked together code to get around our inflexible actions "framework".
    #If next_action_type is "None", we're assuming that we're *not* in a kickstart session
    #at this point, so we don't want to update a non-existant kickstart session.
    #I feel so dirty.  --wregglej
    if next_action_type != "None":
        server_kickstart.update_kickstart_session(server_id, action_id,
            action_status, kickstart_state=kickstart_state,
            next_action_type=next_action_type)

        _mark_dep_failures(server_id, action_id, data)

def remove(server_id, action_id, data={}):
    log_debug(3, action_id, data.get('name'))
    _mark_dep_failures(server_id, action_id, data)


_query_delete_dep_failures = rhnSQL.Statement("""
    delete from rhnActionPackageRemovalFailure
    where server_id = :server_id and action_id = :action_id
""")
_query_insert_dep_failures = rhnSQL.Statement("""
    insert into rhnActionPackageRemovalFailure (