def enable_template_password(self, template_id, passwordenabled=True):
     try:
         self.logger.debug("Updating template %s setting passwordenabled to %s" % (template_id, passwordenabled))
         cmd = updateTemplate.updateTemplateCmd()
         cmd.id = template_id
         cmd.passwordenabled = passwordenabled
         self.api_client.updateTemplate(cmd)
     except Exception, e:
         self.fail('Unable to update template due to %s ' % e)
 def updateTemplate(self, value):
     self.debug("Updating value of guest VM template's password enabled setting")
     cmd = updateTemplate.updateTemplateCmd()
     cmd.id = self.template.id
     cmd.passwordenabled = value
     self.api_client.updateTemplate(cmd)
     list_template_response = list_templates(self.api_client, templatefilter="all", id=self.template.id)
     self.template = list_template_response[0]
     self.debug("Updated guest VM template")
 def enable_template_password(self, template_id, passwordenabled=True):
     try:
         self.logger.debug("Updating template %s setting passwordenabled to %s" % (template_id, passwordenabled))
         cmd = updateTemplate.updateTemplateCmd()
         cmd.id = template_id
         cmd.passwordenabled = passwordenabled
         self.api_client.updateTemplate(cmd)
     except Exception, e:
         self.fail('Unable to update template due to %s ' % e)
Example #4
0
 def updateTemplate(self, value):
     self.debug("UPDATE TEMPLATE")
     cmd = updateTemplate.updateTemplateCmd()
     cmd.id = self.template.id
     cmd.passwordenabled = value
     self.api_client.updateTemplate(cmd)
     list_template_response = list_templates(self.api_client,
                                             templatefilter="all",
                                             id=self.template.id)
     self.template = list_template_response[0]
Example #5
0
 def updateTemplate(self, value):
     self.debug("UPDATE TEMPLATE")
     cmd = updateTemplate.updateTemplateCmd()
     cmd.id = self.template.id
     cmd.passwordenabled = value
     self.api_client.updateTemplate(cmd)
     list_template_response = list_templates(self.api_client,
                                             templatefilter="all",
                                             id=self.template.id
                                             )
     self.template = list_template_response[0]
 def updateTemplate(self, value):
     self.debug("Updating value of template's password enabled setting")
     cmd = updateTemplate.updateTemplateCmd()
     cmd.id = self.template.id
     cmd.passwordenabled = value
     self.apiclient.updateTemplate(cmd)
     list_template_response = list_templates(self.apiclient,
                                             templatefilter="all",
                                             id=self.template.id
                                             )
     self.template = list_template_response[0]
     self.debug("Updated template")
Example #7
0
    def test_02_edit_template(self):
        """Test Edit template
        """

        # Validate the following:
        # 1. UI should show the edited values for template
        # 2. database (vm_template table) should have updated values

        new_displayText = random_gen()
        new_name = random_gen()

        cmd = updateTemplate.updateTemplateCmd()
        # Update template attributes
        cmd.id = self.template_1.id
        cmd.displaytext = new_displayText
        cmd.name = new_name
        cmd.bootable = self.services["bootable"]
        cmd.passwordenabled = self.services["passwordenabled"]

        self.apiclient.updateTemplate(cmd)

        self.debug("Edited template with new name: %s" % new_name)

        # Sleep to ensure update reflected across all the calls
        time.sleep(self.services["sleep"])

        timeout = self.services["timeout"]
        while True:
            # Verify template response for updated attributes
            list_template_response = Template.list(
                                    self.apiclient,
                                    templatefilter=\
                                    self.services["templatefilter"],
                                    id=self.template_1.id,
                                    account=self.account.name,
                                    domainid=self.account.domainid
                                    )
            if isinstance(list_template_response, list):
                break
            elif timeout == 0:
                raise Exception("List Template failed!")

            time.sleep(10)
            timeout = timeout - 1

        self.assertEqual(isinstance(list_template_response, list), True,
                         "Check list response returns a valid list")
        self.assertNotEqual(len(list_template_response), 0,
                            "Check template available in List Templates")
        template_response = list_template_response[0]

        self.debug("New Name: %s" % new_displayText)
        self.debug("Name in Template response: %s" %
                   template_response.displaytext)
        self.assertEqual(template_response.displaytext, new_displayText,
                         "Check display text of updated template")
        self.assertEqual(template_response.name, new_name,
                         "Check name of updated template")
        self.assertEqual(
            str(template_response.passwordenabled).lower(),
            str(self.services["passwordenabled"]).lower(),
            "Check passwordenabled field of updated template")
        self.assertEqual(template_response.ostypeid, self.services["ostypeid"],
                         "Check OSTypeID of updated template")
        return
Example #8
0
    def test_02_edit_template(self):
        """Test Edit template
        """

        # Validate the following:
        # 1. UI should show the edited values for template
        # 2. database (vm_template table) should have updated values

        new_displayText = random_gen()
        new_name = random_gen()

        cmd = updateTemplate.updateTemplateCmd()
        # Update template attributes
        cmd.id = self.template_1.id
        cmd.displaytext = new_displayText
        cmd.name = new_name
        cmd.bootable = self.services["bootable"]
        cmd.passwordenabled = self.services["passwordenabled"]

        self.apiclient.updateTemplate(cmd)

        self.debug("Edited template with new name: %s" % new_name)
        
        # Sleep to ensure update reflected across all the calls
        time.sleep(self.services["sleep"])
        
        timeout = self.services["timeout"]
        while True:
            # Verify template response for updated attributes
            list_template_response = Template.list(
                                    self.apiclient,
                                    templatefilter=\
                                    self.services["templatefilter"],
                                    id=self.template_1.id,
                                    account=self.account.name,
                                    domainid=self.account.domainid
                                    )
            if isinstance(list_template_response, list):
                break
            elif timeout == 0:
                raise Exception("List Template failed!")

            time.sleep(10)
            timeout = timeout -1
            
        self.assertEqual(
                            isinstance(list_template_response, list),
                            True,
                            "Check list response returns a valid list"
                        )
        self.assertNotEqual(
                            len(list_template_response),
                            0,
                            "Check template available in List Templates"
                        )
        template_response = list_template_response[0]
        
        self.debug("New Name: %s" % new_displayText)
        self.debug("Name in Template response: %s"
                                % template_response.displaytext)
        self.assertEqual(
                            template_response.displaytext,
                            new_displayText,
                            "Check display text of updated template"
                        )
        self.assertEqual(
                            template_response.name,
                            new_name,
                            "Check name of updated template"
                        )
        self.assertEqual(
                            str(template_response.passwordenabled).lower(),
                            str(self.services["passwordenabled"]).lower(),
                            "Check passwordenabled field of updated template"
                        )
        self.assertEqual(
                            template_response.ostypeid,
                            self.services["ostypeid"],
                            "Check OSTypeID of updated template"
                        )
        return