Utils

cloudify.utils.get_local_ip()[source]

Return the IP address used to connect to this machine by the management. machine

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)[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.
Returns:

A wrapper object for all valuable info from the execution.

Return type:

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=10, handlers=None, remove_existing_handlers=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
Returns:

A logger instance.

Return type:

Logger