fix bug: ACCESS DENIED in test user of test tenant under Fast Boot Docker
This commit is contained in:
		
							
								
								
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build_prepare/boot/_boot
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build_prepare/boot/_boot
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build_prepare/boot/env.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								tools/docker/standalone/fast_boot_docker_build_prepare/boot/env.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@ -120,16 +120,25 @@ if __name__ == "__main__":
 | 
				
			|||||||
                            args.tenant_name, args.zone, args.tenant_name))
 | 
					                            args.tenant_name, args.zone, args.tenant_name))
 | 
				
			||||||
            create_tenant_end = datetime.datetime.now()
 | 
					            create_tenant_end = datetime.datetime.now()
 | 
				
			||||||
            logging.info('create tenant success: %s ms' % ((create_tenant_end - create_tenant_begin).total_seconds() * 1000))
 | 
					            logging.info('create tenant success: %s ms' % ((create_tenant_end - create_tenant_begin).total_seconds() * 1000))
 | 
				
			||||||
            # grant privilege
 | 
					 | 
				
			||||||
            cursor.execute("CREATE USER '%s'@'%%'" % (args.tenant_name))
 | 
					 | 
				
			||||||
            cursor.execute("GRANT ALL ON *.* TO '%s'@'%%'" % (args.tenant_name))
 | 
					 | 
				
			||||||
            logging.info("grant privilege success")
 | 
					 | 
				
			||||||
        db.close()
 | 
					        db.close()
 | 
				
			||||||
    except mysql.err.Error as e:
 | 
					    except mysql.err.Error as e:
 | 
				
			||||||
        logging.warn("deploy observer failed")
 | 
					        logging.warn("deploy observer failed")
 | 
				
			||||||
        kill_server()
 | 
					        kill_server()
 | 
				
			||||||
        exit(-1)
 | 
					        exit(-1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # grant privilege
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        db = mysql.connect(host=args.ip, user="root@%s" % (args.tenant_name), port=int(args.mysql_port), passwd="")
 | 
				
			||||||
 | 
					        cursor = db.cursor(cursor=mysql.cursors.DictCursor)
 | 
				
			||||||
 | 
					        logging.info('connect by common tenant success!')
 | 
				
			||||||
 | 
					        cursor.execute("CREATE USER '%s'@'%%'" % (args.tenant_name))
 | 
				
			||||||
 | 
					        cursor.execute("GRANT ALL ON *.* TO '%s'@'%%'" % (args.tenant_name))
 | 
				
			||||||
 | 
					        logging.info("grant privilege success!")
 | 
				
			||||||
 | 
					    except mysql.err.Error as e:
 | 
				
			||||||
 | 
					        logging.warn("grant privilege for common tenant failed")
 | 
				
			||||||
 | 
					        kill_server()
 | 
				
			||||||
 | 
					        exit(-1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # stop observer
 | 
					    # stop observer
 | 
				
			||||||
    kill_server()
 | 
					    kill_server()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user