Make update_type a parameter with 1 as default
0: Replace the template 1: Merge the new template
This commit is contained in:
		
					parent
					
						
							
								d38edb0dfa
							
						
					
				
			
			
				commit
				
					
						e7c334924d
					
				
			
		
					 1 changed files with 4 additions and 3 deletions
				
			
		|  | @ -421,21 +421,22 @@ class OpenNebulaManager(): | ||||||
| 
 | 
 | ||||||
|         return return_value |         return return_value | ||||||
| 
 | 
 | ||||||
|     def save_key_in_opennebula_user(self, ssh_key): |     def save_key_in_opennebula_user(self, ssh_key, update_type=1): | ||||||
|         """ |         """ | ||||||
|         Save the given ssh key in OpenNebula user |         Save the given ssh key in OpenNebula user | ||||||
| 
 | 
 | ||||||
|         # Update type: 0: Replace the whole template. |         # Update type: 0: Replace the whole template. | ||||||
|                        1: Merge new template with the existing one. |                        1: Merge new template with the existing one. | ||||||
|         :param ssh_key: The ssh key to be saved |         :param ssh_key: The ssh key to be saved | ||||||
|  |         :param update_type: The update type as explained above | ||||||
|  | 
 | ||||||
|         :return: |         :return: | ||||||
|         """ |         """ | ||||||
|         UPDATE_TYPE = 1 |  | ||||||
|         return_value = self.client.call( |         return_value = self.client.call( | ||||||
|             'user.update', |             'user.update', | ||||||
|             self.opennebula_user.id, |             self.opennebula_user.id, | ||||||
|             '<CONTEXT><SSH_PUBLIC_KEY>%s</SSH_PUBLIC_KEY></CONTEXT>' % ssh_key, |             '<CONTEXT><SSH_PUBLIC_KEY>%s</SSH_PUBLIC_KEY></CONTEXT>' % ssh_key, | ||||||
|             UPDATE_TYPE |             update_type | ||||||
|         ) |         ) | ||||||
|         if type(return_value) == int: |         if type(return_value) == int: | ||||||
|             logger.debug( |             logger.debug( | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue