cloudmesh-configuration.cloudmesh.configuration.Config

Module Contents

Classes

Active

Config

class cloudmesh-configuration.cloudmesh.configuration.Config.Active

Bases: object

clouds(self)
class cloudmesh-configuration.cloudmesh.configuration.Config.Config(config_path='~/.cloudmesh/cloudmesh.yaml', encrypted=False)

Bases: object

__shared_state
static version()
static secrets()
static exceptions()
fetch(self, url=None, destination=None)

fetches the cloudmesh yaml file and places it in the given destination dir

Parameters
  • url – The url of the cloudmesh.yaml file from github

  • destination – The destination file. If not specified it is the home dir.

Returns

load(self, config_path=None)

loads a configuration file :param config_path: :type config_path: :return: :rtype:

create(self, config_path=None)

creates the cloudmesh.yaml file in the specified location. The default is

~/.cloudmesh/cloudmesh.yaml

If the file does not exist, it is initialized with a default. You still need to edit the file.

Parameters

config_path (string) – The yaml file to create

check(self, path=None)
static check_for_tabs(filename, verbose=True)

identifies if the file contains tabs and returns True if it does. It also prints the location of the lines and columns. If verbose is set to False, the location is not printed.

Parameters
  • verbose – if true prints issues

  • filename (str) – the filename

Return type

True if there are tabs in the file

save(self, path=None, backup=True)

# # not tested # saves th dic into the file. It also creates a backup if set to true The backup filename appends a .bak.NO where number is a number that is not yet used in the backup directory.

Parameters

path

Returns

Return type

spec_replace(self, spec)
credentials(self, kind, name)
Parameters
  • kind – the first level of attributes after cloudmesh

  • name – the name of the resource

Returns

check_for_TBD(self, kind, name)
set_debug_defaults(self)
dict(self)
__str__(self)

Return str(self).

static cat_dict(d, mask_secrets=True, attributes=None, color=None)
static cat_lines(content, mask_secrets=True, attributes=None, color=None)
static cat(mask_secrets=True, attributes=None, path='~/.cloudmesh/cloudmesh.yaml', color=None)
get(self, key, default=None)

A helper function for reading values from the config without a chain of get() calls.

Usage:

mongo_conn = conf.get(‘db.mongo.MONGO_CONNECTION_STRING’) default_db = conf.get(‘default.db’) az_credentials = conf.get(‘data.service.azure.credentials’)

Parameters
  • default

  • key – A string representing the value’s path in the config.

__setitem__(self, key, value)
set(self, key, value)

A helper function for setting the default cloud in the config without a chain of set() calls.

Usage:
mongo_conn = conf.set(‘db.mongo.MONGO_CONNECTION_STRING’,

https://localhost:3232”)

Parameters
  • key – A string representing the value’s path in the config.

  • value – value to be set.

set_cloud(self, key, value)

A helper function for setting the default cloud in the config without a chain of set() calls.

Usage:
mongo_conn = conf.get(‘db.mongo.MONGO_CONNECTION_STRING’,

https://localhost:3232”)

Parameters
  • key – A string representing the value’s path in the config.

  • value – value to be set.

default(self)
__getitem__(self, item)

gets an item form the dict. The key is . separated use it as follows get(“a.b.c”) :param item: :type item: :return:

__delitem__(self, item)

# # BUG THIS DOES NOT WORK # gets an item form the dict. The key is . separated use it as follows get(“a.b.c”) :param item: :type item: :return:

search(self, key, value=None)

search(“cloudmesh.cloud.*.cm.active”, True) :param key: :param value: :return:

edit(self, attribute)

edits the dict specified by the attribute and fills out all TBD values. :param attribute: :type attribute: string :return: