def update(self, kinds, clouds):
        """
        GREGOR WORKS ON THIS
        updates the data in the database

        :param kind: vm, image, flavor
        :param cloud: name of the cloud
        :return:
        """
        if type(kinds) == str:
            kinds = Parameter.expand(kinds)
        if type(clouds) == str:
            clouds = Parameter.expand(clouds)

        for cloud in clouds:
            cloudname = cloud.lower()
            cloud = OpenStack_libcloud(cloud, cm_user=self.cm_user)

            for k in kinds:
                kind = k.lower()
                results = cloud.list(kind, output="flat")

                for element in results:
                    result = results[element]

                    result["cm_id"] = self.getID(kind, str(result["id"]), cloudname)
                    result["cm_type"] = kind
                    self.update_from_dict(result)
        self.save()

        '''
    def update(self, kinds, clouds):
        """
        GREGOR WORKS ON THIS
        updates the data in the database

        :param kind: vm, image, flavor
        :param cloud: name of the cloud
        :return:
        """
        if type(kinds) == str:
            kinds = Parameter.expand(kinds)
        if type(clouds) == str:
            clouds = Parameter.expand(clouds)

        for cloud in clouds:
            cloudname = cloud.lower()
            cloud = OpenStack_libcloud(cloud, cm_user=self.cm_user)

            for k in kinds:
                kind = k.lower()
                results = cloud.list(kind, output="flat")

                for element in results:
                    result = results[element]

                    result["cm_id"] = self.getID(kind, str(result["id"]), cloudname)
                    result["cm_type"] = kind
                    self.update_from_dict(result)
        self.save()

        '''
Exemple #3
0
    def  test_013(self):
        """013: datadict update"""
        HEADING()

        cm = self.cm
        cm.update("flavor", "india")

        elements = cm.find("flavor", cm_cloud='india', name='m1.small_e30').all()
        #for element in elements:
        #    d = cm.o_to_d(element)
        #    print (d)

        cloud = OpenStack_libcloud("india", cm_user="******")

        result = cloud.list("flavor", output="flat")
        f = result["1"]
        f["label"] = "newlabel"
        f["cm_type"] = "flavor"
        f["cm_id"] = cm.getID("flavor", "1", "india")

        # print("libcloud", f)


        cm.update_from_dict(f)
        cm.save()


        element = cm.find('flavor',id="1").first()
        d = cm.o_to_d(element)
        # print("RRRR", d['label'], d['name'])

        assert d['label'] == "newlabel"