Dashboard > Pulse v2.1 > ... > Remote API Examples > Python Example - Marking a Project For Clean Build
  Pulse v2.1 Log In | Sign Up   View a printable version of the current page.  
  Python Example - Marking a Project For Clean Build
Added by Jason Sankey, last edited by Jason Sankey on May 20, 2010  (view change)
Labels: 
(None)

Pulse Manual Index

Overview

Marks a project for clean build This ensures the next build of the project on each agent is clean - any existing persistent working directory is removed before starting the build on the agent.

Code

#! /usr/bin/env python

from xmlrpclib import ServerProxy, Error
import sys

# Replace with your actual details
PULSE_HOST     = "pulse:8080"
PULSE_USER     = "admin"
PULSE_PASSWORD = "secret"


def mark_for_clean_build(project):
    server = ServerProxy("http://" + PULSE_HOST + "/xmlrpc")
    try:
        token = server.RemoteApi.login(PULSE_USER, PULSE_PASSWORD)
        server.RemoteApi.doConfigAction(token, "projects/" + project, "clean")
        server.RemoteApi.logout(token)
    except Error, v:
        print "Error:", v


if __name__ == "__main__":
    if len(sys.argv) < 2:
        print "Usage: %s <project>" % sys.argv[0]
        sys.exit(1)

    mark_for_clean_build(sys.argv[1])

Zutubi wiki is Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators