Exemple #1
0
 def get_config():
     return ChallengeSessionConfig\
         .for_journey(read_from_config_file('tdl_journey_id'))\
         .with_server_hostname(read_from_config_file('tdl_hostname'))\
         .with_colours(read_from_config_file_with_default('tdl_use_coloured_output', True))\
         .with_recording_system_should_be_on(read_from_config_file_with_default('tdl_require_rec', True))\
         .with_working_directory('./')
Exemple #2
0
def execute_server_action_from_user_input(args, username, hostname, solutions):
    try:
        journey_id = read_from_config_file("tdl_journey_id")
        use_colours = is_true(read_from_config_file_with_default("tdl_use_coloured_output", "true"))
        challenge_server_client = ChallengeServerClient(hostname, journey_id, use_colours)
        journey_progress = challenge_server_client.get_journey_progress()
        print(journey_progress)
        available_actions = challenge_server_client.get_available_actions()
        print(available_actions)

        if "No actions available." in available_actions:
            return

        user_input = get_user_input(args)
        if user_input == "deploy":
            runner_action = RunnerActions.deploy_to_production
            execute_runner_action(hostname, runner_action, solutions, username)

        action_feedback = challenge_server_client.send_action(user_input)
        print(action_feedback)

        response_string = challenge_server_client.get_round_description()
        RoundManagement.save_description(
            response_string,
            lambda x: RecordingSystem.notify_event(x, RunnerActions.get_new_round_description.short_name)
        )
    except ClientErrorException as e:
        print "The client sent something the server didn't expect."
        print e.get_response_message()
    except ServerErrorException as e:
        print "Server experienced an error. Try again."
        print e.get_response_message()
    except OtherCommunicationException as e:
        print "Client threw an unexpected error."
        print e.get_response_message()
 def get_runner_config():
     return ImplementationRunnerConfig()\
         .set_request_queue_name(read_from_config_file('tdl_request_queue_name'))\
         .set_response_queue_name(read_from_config_file('tdl_response_queue_name'))\
         .set_hostname(read_from_config_file('tdl_hostname'))
Exemple #4
0
 def get_runner_config():
     return ImplementationRunnerConfig()\
         .set_unique_id(read_from_config_file('tdl_username'))\
         .set_hostname(read_from_config_file('tdl_hostname'))