Mocks

class cloudify.mocks.MockRelationshipSubjectContext(node, instance)[source]

Bases: object

class cloudify.mocks.MockRelationshipContext(target, type=None)[source]

Bases: object

class cloudify.mocks.MockNodeInstanceContext(id=None, runtime_properties=None, relationships=None, index=None)[source]

Bases: object

property id
property runtime_properties
property relationships
property index
update()[source]
class cloudify.mocks.MockNodeContext(id=None, properties=None, type=None)[source]

Bases: object

property id
property name
property properties
property type
class cloudify.mocks.MockContext(values=None)[source]

Bases: dict

class cloudify.mocks.MockCloudifyContext(node_id=None, node_name=None, node_type=None, blueprint_id=None, deployment_id=None, execution_id=None, properties=None, runtime_properties=None, relationships=None, capabilities=None, related=None, source=None, target=None, operation=None, resources=None, tenant=None, rest_token=None, provider_context=None, bootstrap_context=None, config=None, brokers=None, managers=None, index=None)[source]

Bases: CloudifyContext

Cloudify context mock that can be used when testing Cloudify plugins.

property execution_id

The workflow execution id the plugin invocation was requested from. This is a unique value which identifies a specific workflow execution.

property capabilities

Maps from instance relationship target ids to their respective runtime properties

NOTE: This feature is deprecated, use ‘instance.relationships’ instead.

property logger

A Cloudify context aware logger.

Use this logger in order to index logged messages in ElasticSearch using logstash.

property provider_context

Gets provider context which contains provider specific metadata.

property bootstrap_context

System context provided during the bootstrap process

Return type:

BootstrapContext

download_resource(resource_path, target_path=None)[source]

Retrieves a resource bundled with the blueprint and saves it under a local file.

Parameters:
  • resource_path – the path to the resource. Note that this path is relative to the blueprint file which was uploaded.

  • target_path – optional local path (including filename) to store the resource at on the local file system. If missing, the location will be a tempfile with a generated name.

Returns:

The path to the resource on the local file system (identical to target_path parameter if used).

raises an cloudify.exceptions.HttpException

Raises:

cloudify.exceptions.HttpException on any kind of HTTP Error.

Raises:

IOError if the resource failed to be written to the local file system.

get_resource(resource_path)[source]

Retrieves a resource bundled with the blueprint as a string.

Parameters:

resource_path – the path to the resource. Note that this path is relative to the blueprint file which was uploaded.

get_config(scope=None, name=None)[source]

Get a subset of the stored configuration

get_managers(network=None)[source]

The managers, optionally for a non-default network.

get_brokers(network=None)[source]

The brokers, optionally for a non-default network.

upload_deployment_file(target_file_path, src_file, src_file_mtime=None)[source]
delete_deployment_file(file_path)[source]