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)
def ostack_discover_task(cluster_id): db = get_db() cluster_doc = db['clusters'].find_one({'_id': ObjectId(cluster_id)}) if not cluster_doc: logger.error('Cluster with ID=%s was not found' % cluster_id) return cluster = Cluster.from_doc(cluster_doc) logger.info('Starting OpenStack discovery for cluster "%s" (id=%s)' % (cluster.name, cluster.id)) discovery = OpenstackDiscovery() openstack = None try: openstack = discovery.discover(cluster.nodes, cluster.private_key) except Exception: message = traceback.format_exc() logger.error(message) logger.info('Finished OpenStack discovery for cluster "%s" (id=%s)' % (cluster.name, cluster.id)) cluster.data = openstack_for_json(openstack) db['clusters'].save(cluster.as_doc())
def ostack_discover_task(cluster_id): db = get_db() cluster_doc = db['clusters'].find_one({'_id': ObjectId(cluster_id)}) if not cluster_doc: logger.error('Cluster with ID=%s was not found' % cluster_id) return cluster = Cluster.from_doc(cluster_doc) logger.info('Starting OpenStack discovery for cluster "%s" (id=%s)' % (cluster.name, cluster.id)) discovery = OpenstackDiscovery() openstack = None try: openstack = discovery.discover(cluster.nodes, cluster.private_key) except: message = traceback.format_exc() logger.error(message) logger.info('Finished OpenStack discovery for cluster "%s" (id=%s)' % (cluster.name, cluster.id)) cluster.data = openstack_for_json(openstack) db['clusters'].save(cluster.as_doc())
def job(id): job = celery.AsyncResult(id) if job.ready(): result = job.result.value if isinstance(result, Openstack): return json.dumps({ 'state': 'success', 'result': openstack_for_json(result)}) else: return json.dumps({'state': 'failure', 'message': result}) else: return json.dumps({'state': str(job.state).lower()})
def job(id): job = celery.AsyncResult(id) if job.ready(): result = job.result.value if isinstance(result, Openstack): return json.dumps({ 'state': 'success', 'result': openstack_for_json(result) }) else: return json.dumps({'state': 'failure', 'message': result}) else: return json.dumps({'state': str(job.state).lower()})
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)))
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)))