Add a try block while doing the purging
This is to work around an issue that a broken pipe exception
might get thrown when we invoke this purge through neutron
client API. We don't have this issue when its invoked thru
CLI.
Change-Id: I94d6ab8658efc08dd5be8dbd348e098453e71b39
(cherry picked from commit 0833afb6de)
			
			
This commit is contained in:
		@@ -69,9 +69,16 @@ class Purge(n_purge.Purge):
 | 
				
			|||||||
                if self.total_resources > 0:
 | 
					                if self.total_resources > 0:
 | 
				
			||||||
                    percent_complete = (self.deleted_resources /
 | 
					                    percent_complete = (self.deleted_resources /
 | 
				
			||||||
                                        float(self.total_resources)) * 100
 | 
					                                        float(self.total_resources)) * 100
 | 
				
			||||||
                sys.stdout.write("\rPurging resources: %d%% complete." %
 | 
					                try:
 | 
				
			||||||
                                 percent_complete)
 | 
					                    sys.stdout.write("\rPurging resources: %d%% complete." %
 | 
				
			||||||
                sys.stdout.flush()
 | 
					                                     percent_complete)
 | 
				
			||||||
 | 
					                    sys.stdout.flush()
 | 
				
			||||||
 | 
					                except Exception:
 | 
				
			||||||
 | 
					                    # A broken pipe IOError exception might get thrown if
 | 
				
			||||||
 | 
					                    # invoked from our MD's keystone tenant delete handler
 | 
				
			||||||
 | 
					                    # code. We should just ignore that then continue to
 | 
				
			||||||
 | 
					                    # purge the rest of the resources.
 | 
				
			||||||
 | 
					                    continue
 | 
				
			||||||
        return (deleted, failed, failures)
 | 
					        return (deleted, failed, failures)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def take_action(self, parsed_args):
 | 
					    def take_action(self, parsed_args):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user