Utils

cloudify.utils.get_manager_ip()[source]

Returns the IP address of manager inside the management network.

cloudify.utils.get_manager_file_server_blueprints_root_url()[source]

Returns the blueprints root url in the file server.

cloudify.utils.get_manager_file_server_url()[source]

Returns the manager file server base url.

cloudify.utils.get_manager_rest_service_port()[source]

Returns the port the manager REST service is running on.

cloudify.utils.id_generator(size=6, chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789')[source]

Generate and return a random string using upper case letters and digits.

class cloudify.utils.LocalCommandRunner(logger=None, host='localhost')[source]

Bases: object

run(command, exit_on_failure=True, stdout_pipe=True, stderr_pipe=True, cwd=None, execution_env=None)[source]

Runs local commands.

Parameters:
  • command – The command to execute.
  • exit_on_failure – False to ignore failures.
  • stdout_pipe – False to not pipe the standard output.
  • stderr_pipe – False to not pipe the standard error.
  • cwd – the working directory the command will run from.
  • execution_env – dictionary of environment variables that will be present in the command scope.
Returns:

A wrapper object for all valuable info from the execution.

Return type:

cloudify.utils.CommandExecutionResponse

class cloudify.utils.CommandExecutionResponse(command, std_out, std_err, return_code)[source]

Bases: object

Wrapper object for info returned when running commands.

Parameters:
  • command – The command that was executed.
  • std_out – The output from the execution.
  • std_err – The error message from the execution.
  • return_code – The return code from the execution.
cloudify.utils.setup_default_logger(logger_name, logger_level=20, handlers=None, remove_existing_handlers=True, logger_format=None, propagate=True)
Parameters:
  • logger_name – Name of the logger.
  • logger_level – Level for the logger (not for specific handler).
  • handlers – An optional list of handlers (formatter will be overridden); If None, only a StreamHandler for sys.stdout will be used.
  • remove_existing_handlers – Determines whether to remove existing handlers before adding new ones
  • logger_format – the format this logger will have.
  • propagate – propagate the message the parent logger.
Returns:

A logger instance.

Return type:

logging.Logger

class cloudify.utils.Internal[source]

Bases: object

static get_install_method(properties)[source]
static get_broker_ssl_and_port(ssl_enabled, cert_path)[source]
static get_broker_credentials(cloudify_agent)[source]

Get broker credentials or their defaults if not set.