Fixed bug where we need to fetch VMs whose names strictly begin with 'public-'

This commit is contained in:
M.Ravi 2017-07-26 19:41:05 +02:00
parent c92960a3e6
commit bc2ad28969

View file

@ -59,7 +59,7 @@ class OpenNebulaManager():
domain=settings.OPENNEBULA_DOMAIN, domain=settings.OPENNEBULA_DOMAIN,
port=settings.OPENNEBULA_PORT, port=settings.OPENNEBULA_PORT,
endpoint=settings.OPENNEBULA_ENDPOINT endpoint=settings.OPENNEBULA_ENDPOINT
)) ))
def _get_opennebula_client(self, username, password): def _get_opennebula_client(self, username, password):
return oca.Client("{0}:{1}".format( return oca.Client("{0}:{1}".format(
@ -71,7 +71,7 @@ class OpenNebulaManager():
domain=settings.OPENNEBULA_DOMAIN, domain=settings.OPENNEBULA_DOMAIN,
port=settings.OPENNEBULA_PORT, port=settings.OPENNEBULA_PORT,
endpoint=settings.OPENNEBULA_ENDPOINT endpoint=settings.OPENNEBULA_ENDPOINT
)) ))
def _get_user(self, user): def _get_user(self, user):
"""Get the corresponding opennebula user for a CustomUser object """Get the corresponding opennebula user for a CustomUser object
@ -325,7 +325,7 @@ class OpenNebulaManager():
public_templates = [ public_templates = [
template template
for template in self._get_template_pool() for template in self._get_template_pool()
if 'public-' in template.name if template.name.startswith('public-')
] ]
return public_templates return public_templates
except ConnectionRefusedError: except ConnectionRefusedError:
@ -396,7 +396,7 @@ class OpenNebulaManager():
def delete_template(self, template_id): def delete_template(self, template_id):
self.oneadmin_client.call(oca.VmTemplate.METHODS[ self.oneadmin_client.call(oca.VmTemplate.METHODS[
'delete'], template_id, False) 'delete'], template_id, False)
def change_user_password(self, new_password): def change_user_password(self, new_password):
self.oneadmin_client.call( self.oneadmin_client.call(