Example #1
0

if __name__ == '__main__':
    try:
        arguments = utils.os.GetMinimumSshArguments().parse()

        LogConfig.initialize(path="logs/run_analysis.log",
                             level=arguments.log_level)

        system: System = State.get_system(name=arguments.name)

        State.startup(
            action=main,
            action_kwargs={"args": arguments},
            ssh_kwargs={
                "hostname": system.hostname,
                "port": system.port,
                "username": system.username,
                "key_file": system.key_file,
            },
        )

    except ApiExceptionBase as e:
        log.fatal(f"Error accessing API: {e}")

    except NoResultFound as e:

        log.fatal(f"System is probably not "
                  "loaded into the database.",
                  exc_info=True)

        raise SystemExit(2) from e
Example #2
0
        # support commenting-out a line
        if not line[0] == '#':
            name = line.strip().split(" ")[-1]

            print(f"System name: {name}")

            print("Running gather.py")
            cmd = line.strip().split(" ")
            cmd.insert(0, "./gather.py")
            call(cmd)

            # load_details.py just wants the system name (no SSH connection)
            # This is a hack - we assume that the last word in each gather
            # argument is the system name.
            print("Running load_details.py")
            call(["./load_details.py", name])

            # run_analysis.py takes the full configuration string
            print("Running run_analysis.py")
            cmd = line.rstrip().split(" ")
            call(["./run_analysis.py", name])

            # generate ansible yaml
            print("Running generate.py")
            call(["./generate.py", "-o output", name])


if __name__ == '__main__':
    # Initialize the global database session
    State.startup(action=main)
Example #3
0

if __name__ == '__main__':
    try:
        arguments = utils.os.GetIaCArguments().parse()
        LogConfig.initialize(
            path="logs/create_iac.log",
            level=arguments.log_level,
        )

        system: System = State.get_system(name=arguments.name)

        State.startup(
            action=main,
            action_kwargs={
                "args": arguments,
                "name": system,
            },
        )

    except NoSystemState as e:
        log.fatal(
            f"System is probably not "
            "loaded into the database.",
            exc_info=e,
        )

        raise SystemExit(2) from e

    except Exception as e: