laniakea.core package

Submodules

General purpose library.

class laniakea.core.common.AttributeTree(value=None)

Bases: dict

Converts a dict object to be accessible via dot notation.

setdefault(key, default)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

class laniakea.core.common.Common

Bases: object

static get_random_hostname(prefix='i-')

Unique identifier for hostnames.

static pluralize(item)

Nothing to see here.

static pprint(data)

Pretty print JSON.

class laniakea.core.common.FlatJSON

Bases: object

Converts a JSON structure to single level dict object.

class laniakea.core.common.Focus

Bases: type

Utility class for colorizing output on stdout/err.

COLORS = {'data': '\x1b[92m', 'fail': '\x1b[91m', 'info': '\x1b[1;37m', 'none': '\x1b[0m', 'okay': '\x1b[92m', 'repr': '\x1b[35m', 'warn': '\x1b[93m'}
static data(msg)
static disable()
static fail(msg)
static format(color, msg)
static info(msg)
static init()
static okay(msg)
static repr(msg)
static warn(msg)
class laniakea.core.common.ModuleLoader

Bases: object

Custom loader for cloud provider modules.

command_line_interfaces()

Return the CommandLine classes from each provider.

load(root, module_path, pkg_name)

Load modules dynamically.

class laniakea.core.common.String

Bases: object

Utility class for multipart UserData scripts.

class laniakea.core.multipart.MultipartUserData

Bases: object

Combine different types of user-data scripts into a single multipart file.

MIME = {'#!': 'text/x-shellscript', '#cloud-boothook': 'text/cloud-boothook', '#cloud-config': 'text/cloud-config', '#cloud-config-archive': 'text/cloud-config-archive', '#include': 'text/x-include-url', '#include-once': 'text/x-include-once-url', '#part-handler': 'text/part-handler', '#upstart-job': 'text/upstart-job'}
add(path, custom_mime_type='text/plain')
static get_mime_type(path, default='text/plain')
save(path, compress=False)

Utility class for UserData scripts.

class laniakea.core.userdata.UserData

Bases: object

Utility functions for dealing with UserData scripts.

static convert_pair_to_dict(arg)

Utility function which transform k=v strings from the command-line into a dict.

static convert_str_to_int(arg)
static handle_import_tags(userdata, import_root)

Handle @import(filepath)@ tags in a UserData script.

Parameters:
  • import_root (str) – Location for imports.
  • userdata (str) – UserData script content.
Returns:

UserData script with the contents of the imported files.

Return type:

str

static handle_tags(userdata, macros)

Insert macro values or auto export variables in UserData scripts.

Parameters:
  • userdata (str) – The UserData script.
  • macros (dict) – UserData macros as key value pair.
Returns:

UserData script with the macros replaced with their values.

Return type:

str

static list_tags(userdata)

List all used macros within a UserData script.

Parameters:userdata (str) – The UserData script.
static parse_only_criterias(conditions)
exception laniakea.core.userdata.UserDataException

Bases: Exception

Exception class for Packet Manager.

Module contents