cloudmesh_client package

Subpackages

Submodules

cloudmesh_client.default module

class cloudmesh_client.default.Default[source]

Bases: object

Cloudmesh contains the concept of defaults. Defaults can have categories (we will rename cloud to categories). A category can be a cloud name or the name ‘general’. The category general is a ‘global’ name space and contains defaults of global value (in future we will rename the value to global).

active_cluster
active_specification = None
active_stack = None
classmethod clear()[source]

deletes all default values in the database. :return:

cloud = u'kilo'
cluster = None
cluster_counter = None
cm = <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>
debug = True
classmethod delete(name, category=None)[source]
flavor = u'm1.small'
classmethod generate_name(counter_name, display_name=None, prefix=None, fill=3)[source]

Generate a name based on a counter

Parameters:
  • counter_name (str) – name of the counter in the database
  • display_name (str) – pretty name to show user (defaults to counter_name)
  • prefix (str) – prefix the generated name with this
  • fill (int) – number of zeros to fill with
Returns:

a generated name

Return type:

str

classmethod get(name=None, category='general')[source]
classmethod get_counter(name='index')[source]

Function that returns the prefix username and count for vm naming. If it is not present in db, it creates a new entry. :return:

classmethod get_flavor(category=None)[source]

gets ths flavor default for a category :param category: the category :return:

classmethod get_image(category=None)[source]

returns the image for a particular category :param category: the category :return:

group = u'default'
image = u'Ubuntu-16.04-64'
classmethod incr_counter(name='index')[source]
index = None
interactive = None
key = None
classmethod list(category=None, order=None, header=None, output=None)[source]

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.

Parameters:
  • category – the category of the default value. If general is used it is a special category that is used for global values.
  • format – json, table, yaml, dict, csv
  • order – The order in which the attributes are returned
  • output – The output format.
Returns:

classmethod load(filename)[source]
loglevel = None
output = None
purge = None
refresh = None
secgroup = u'default'
classmethod set(key, value, category='general', user=None, type='str')[source]

sets the default value for a given category :param key: the dictionary key of the value to store it at. :param value: the value :param user: the username to store this default value at. :return:

classmethod set_cloud(value)[source]

sets the cloud in the category general :param value: the cloud as defined in cloudmesh.yaml :return:

classmethod set_cluster(value)[source]

Sets the cluster

Parameters:value (str) – cluster name
classmethod set_cluster_counter(value)[source]

sets the default cluster :param value: the cluster name as defined in the cloudmesh yaml file. :return:

classmethod set_counter(name, value)[source]

Special function to update vm prefix count.

Parameters:
  • name
  • value
  • user
Returns:

classmethod set_debug(value)[source]

enables debugging :param value: True/False :return:

classmethod set_flavor(value, category)[source]

sets the default flavor for a particular category :param value: the flavor name or uuid :param category: the category :return:

classmethod set_group(value)[source]

sets the default group :param value: the group name :return:

classmethod set_image(value, category)[source]

sets the default image for a specific category. :param value: the image uuid or name :param category: the category :return:

classmethod set_interactive(value)[source]

sets the default for all clouds to refresh :param value: :return:

classmethod set_key(name)[source]
Parameters:name – the key name
Returns:
classmethod set_loglevel(level)[source]
classmethod set_output(value)[source]
classmethod set_purge(value)[source]

sets the default for all clouds to refresh :param value: :return:

classmethod set_refresh(value)[source]

sets the default for all clouds to refresh :param value: :return:

classmethod set_secgroup(value)[source]

sets the default group :param value: the group name :return:

classmethod set_specification(value)[source]

Sets the default specification

Parameters:
  • cls
  • value
Returns:

Return type:

classmethod set_stack(name)[source]

Sets the stack name

Parameters:name (str) – stack name
classmethod set_timer(value)[source]

sets the default for all clouds to timer :param value: :return:

classmethod set_user(value)[source]

sets the cloud in the category general :param value: the cloud as defined in cloudmesh.yaml :return:

classmethod set_vm(value)[source]

sets the cloud in the category general :param value: the cloud as defined in cloudmesh.yaml :return:

timer = None
user = u'fuwang'
vm = u'fuwang-001'
class cloudmesh_client.default.Names[source]
ACTIVE_CLUSTER = 'active-cluster'
ACTIVE_SPECIFICATION = 'active-specification'
ACTIVE_STACK = 'active-stack'
CLUSTER_COUNTER = 'cluster'
STACK_COUNTER = 'stack'
VM_COUNTER = 'vm_counter'
class cloudmesh_client.default.readable_classproperty(f)[source]

Bases: object

cloudmesh_client.exc module

This module contains the exceptions

exception cloudmesh_client.exc.ClusterNameClashException(tablename, name)[source]

Bases: exceptions.Exception

Occurs when a cluster is created with a preexisting name

exception cloudmesh_client.exc.NoActiveClusterException[source]

Bases: exceptions.Exception

Occurs when an active cluster is requested but non is set_cloud

exception cloudmesh_client.exc.UnrecoverableErrorException[source]

Bases: exceptions.Exception

Occurs on an error that cannot be recovered automatically. Requires user interaction to change the state.

cloudmesh_client.locations module

cloudmesh_client.locations.config_dir_setup(filename)[source]
cloudmesh_client.locations.config_file(filename)[source]

The location of the config file: ~/.cloudmesh/filename. ~ will be expanded :param filename: the filename

cloudmesh_client.locations.config_file_prefix()[source]

The prefix of the configuration file location

cloudmesh_client.locations.config_file_raw(filename)[source]

The location of the config file: ~/.cloudmesh/filename. ~ will NOT be expanded :param filename: the filename

cloudmesh_client.logger module

cloudmesh_client.logger.LOGGER(filename)[source]

creates a logger with the given name.

You can use it as follows:

log = cloudmesh.util.LOGGER(__file__)
log.error("this is an error")
log.info("this is an info")
log.warning("this is a warning")
cloudmesh_client.logger.LOGGING_OFF(log)[source]

Switches logging off :param log: the logger for which we switch logging off

cloudmesh_client.logger.LOGGING_ON(log)[source]

Switches logging on :param log: the logger for which we switch logging on

cloudmesh_client.main module

cloudmesh_client.setup module

cloudmesh_client.setup.Make(action, **kwargs)[source]
cloudmesh_client.setup.check_pip()[source]

major = int(pip.__version__.split(“.”)[0]) if major < 7:

print(“”) print(” ERROR: Pip version”, pip.__version__, “is to old.”) print(” Tip: Please update pip with “) print(“”) print(” pip install pip -U”) print(“”) sys.exit()
cloudmesh_client.setup.get_version_from_git()[source]
cloudmesh_client.setup.makefile(tag, **kwargs)[source]
cloudmesh_client.setup.os_execute(commands)[source]
cloudmesh_client.setup.parse_requirements(filename)[source]

load the requirement form the specified file :param filename: the filename :return:

cloudmesh_client.shell_commad module

cloudmesh_client.var module

class cloudmesh_client.var.Var[source]

Bases: object

Cloudmesh contains the concept of defaults. Defaults can have categories (we will rename cloud to categories). A category can be a cloud name or the name ‘general’. The category general is a ‘global’ name space and contains defaults of global value (in future we will rename the value to global).

classmethod clear()[source]

deletes all default values in the database. :return:

cm = <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>

cm is a static variable so that db is used uniformly.

classmethod delete(name)[source]
classmethod get(name=None, output='dict', scope='first')[source]

returns the value of the first objects matching the key with the given category.

Parameters:
  • key – The dictionary key
  • category – The category
Returns:

classmethod list(order=None, header=None, output='table')[source]

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.

Parameters:
  • category – the category of the default value. If general is used it is a special category that is used for global values.
  • format – json, table, yaml, dict, csv
  • order – The order in which the attributes are returned
  • output – The output format.
Returns:

classmethod set(key, value, user=None, type='str')[source]

sets the default value for a given category :param key: the dictionary key of the value to store it at. :param value: the value :param user: the username to store this default value at. :return:

cloudmesh_client.version module

Module contents

cloudmesh_client.create_cloudmesh_yaml(filename)[source]
cloudmesh_client.setup_yaml()[source]