The deployer module

NotCheckingHostnameHTTPAdapter

class marcodeployer.deployer.NotCheckingHostnameHTTPAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)[source]

A middleware that avoids the verification of the SSL Hostname field. Since the name of the client cannot be verified, it is simply not checked

Generously provided by Juan Luis Boya

cert_verify(conn, *args, **kwargs)[source]

Avoids the verification of the SSL Hostname field

Parameters:conn (Connection) – The connection object

BaseHandler

class marcodeployer.deployer.BaseHandler(application, request, **kwargs)[source]

The base class which the rest of HTTP handlers extends. Provides secure cookie decryption and error handling

get_current_user()[source]

Decrypts the secure cookie

Returns:The name of the user or None
Return type:string

IndexHandler

class marcodeployer.deployer.IndexHandler(application, request, **kwargs)[source]

In charge of handling GET requests. Provides the client with the necessary .html/css/js

get(*args, **kwargs)[source]

Checks if the user is logged and sends the index files (basic HTML, CSS and JS). If the user is not already logged in, it is redirected to the main page.

LoginHandler

class marcodeployer.deployer.LoginHandler(application, request, **kwargs)[source]

Handles login authentication through secure cookies and PAM

get()[source]

Returns the login page if the user is not logged. Otherwise redirects to the index site.

post()[source]

Processes login requests using PAM. If the user and password combination is valid, the response is given a secure cookie, and the user gets redirected to the new index site. Otherwise, a 403 page is returned.

LogoutHandler

class marcodeployer.deployer.Logout(application, request, **kwargs)[source]

Removes the secure cookie.

get()[source]

Removes the secure cookie and redirects the user to the index folder.

UploadAndDeployHandler

class marcodeployer.deployer.UploadAndDeployHandler(application, request, **kwargs)[source]

Listens for POST requests and performs the deployment asynchronously.

deploy(node, request, filename, command, user, folder='', idpolo='', tomcat='', overwrite='false')[source]

Performs the deployment asynchronously.

Parameters:node (str) – The IP address of the node

:param BaseHandler request: The related POST request which invoked this method Deprecated

Parameters:
  • filename (str) – The name of the file to upload
  • command (str) – The command to execute after deployment
  • user (str) – The name of the user who performs the request
  • folder (str) – The deployment folder
  • idpolo (str) – The id of the polo service to publish
  • tomcat (str) – Specifies whether the file should be deployed as a tomcat service
  • overwrite (str) – Specifies if the file can overwrite existing files
Returns:

concurrent.future A future that encapsulates the asynchronous execution

post(*args, **kwargs)[source]

Receives a set of parameters through an asynchronous POST request:

  • file : A binary stream of data which corresponds to a file uploaded by the user.
  • folder : The folder where the file has to be stored
  • tomcat : Specifies that the service is a Tomcat container and that it must be added to the offered services
  • overwrite : If true, the file will overwrite a previous file with the same name
  • command : A command to execute when after the deployment
  • nodes : The nodes where the file and command are to be deployed

Writes a status code to the client in return

NodesHandler

class marcodeployer.deployer.NodesHandler(application, request, **kwargs)[source]

Handler for the Polo websocket connection

check_origin(origin)[source]

Overrides the parent method to return True for any request, since we are working without names.

See:check_origin
Returns:bool True
open()[source]

Processes a new WebSocket connection, storing it in open_ws. Returns the nodes offering the deployer service

Nodes

class marcodeployer.deployer.Nodes(application, request, **kwargs)[source]

Performs a synchronous Marco request for the deployer service

get()[source]

Returns a JSON string with the nodes offering the deployer service

ProbeHandler

class marcodeployer.deployer.ProbeHandler(application, request, **kwargs)[source]

A test connection to trigger the web browser certificate validation, since WebSockets cannot request user confirmation by themselves.

ProbeWSHandler

class marcodeployer.deployer.ProbeWSHandler(application, request, **kwargs)[source]
check_origin(origin)[source]

Overrides the parent method to return True for any request, since we are working without names

See:check_origin
Returns:bool True

main

deployer.main(args=None)