From f2a7ac258d020fdc0caad419251d694a4ad6f070 Mon Sep 17 00:00:00 2001 From: Modulos Date: Wed, 10 May 2017 02:49:03 +0200 Subject: [PATCH] Fix typo and add function description --- opennebula_api/models.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opennebula_api/models.py b/opennebula_api/models.py index c4943c3e..447a7f75 100644 --- a/opennebula_api/models.py +++ b/opennebula_api/models.py @@ -67,12 +67,12 @@ class OpenNebulaManager(): except WrongNameError as wrong_name_err: opennebula_user = self.oneadmin_client.call(oca.User.METHODS['allocate'], email, password, 'core') + return opennebula_user except ConnectionRefusedError: print('Could not connect to host: {host} via protocol {protocol}'.format( host=settings.OPENNEBULA_DOMAIN, protocol=settings.OPENNEBULA_PROTOCOL) ) - return opennebula_user def _get_user_pool(self): try: user_pool = oca.UserPool(self.oneadmin_client) @@ -84,6 +84,13 @@ class OpenNebulaManager(): ) return user_pool def create_template(self, name, cores, memory, disk_size): + """Create and add a new template to opennebula. + :param name: A string representation describing the template. + Used as label in view. + :param cores: Amount of virtual cpu cores for the VM. + :param memory: Amount of RAM for the VM (MB) + :param disk_size: Amount of disk space for VM (MB) + """ template_string_formatter = """