def main(arguments): """ This will launch the provisioning of Bare metat & IaaS. There is pxe based configuration defined to provision the bare metal. For IaaS provisioning different deployment models are supported. Relevant conf files related to PXE based Hw provisioning & Openstack based IaaS must be present in ./conf folder. :param arguments: the command line arguments :return: To the OS """ __installation_logs(arguments.log_level) dir_path = os.path.dirname(os.path.realpath(__file__)) export_path = dir_path + "/" os.environ['CWD_IAAS'] = export_path # Functions to read yml for IaaS Openstack environment config = file_utils.read_yaml(arguments.config) logger.info('Read configuration file - ' + arguments.config) if arguments.upgradecluster is not ARG_NOT_SET: if arguments.upgradecluster == 'queens': __manage_operation(config, "upgrade") else: logger.info( "Cannot start upgrade operation. Only support upgrade from pike to queens" ) exit(1) if arguments.downgradecluster is not ARG_NOT_SET: if arguments.downgradecluster == 'pike': __manage_operation(config, "downgrade") else: logger.info( "Cannot start downgrade operation. Only support downgrade from queens to pike" ) exit(1) if arguments.deploy is not ARG_NOT_SET: __manage_operation(config, "deploy") if arguments.dreg is not ARG_NOT_SET: __manage_operation(config, "deployregistry") if arguments.dregclean is not ARG_NOT_SET: logger.info("Cleaning up along with registry") logger.info(arguments.dregclean) __manage_operation(config, "cleanregistry") if arguments.clean is not ARG_NOT_SET: __manage_operation(config, "clean") logger.info('Completed operation successfully')
def __main(arguments): """ Configures tagged VLANs or MTUs :param arguments: the command line args from main TODO/FIXME - send in parsed arguments here, not the ones from the interpreter """ log_level = logging.INFO if arguments.log_level != 'INFO': log_level = logging.DEBUG logging.basicConfig(level=log_level) logger.info('Launching Utils Operation ........') dir_path = os.path.dirname(os.path.realpath(__file__)) export_path = dir_path + "/" os.environ['CWD_IAAS'] = export_path print("==================Current Exported Relevant Path==================") logger.info(export_path) config = file_utils.read_yaml(arguments.config) logger.info('Read configuration file - ' + arguments.config) try: if arguments.tenant_vlan is not ARG_NOT_SET: for task in config.get("TASKS"): if task.get("name") == "TenantVLAN": logger.info("Performing Task " + task.get('name') + " with arguments") logger.info("--tenant_vlan") network_utils.add_ansible_hosts(task.get("HOSTS")) ret = network_utils.tenant_vlan(task) if ret == 0: logger.info('Completed opeartion successfully') else: logger.info('Error while performing operation') if arguments.mtu is not ARG_NOT_SET: for task in config.get("TASKS"): if task.get("name") == "mtu": logger.info("Performing Task " + task.get('name') + " with arguments") logger.info("--mtu") network_utils.add_ansible_hosts(task.get("HOSTS")) ret = network_utils.mtu(task) if ret == 0: logger.info('Completed operation successfully') else: logger.info('Error while performing operation') except Exception as e: logger.error( 'Unexpected error deploying environment. Rolling back due to - %s', e) raise e
def main(arguments): """ This will launch the provisioning of Bare metat & IaaS. There is pxe based configuration defined to provision the bare metal. For IaaS provisioning different deployment models are supported. Relevant conf files related to PXE based Hw provisioning & Openstack based IaaS must be present in ./conf folder. :param arguments: the command line arguments :return: To the OS """ log_level = logging.INFO if arguments.log_level != 'INFO': log_level = logging.DEBUG logging.basicConfig(level=log_level) logger.info('Launching Operation Starts ........') dir_path = os.path.dirname(os.path.realpath(__file__)) export_path = dir_path + "/" os.environ['CWD_IAAS'] = export_path print("==================Current Exported Relevant Path==================") logger.info(export_path) config = file_utils.read_yaml(arguments.config) logger.info('Read configuration file - ' + arguments.config) if arguments.deploy is not ARG_NOT_SET: __manage_operation(config, "deploy") if arguments.dreg is not ARG_NOT_SET: __manage_operation(config, "deployregistry") if arguments.dregclean is not ARG_NOT_SET: logger.info("Cleaning up along with registry") logger.info(arguments.dregclean) __manage_operation(config, "cleanregistry") # Functions to read yml for IaaS Openstack environment if arguments.clean is not ARG_NOT_SET: __manage_operation(config, "clean") logger.info('Completed operation successfully')