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)
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
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)
def list(cls, category=None, order=None, header=None, output=None): """ 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, header = None, None # order = ['user', # 'category', # 'name', # 'value', # 'updated_at'] # order, header = Attributes(cls.__kind__, provider=cls.__provider__) if output is None: output = Default.output or 'table' try: if category is None: result = cls.cm.all(kind=cls.__kind__) else: result = cls.cm.all(category=category, kind=cls.__kind__) table = Printer.write(result, output=output) return table except Exception as e: Console.error("Error creating list", traceflag=False) Console.error(e.message) return None
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
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