The backend module

The NotCheckingHostnameHTTPAdapter class

class marcobootstrap.backend.backend.NotCheckingHostnameHTTPAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)

Avoids checking the hostname field of a HTTPS connection

cert_verify(conn, *args, **kwargs)

Asserts that the hostname is valid without regard to its value

The BaseHandler class

class marcobootstrap.backend.backend.BaseHandler(application, request, **kwargs)

An extension of tornado.web.RequestHandler that decrypts a secure username cookie

The WebHandler class

class marcobootstrap.backend.backend.WebHandler(application, request, **kwargs)

Handles index connections

get(*args, **kwargs)

If the user is logged, displays the main interface. Otherwise redirects the user to the login window

The LoginHandler class

class marcobootstrap.backend.backend.LoginHandler(application, request, **kwargs)

Handles the login process

get(*args, **kwargs)

Displays a login form

post()

Validates the credentials and, if successful, redirects the user to the main window. If unsuccessful a message error is displayed.

The LogoutHandler class

class marcobootstrap.backend.backend.LogoutHandler(application, request, **kwargs)

Handles the exiting process

get(*args, **kwargs)

Removes the user cookie

The ScheduledHandler class

class marcobootstrap.backend.backend.ScheduledHandler(application, request, **kwargs)

Displays the database information about the scheduled events

get(*args, **kwargs)

Renders a view with all future scheduled jobs

The add_callback function

marcobootstrap.backend.backend.add_callback(future, callback, *args, **kwargs)

Adds and event to the IOLoop instance and binds it to the callback funcion

Parameters:
  • future (Future) – A future object where to extract information from
  • callback (function) – The callback function

The Schedule class

class marcobootstrap.backend.backend.Schedule(application, request, **kwargs)

Schedules operations to the nodes in the net

add_to_db(operation_type, schedule_time, hosts, image=None)

Adds to the database a new operation entry with all the concerning information

Parameters:
  • operation_type (str) – An identifier for the kind of operation (reboot, update...)
  • schedule_time (float) – A time represented in absolute milliseconds (starting on the epoch) that indicates the time of execution.
  • hosts (list) – A list of the hosts where the operation is to be executed on
  • image (string) – The OS image (only useful for update and similar operations)
deployed(response, node)

Used as a callback for the POST process

post(*args, **kwargs)

Processes a POST request with the operation parameters

The CancelHandler class

class marcobootstrap.backend.backend.CancelHandler(application, request, **kwargs)

Allows cancellation of an operation which is yet to be done.

cancel(response)

A simple callback, used for logging and debugging purposes

post(*args, **kwargs)

Processes a cancellation request

The run_async function

marcobootstrap.backend.backend.run_async(func)

A simple wrapper that allows a blocking function to work inside the tornado IOLoop :param function func: The blocking function :returns: An async_func callable

The longwait function

marcobootstrap.backend.backend.longwait(*args, **kwargs)

Performs a Marco request

The MarcoDetect class

class marcobootstrap.backend.backend.MarcoDetect(application, request, **kwargs)

Detect all nodes in the network

get(*args, **kwargs)

Performs the Marco operation and returns the result as a JSON-formatted string :returns: A JSON formated string with the node information

The RemoveHandler class

class marcobootstrap.backend.backend.RemoveHandler(application, request, **kwargs)

Removes an OS image

post(*args, **kwargs)

Processes the request and removes the OS image