Example #1
0
    def list(self, kind, cloud=None, output=None):
        """

        :param kind:
        :param cloud:
        :return:
        """
        if cloud is None:
            # find all clouds
            clouds = ["india"]
        else:
            clouds = Parameter.expand(cloud)

        if type(kind) == str:
            table = database.get_table(kind)
        else:
            table = kind

        result = {}
        if cloud is None:
            result = self.session.query(table).all()
            result = self.object_to_dict(result)
        else:
            # TODO

            for cloud in clouds:
                result[cloud] = self.session.query(table).filter_by(cloud=cloud).all()
                result[cloud] = self.object_to_dict(result[cloud])
        return result
Example #2
0
    def list(self, kind, cloud=None, output=None):
        """

        :param kind:
        :param cloud:
        :return:
        """
        if cloud is None:
            # find all clouds
            clouds = ["india"]
        else:
            clouds = Parameter.expand(cloud)

        if type(kind) == str:
            table = database.get_table(kind)
        else:
            table = kind

        result = {}
        if cloud is None:
            result = self.session.query(table).all()
            result = self.object_to_dict(result)
        else:
            # TODO

            for cloud in clouds:
                result[cloud] = self.session.query(table).filter_by(cloud=cloud).all()
                result[cloud] = self.object_to_dict(result[cloud])
        return result
Example #3
0
 def delete_all(self, kind=None):
     if kind is None:
         clean = ["VM", "DEFAULT"]
         self.delete_all(clean)
     elif isinstance(kind, str):
         clean = [kind]
         self.delete_all(clean)
     else:
         for k in kind:
             t = database.get_table(k)
             if t is not None:
                 for e in self.data.query(t):
                     self.delete(e)
Example #4
0
 def delete_all(self, kind=None):
     if kind is None:
         clean = ["VM", "DEFAULT"]
         self.delete_all(clean)
     elif isinstance(kind, str):
         clean = [kind]
         self.delete_all(clean)
     else:
         for k in kind:
             t = database.get_table(k)
             if t is not None:
                 for e in self.data.query(t):
                     self.delete(e)
Example #5
0
    def vm(cls, cloud, user, group, d, existing):
        """

        :type d: dict
        """
        cls._data(database.get_table('vm'), cloud, user, group, d, existing)
Example #6
0
    def flavor(cls, cloud, user, group, d, existing):
        """

        :type d: dict
        """
        cls._data(database.get_table('flavor'), cloud, user, group, d, existing)
Example #7
0
    def vm(cls, cloud, user, group, d, existing):
        """

        :type d: dict
        """
        cls._data(database.get_table('vm'), cloud, user, group, d, existing)
Example #8
0
    def flavor(cls, cloud, user, group, d, existing):
        """

        :type d: dict
        """
        cls._data(database.get_table('flavor'), cloud, user, group, d, existing)