#!/usr/bin/env python from himlarcli.keystone import Keystone from himlarcli.cinder import Cinder from himlarcli.nova import Nova from himlarcli.neutron import Neutron from himlarcli.parser import Parser from himlarcli.printer import Printer from himlarcli import utils as himutils himutils.is_virtual_env() parser = Parser() options = parser.parse_args() printer = Printer(options.format) ksclient = Keystone(options.config, debug=options.debug) logger = ksclient.get_logger() regions = ksclient.find_regions(region_name=options.region) if not regions: himutils.sys_error('no regions found!') def action_show(): for region in regions: novaclient = Nova(options.config, debug=options.debug, log=logger, region=region) cinderclient = Cinder(options.config,
mq = MQclient(himlarcli_config, debug=options.debug, log=logger) channel = mq.get_channel('access') channel.basic_consume(process_action, queue='access') logger.info('start consuming rabbitmq') channel.start_consuming() if __name__ == "__main__": # Name sname = 'access-service' # Set up parser parser = Parser(name=sname, description='access service daemon', autoload=False) parser.toggle_show('dry-run') parser.toggle_show('format') parser.toggle_show('config') parser.add_actions({'start': 'start', 'stop': 'stop', 'restart': 'restart', 'status': 'status'}) parser.add_opt_args({'-f': {'sub': 'start', 'dest': 'foreground', 'const': True, 'default': False, 'action': 'store_const'}}) options = parser.parse_args()