示例#1
0
def schedule_sync(server_id, action_id, dry_run=0):
    log_debug(3, server_id, action_id)
    if dry_run:
        raise ShadowAction("dry run requested - skipping")

    kickstart_session_id = server_kickstart.get_kickstart_session_id(server_id,
                                                                     action_id)

    if kickstart_session_id is None:
        raise InvalidAction("Could not find kickstart session ID")

    row = server_kickstart.get_kickstart_session_info(kickstart_session_id, server_id)
    deploy_configs = (row['deploy_configs'] == 'Y')

    ks_package_profile = server_kickstart.get_kisckstart_session_package_profile(kickstart_session_id)
    # if the session doesn't have a pkg profile, try from the ks profile itself
    if not ks_package_profile:
        ks_package_profile = server_kickstart.get_kickstart_profile_package_profile(kickstart_session_id)

    if not ks_package_profile:
        log_debug(4, "No kickstart package profile")
        # No profile to bring this system to
        if deploy_configs:
            # We have to deploy configs, so pass in a server profile
            server_profile = server_kickstart.get_server_package_profile(server_id)
        else:
            # No configs to be deployed
            server_profile = None

        server_kickstart.schedule_config_deploy(server_id,
                                                action_id, kickstart_session_id, server_profile=server_profile)
        raise ShadowAction("Package sync not scheduled, missing kickstart "
                           "package profile; proceeding with configfiles.deploy")

    server_profile = server_kickstart.get_server_package_profile(server_id)

    installs, removes = server_packages.package_delta(server_profile,
                                                      ks_package_profile)

    if not (installs or removes):
        log_debug(4, "No packages to be installed/removed")
        if not deploy_configs:
            server_profile = None

        server_kickstart.schedule_config_deploy(server_id,
                                                action_id, kickstart_session_id, server_profile=None)
        raise ShadowAction("Package sync not scheduled, nothing to do")

    log_debug(4, "Scheduling kickstart delta")
    server_kickstart.schedule_kickstart_delta(server_id,
                                              kickstart_session_id, installs, removes)

    raise ShadowAction("Package sync scheduled")
示例#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 _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
示例#4
0
def schedule_sync(server_id, action_id, dry_run=0):
    log_debug(3, server_id, action_id)
    if dry_run:
        raise ShadowAction("dry run requested - skipping")

    kickstart_session_id = server_kickstart.get_kickstart_session_id(
        server_id, action_id)

    if kickstart_session_id is None:
        raise InvalidAction("Could not find kickstart session ID")

    row = server_kickstart.get_kickstart_session_info(kickstart_session_id,
                                                      server_id)
    deploy_configs = (row['deploy_configs'] == 'Y')

    ks_package_profile = server_kickstart.get_kisckstart_session_package_profile(
        kickstart_session_id)
    # if the session doesn't have a pkg profile, try from the ks profile itself
    if not ks_package_profile:
        ks_package_profile = server_kickstart.get_kickstart_profile_package_profile(
            kickstart_session_id)

    if not ks_package_profile:
        log_debug(4, "No kickstart package profile")
        # No profile to bring this system to
        if deploy_configs:
            # We have to deploy configs, so pass in a server profile
            server_profile = server_kickstart.get_server_package_profile(
                server_id)
        else:
            # No configs to be deployed
            server_profile = None

        server_kickstart.schedule_config_deploy(server_id,
                                                action_id,
                                                kickstart_session_id,
                                                server_profile=server_profile)
        raise ShadowAction(
            "Package sync not scheduled, missing kickstart "
            "package profile; proceeding with configfiles.deploy")

    server_profile = server_kickstart.get_server_package_profile(server_id)

    installs, removes = server_packages.package_delta(server_profile,
                                                      ks_package_profile)

    if not (installs or removes):
        log_debug(4, "No packages to be installed/removed")
        if not deploy_configs:
            server_profile = None

        server_kickstart.schedule_config_deploy(server_id,
                                                action_id,
                                                kickstart_session_id,
                                                server_profile=None)
        raise ShadowAction("Package sync not scheduled, nothing to do")

    log_debug(4, "Scheduling kickstart delta")
    server_kickstart.schedule_kickstart_delta(server_id, kickstart_session_id,
                                              installs, removes)

    raise ShadowAction("Package sync scheduled")