Beispiel #1
0
def set_env(operation, t_env):
    #print("In set_env()...")
    try:
        #print("Calling findSourceSuffix()...")
        s_env = findSourceSuffix()
        #print("Current active Environment (source environment): %s"%s_env)

        if operation == 'swap':
            if s_env == "a.prod.aws.3top.com":
                #global target_env
                t_env = "b.prod.aws.3top.com"
            else:
                #global target_env
                t_env = "a.prod.aws.3top.com"
            #print("Target Environment set as: %s"%(t_env))
        elif operation == 'copy':
            print("Target Environment set as: %s" % (t_env))

    except:
        print("Error encountered in set_env. Exiting! %s" %
              str(sys.exc_info()))
        sys.exit(-1)
        #print source_env
    #print("set_env call successful. Returning to main()")
    return s_env, t_env
Beispiel #2
0
def set_env(operation, t_env):
    my_logger.debug("Calling findSourceSuffix()...")
    try:
        s_env = findSourceSuffix()
        my_logger.debug(
            "Received current active Environment (source environment): %s" %
            s_env)

        if operation == 'swap':
            if s_env == "a.prod.aws.3top.com":
                t_env = "b.prod.aws.3top.com"
            else:
                t_env = "a.prod.aws.3top.com"
        elif operation == 'copy':
            print("Target Environment set as: %s" % (t_env))

    except:
        my_logger.error("Set environment failed. Exiting!")
        sys.exit("Set environment failed. Exiting!")
    my_logger.debug(
        "Set environment process completed successfully. Returning to main() with source environment: %s and target_environment: %s"
        % (s_env, t_env))
    return s_env, t_env
Beispiel #3
0
def set_env(operation, t_env):
    my_logger.debug("In set_env()...")
    try:
        my_logger.debug("Calling findSourceSuffix()...")
        s_env = findSourceSuffix()
        my_logger.info("Current active Environment (source environment): %s" %
                       s_env)

        if operation == 'swap':
            if s_env == "a.prod.aws.3top.com":
                t_env = "b.prod.aws.3top.com"
            else:
                t_env = "a.prod.aws.3top.com"
            my_logger.info("Target Environment set as: %s" % (t_env))
        elif operation == 'copy':
            my_logger.info("Target Environment set as: %s" % (t_env))

    except:
        my_logger.error("Error encountered in set_env. Exiting! %s" %
                        str(sys.exc_info()))
        sys.exit("Error encountered in set_env. Exiting! %s" %
                 str(sys.exc_info()))
    my_logger.info("set_env call successful. Returning to main()")
    return s_env, t_env