Ejemplo n.º 1
0
def ostack_inspect_task(request):
    logger.info('Starting OpenStack inspection')

    discovery = OpenstackDiscovery()

    try:
        openstack = discovery.discover(request.nodes,
                                       private_key=request.private_key)
    except Exception:
        message = traceback.format_exc()
        logger.error(message)
        return InspectionResult(request, message)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        try:
            x = inspection()
            x.inspect(openstack)
        except Exception:
            message = traceback.format_exc()
            logger.error(message)
            openstack.report_issue(
                Issue(
                    Issue.ERROR,
                    'Unexpected error running inspection "%s". See log for '
                    'details' %
                    inspection.name))

    logger.info('Finished OpenStack inspection')

    return InspectionResult(request, openstack)
Ejemplo n.º 2
0
def main(argv):
    args = parse_args(argv)
    params = vars(args)

    logging.basicConfig(level=logging.WARNING)
    logging.getLogger('rubick').setLevel(params['loglevel'])

    discovery = OpenstackDiscovery()
    try:
        with open('test_rsa') as f:
            private_key = f.read()
    except Exception:
        private_key = sys.stdin.read()

    openstack = discovery.discover(
        ['172.18.65.179'],
        private_key=private_key)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        x = inspection()
        x.inspect(openstack)

    if params['json']:
        print(json.dumps(openstack_for_json(openstack)))
    else:
        print_openstack(openstack)
Ejemplo n.º 3
0
def ostack_inspect_task(request):
    logger.info('Starting OpenStack inspection')

    discovery = OpenstackDiscovery()

    try:
        openstack = discovery.discover(request.nodes,
                                       private_key=request.private_key)
    except:
        message = traceback.format_exc()
        logger.error(message)
        return InspectionResult(request, message)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        try:
            x = inspection()
            x.inspect(openstack)
        except:
            message = traceback.format_exc()
            logger.error(message)
            openstack.report_issue(
                Issue(
                    Issue.ERROR,
                    'Unexpected error running inspection "%s". See log for '
                    'details' % inspection.name))

    logger.info('Finished OpenStack inspection')

    return InspectionResult(request, openstack)
Ejemplo n.º 4
0
def main():
    logging.basicConfig(level=logging.WARNING)
    logging.getLogger("rubick").setLevel(logging.DEBUG)

    discovery = OpenstackDiscovery()
    try:
        with open("test_rsa") as f:
            private_key = f.read()
    except:
        private_key = sys.stdin.read()

    openstack = discovery.discover(["172.18.65.179"], private_key=private_key)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        x = inspection()
        x.inspect(openstack)

    # print_openstack(openstack)
    print(json.dumps(openstack_for_json(openstack)))
Ejemplo n.º 5
0
def main():
    logging.basicConfig(level=logging.WARNING)
    logging.getLogger('rubick').setLevel(logging.DEBUG)

    discovery = OpenstackDiscovery()
    try:
        with open('test_rsa') as f:
            private_key = f.read()
    except Exception:
        private_key = sys.stdin.read()

    openstack = discovery.discover(
        ['172.18.65.179'],
        private_key=private_key)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        x = inspection()
        x.inspect(openstack)

    print_openstack(openstack)
Ejemplo n.º 6
0
def main():
    logging.basicConfig(level=logging.WARNING)
    logging.getLogger('rubick').setLevel(logging.DEBUG)

    discovery = OpenstackDiscovery()
    try:
        with open('test_rsa') as f:
            private_key = f.read()
    except:
        private_key = sys.stdin.read() 

    openstack = discovery.discover(
        ['172.18.65.179'],
        private_key=private_key)

    all_inspections = Inspection.all_inspections()
    for inspection in all_inspections:
        x = inspection()
        x.inspect(openstack)

    # print_openstack(openstack)
    print(json.dumps(openstack_for_json(openstack)))
Ejemplo n.º 7
0
def get_rules():
    rules = []
    for inspection in Inspection.all_inspections():
        rules.extend(inspection.rules())

    return json.dumps(rules)
Ejemplo n.º 8
0
def get_rules():
    rules = []
    for inspection in Inspection.all_inspections():
        rules.extend(inspection.rules())

    return json.dumps(rules)