def deploy_patch(self, patch_on_off, patch_name, install_file_filter, config_file_filter): """ :param patch_on_off: boolean, option value of specified patch in configuration.conf :param patch_name: string, name of patch :param install_file_filter: [], array of suffix of files which will be install. for example: ['.py'] :param config_file_filter: [], suffix array of files which will be config. for example: ['.conf', '.ini'] :return: """ if patch_on_off== False: logger.info('*********************************************************') logger.info('**** Config for %s is False, no need to install. ****' % patch_name) logger.info('*********************************************************') return False elif patch_on_off == True: absolute_path_of_patch = os.path.join(utils.get_hybrid_cloud_badam_parent_path(), PathTriCircle.PATCH_TO_PATH[patch_name]) openstack_install_path = utils.get_openstack_installed_path() installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter) configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter) patch_deploy_factory = EnginneringFactory(patch_name, installer=installer, configurator=configurator) patch_deploy_factory.execute() else: logger.error('Config for cascading node <%s> is invalid, value is: %s' % (patch_name, patch_on_off)) return False
def deploy_wsgi_patches(self): try: patch_name = 'openstack_dashboard' install_file_filter = ['.py', '.html', '.po'] absolute_path_of_patch = os.path.join(utils.get_hybrid_cloud_badam_path(), PathHybridCloud.PATH_PATCHES_OPENSTACK_DASHBOARD) install_path = PathHybridCloud.PATH_INSTALL_PATCH_OPENSTACK_DASHBOARD installer = PatchInstaller(absolute_path_of_patch, install_path, install_file_filter) patch_deploy_factory = EnginneringFactory(patch_name, installer=installer) patch_deploy_factory.execute() except: err_info = 'Exception occur when deploy python patches for WSGI openstack dashboard, Exception: %s' %traceback.format_exc() logger.error(err_info)
def deploy_python_patches(self): try: patch_name = 'hybrid_python_patches' install_file_filter = ['.py'] config_file_filter = ['.conf', '.filters'] absolute_path_of_patch = os.path.join(utils.get_hybrid_cloud_badam_path(), PathHybridCloud.PATH_PATCHES_PYTHON) openstack_install_path = utils.get_openstack_installed_path() installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter) configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter) patch_deploy_factory = EnginneringFactory(patch_name, installer=installer, configurator=configurator) patch_deploy_factory.execute() except: err_info = 'Exception occur when deploy python patches for hybrid cloud, Exception: %s' %traceback.format_exc() logger.error(err_info)
def deploy_wsgi_patches(self): try: patch_name = 'openstack_dashboard' install_file_filter = ['.py', '.html', '.po'] absolute_path_of_patch = os.path.join( utils.get_hybrid_cloud_badam_path(), PathHybridCloud.PATH_PATCHES_OPENSTACK_DASHBOARD) install_path = PathHybridCloud.PATH_INSTALL_PATCH_OPENSTACK_DASHBOARD installer = PatchInstaller(absolute_path_of_patch, install_path, install_file_filter) patch_deploy_factory = EnginneringFactory(patch_name, installer=installer) patch_deploy_factory.execute() except: err_info = 'Exception occur when deploy python patches for WSGI openstack dashboard, Exception: %s' % traceback.format_exc( ) logger.error(err_info)
def main(): """ How to use: Step1. Copy hybrid_cloud_badam and tricircle-master to <Your-Dir> Step2. Config <Your-Dir>/hybrid_cloud_badam/engineering/config/configuration.conf Step3. Install by execute following commands. # cd <Your-Dir>/hybrid_cloud_badam/engineering # python install_exe.py --config-file config/configuration.conf :return: """ logger.info('Start to doing deploy...') operation = config.CONF.sysconfig.operation logger.info('Your operation is - <%s>' % operation) if operation == OperationType.CFG_HOST_NAME: EnginneringFactory(operation, configurator=HostnameConfigurator()).execute() elif operation == OperationType.CFG_ALL_IN_ONE: restart_service = '# service nova-api restart\n ' \ '# service nova-cert restart\n ' \ '# service nova-consoleauth restar\n' \ '# service nova-scheduler restart\n' \ '# service nova-conductor restart\n' \ '# service nova-novncproxy restart\n' \ '# service neutron-server restart\n ' \ '# service openvswitch-switch restart ' \ '# service neutron-plugin-openvswitch-agent restart'\ EnginneringFactory(operation, configurator=AllInOneConfigurator()).execute() logger.warning('Please use this commands to restart services: % s' % restart_service) logger.warning('Please make sure service status is >>up<<.') elif operation == OperationType.DEPLOY_CASCADING: CascadingDeploy().deploy_cascading_modules() elif operation == OperationType.DEPLOY_HYBRID_CLOUD: HybridDeploy().deploy_hybrid_cloud() else: err_info = 'Invalid operation-<%s>, please check your config file.' % operation print(err_info) logger.error(err_info) logger.info('End to do deploy..')
def deploy_python_patches(self): try: patch_name = 'hybrid_python_patches' install_file_filter = ['.py'] config_file_filter = ['.conf', '.filters'] absolute_path_of_patch = os.path.join( utils.get_hybrid_cloud_badam_path(), PathHybridCloud.PATH_PATCHES_PYTHON) openstack_install_path = utils.get_openstack_installed_path() installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter) configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter) patch_deploy_factory = EnginneringFactory( patch_name, installer=installer, configurator=configurator) patch_deploy_factory.execute() except: err_info = 'Exception occur when deploy python patches for hybrid cloud, Exception: %s' % traceback.format_exc( ) logger.error(err_info)
def deploy_patch(self, patch_on_off, patch_name, install_file_filter, config_file_filter): """ :param patch_on_off: boolean, option value of specified patch in configuration.conf :param patch_name: string, name of patch :param install_file_filter: [], array of suffix of files which will be install. for example: ['.py'] :param config_file_filter: [], suffix array of files which will be config. for example: ['.conf', '.ini'] :return: """ if patch_on_off == False: logger.info( '*********************************************************') logger.info( '**** Config for %s is False, no need to install. ****' % patch_name) logger.info( '*********************************************************') return False elif patch_on_off == True: absolute_path_of_patch = os.path.join( utils.get_hybrid_cloud_badam_parent_path(), PathTriCircle.PATCH_TO_PATH[patch_name]) openstack_install_path = utils.get_openstack_installed_path() installer = PatchInstaller(absolute_path_of_patch, openstack_install_path, install_file_filter) configurator = PatchConfigurator(absolute_path_of_patch, config_file_filter) patch_deploy_factory = EnginneringFactory( patch_name, installer=installer, configurator=configurator) patch_deploy_factory.execute() else: logger.error( 'Config for cascading node <%s> is invalid, value is: %s' % (patch_name, patch_on_off)) return False