コード例 #1
0
ファイル: default.py プロジェクト: rajaramcomputers/client
    def list(cls,
             cloud=None,
             format="table",
             order=None,
             output=format):
        """
        lists the default values in the specified format.
        TODO: This method has a bug as it uses format and output,
        only one should be used.

        :param cloud: the category of the default value. If general is used
                      it is a special category that is used for global values.
        :param format: json, table, yaml, dict, csv
        :param order: The order in which the attributes are returned
        :param output: The output format.
        :return:
        """
        if order is None:
            order = ['user', 'cloud', 'name', 'value']
        try:
            if cloud is None:
                d = cls.cm.all("default")
            else:
                d = cls.cm.find('default', cloud=cloud)
            return (Printer.dict_printer(d,
                                         order=order,
                                         output=format))
        except:
            return None
コード例 #2
0
ファイル: register.py プロジェクト: sohiljain/client
    def list(cls, filename, info=False, output='table'):
        """
        lists clouds from cloudmesh.yaml file

        :param filename:
        :type filename: string
        :return:
        """
        config = ConfigDict("cloudmesh.yaml")
        clouds = config["cloudmesh"]["clouds"]
        if info:
            Console.ok("Cloudmesh configuration file: {}".format(filename))
            print("")
        d = {}
        for i, key in enumerate(clouds.keys()):
            d[i] = {
                "id":
                i,
                "cloud":
                key,
                "iaas":
                config["cloudmesh"]["clouds"][key]["cm_type"],
                "version":
                config["cloudmesh"]["clouds"][key]["cm_type_version"] or "N/A"
            }
        return Printer.dict_printer(d,
                                    order=['id', 'cloud', 'iaas', 'version'],
                                    output=output)
コード例 #3
0
ファイル: register.py プロジェクト: atavism/client
    def list(cls, filename, info=False, output='table'):
        """
        lists clouds from cloudmesh.yaml file

        :param filename:
        :type filename: string
        :return:
        """
        config = ConfigDict("cloudmesh.yaml")
        clouds = config["cloudmesh"]["clouds"]
        if info:
            Console.ok("Cloudmesh configuration file: {}".format(filename))
            print("")
        d = {}
        for i, key in enumerate(clouds.keys()):
            d[i] = {
                "id": i,
                "cloud": key,
                "iaas": config["cloudmesh"]["clouds"][key]["cm_type"],
                "version":
                    config["cloudmesh"]["clouds"][key][
                        "cm_type_version"] or "N/A"
            }
        return Printer.dict_printer(d,
                                    order=['id',
                                           'cloud',
                                           'iaas',
                                           'version'],
                                    output=output)
コード例 #4
0
ファイル: default.py プロジェクト: sohiljain/client
    def list(cls,
             category=None,
             format="table",
             order=None,
             output=format):
        """
        lists the default values in the specified format.
        TODO: This method has a bug as it uses format and output,
        only one should be used.

        :param category: the category of the default value. If general is used
                      it is a special category that is used for global values.
        :param format: json, table, yaml, dict, csv
        :param order: The order in which the attributes are returned
        :param output: The output format.
        :return:
        """
        if order is None:
            order = ['user', 'category', 'name', 'value']
        try:
            if category is None:
                d = cls.cm.all("default")
            else:
                d = cls.cm.find('default', category=category)
            return (Printer.dict_printer(d,
                                         order=order,
                                         output=format))
        except:
            return None
コード例 #5
0
ファイル: default.py プロジェクト: atavism/client
 def list(cls,
          cloud=None,
          format="table",
          order=None,
          output=format):
     if order is None:
         order = ['user', 'cloud', 'name', 'value'],
     try:
         if cloud is None:
             d = cls.cm.all("default")
         else:
             d = cls.cm.find('default', cloud=cloud)
         return (Printer.dict_printer(d,
                                      order=order,
                                      output=format))
     except:
         return None