forked from uncloud/uncloud
		
	No try: needed for pop/importlib/getattr
This commit is contained in:
		
					parent
					
						
							
								b7596e071a
							
						
					
				
			
			
				commit
				
					
						d9dd6b48dc
					
				
			
		
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
					@ -73,10 +73,14 @@ if __name__ == '__main__':
 | 
				
			||||||
        arguments = vars(args)
 | 
					        arguments = vars(args)
 | 
				
			||||||
        print(arguments)
 | 
					        print(arguments)
 | 
				
			||||||
        print(etcd_parser)
 | 
					        print(etcd_parser)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        name = arguments.pop('command')
 | 
				
			||||||
 | 
					        mod = importlib.import_module('uncloud.{}.main'.format(name))
 | 
				
			||||||
 | 
					        main = getattr(mod, 'main')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if component in ETCD_COMPONENTS:
 | 
				
			||||||
 | 
					            import etcd3
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            name = arguments.pop('command')
 | 
					 | 
				
			||||||
            mod = importlib.import_module('uncloud.{}.main'.format(name))
 | 
					 | 
				
			||||||
            main = getattr(mod, 'main')
 | 
					 | 
				
			||||||
            main(arguments)
 | 
					            main(arguments)
 | 
				
			||||||
        except UncloudException as err:
 | 
					        except UncloudException as err:
 | 
				
			||||||
            logger.error(err)
 | 
					            logger.error(err)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue