cloudmesh-configuration.cloudmesh.configuration.Configuration

Module Contents

Classes

Configuration

class cloudmesh-configuration.cloudmesh.configuration.Configuration.Configuration(path='~/.cloudmesh/cloudmesh.yaml')

Bases: object

set_debug_defaults(self)
default(self)
load(self, path=None)

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

create(self, 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

path (string) – The yaml file to create

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)
dict(self)
__str__(self)

Return str(self).

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.

__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:

cat_dict(self, d)
cat_lines(self, content)
cat(self)