Beispiel #1
0
def module_resolve():
    helpers.validate_opsimulate_home_present()
    helpers.validate_credentials_loaded()
    helpers.validate_module_selected()
    helpers.validate_vm_running()
    helpers.clear_hint_history()

    print('Resolving module problem...')

    ip_address = helpers.running_vm_ip_address()
    module_resolve_script = helpers.file_from_selected_module(
        constants.MODULE_RESOLVE_SCRIPT)

    module_resolve_command = \
        "ssh -i {} -o 'StrictHostKeyChecking no' {}@{} 'bash -s' < {}".format(
            constants.PRIVATE_KEY_FILE, constants.VM_USERNAME, ip_address,
            module_resolve_script)

    if call(module_resolve_command, shell=True) == 0:
        print("Module problem has been resolved.")
        print('Solution Explanation:')
        print(helpers.get_module_solution())
    else:
        print("Cannot resolve module problem")
        print("The module problem might have been already resolved")
        print("Run 'opsimulate module_check' to see if the problem "
              "is still active")
Beispiel #2
0
def module_check():
    print('Checking if module problem has been fixed...')

    ip_address = helpers.running_vm_ip_address()
    module_check_script = helpers.file_from_selected_module(
        constants.MODULE_CHECK_SCRIPT)

    module_check_command = \
        "ssh -i {} -o 'StrictHostKeyChecking no' {}@{} 'bash -s' < {}".format(
            constants.PRIVATE_KEY_FILE, constants.VM_USERNAME, ip_address,
            module_check_script)

    if call(module_check_command, shell=True) == 0:
        print("Module problem has been fixed. Great job!")
    else:
        print("Module problem is still an issue. Keep trying, you got this!")
Beispiel #3
0
def module_start():
    helpers.clear_hint_history()

    print("Initiating module problem")

    ip_address = helpers.running_vm_ip_address()
    module_start_script = helpers.file_from_selected_module(
        constants.MODULE_START_SCRIPT)

    module_start_command = \
        "ssh -i {} -o 'StrictHostKeyChecking no' {}@{} 'bash -s' < {}".format(
            constants.PRIVATE_KEY_FILE, constants.VM_USERNAME, ip_address,
            module_start_script)

    if call(module_start_command, shell=True) == 0:
        print("Initiated module problem")
    else:
        print("Initiating module problem failed")
Beispiel #4
0
def module_start():
    helpers.validate_opsimulate_home_present()
    helpers.validate_credentials_loaded()
    helpers.validate_module_selected()
    helpers.validate_vm_running()
    helpers.clear_hint_history()

    print("Initiating module problem")

    ip_address = helpers.running_vm_ip_address()
    module_start_script = helpers.file_from_selected_module(
        constants.MODULE_START_SCRIPT)

    module_start_command = \
        "ssh -i {} -o 'StrictHostKeyChecking no' {}@{} 'bash -s' < {}".format(
            constants.PRIVATE_KEY_FILE, constants.VM_USERNAME, ip_address,
            module_start_script)

    if call(module_start_command, shell=True) == 0:
        print("Initiated module problem")
        print('In this problem scenario:')
        print(helpers.get_module_intro())
    else:
        print("Initiating module problem failed")