How to use the pyral.rallyWorkset function in pyral

To help you get started, we’ve selected a few pyral examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RallyTools / RallyRestToolkitForPython / examples / uptask.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if len(args) != 1:
        errout(USAGE)
        sys.exit(1)

    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging("rally.history.uptask")

    taskID = args.pop()   # for this example use the FormattedID
    print("attempting to update Task: %s" % taskID)

    #
    # following assumes there is:
    #     a User in the system whose DisplayName is 'Crandall',
    #     a UserStory with a FormattedID of S12345, 
    #     a Release with a name of 'April-A', 
    #    an Iteration with a Name of 'Ivanhoe' 
    # within the current Workspace and Project.
github RallyTools / RallyRestToolkitForPython / examples / get_attachments.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    print " | ".join([server, username, password, workspace, project])
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.getattachs') # name of file you want logging to go to

    if len(args) != 2:
        errout(USAGE)
        sys.exit(2)
    entity_name, ident = args
    if entity_name in STORY_ALIASES:
        entity_name = 'HierarchicalRequirement'

    mo = OID_PATT.match(ident)
    if mo:
github RallyTools / RallyRestToolkitForPython / examples / typedef.py View on Github external
options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if not args:
        print("You must supply an entity name!")
        sys.exit(1)

    query = ""
    target = args[0]
    if target in ['UserStory', 'User Story', 'Story']:
        target = "HierarchicalRequirement"
    if '/' in target:
        parent, entity = target.split('/', 1)
        target = entity
    query = 'ElementName = "%s"' % target

    server, username, password, apikey, workspace, project = rallyWorkset(options)
    print(" ".join(["|%s|" % item for item in [server, username, password, apikey, workspace, project]]))
    try:
        rally = Rally(server, username, password, apikey=apikey, workspace=workspace, server_ping=False)
    except Exception as ex:
        errout(str(ex.args[0]))       
        sys.exit(1)

    sub_name  = rally.subscriptionName()
    print("Subscription Name: %s" % sub_name)
    wksp = rally.getWorkspace()
    print("Workspace Name: %s" % wksp.Name)
    print("Entity: %s" % target)
    print("-----------")
    print("Attributes:")
    print("-----------")
github RallyTools / RallyRestToolkitForPython / examples / repoitems.py View on Github external
def main(args):

    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    if not args:
        print(USAGE)
        sys.exit(9)
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.chgsets')  # name of file you want the logging to go to

    repo_name = args.pop(0)
    since = None
    if args:
        since = args.pop(0)
        try:
            days = int(since)
            now = time.time()
            since_ts = now - (days * 86400)
            since = time.strftime("%Y-%m-%dT%H:%M:%S.000Z", time.gmtime(since_ts))
        except:
github RallyTools / RallyRestToolkitForPython / examples / wkspcounts.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    
    target_workspace, byproject, art_types = processCommandLineArguments(args)
    rally.enableLogging('rally.hist.articount')  # name of file you want logging to go to
    
    workspaces = rally.getWorkspaces()
    if target_workspace != 'all':
        hits = [wksp for wksp in workspaces if wksp.Name == target_workspace]
        if not hits:
            problem = "The specified target workspace: '%s' either does not exist or is not accessible"
            errout("ERROR: %s\n" % (problem % target_workspace))
            sys.exit(2)
        workspaces = hits
github RallyTools / RallyRestToolkitForPython / examples / add_tcrs.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging("rally.hist.add_tcrs")

    if len(args) < 2:
        errout(USAGE)
        sys.exit(1)
    test_case_id, tcr_info_filename = args
    if not os.path.exists(tcr_info_filename):
        errout("ERROR:  file argument '%s' does not exist.  Respecify using corrent name or path\n" % tcr_info_filename)
        errout(USAGE)
        sys.exit(2)
    try:
        with open(tcr_info_filename, 'r') as tcif:
github RallyTools / RallyRestToolkitForPython / examples / statecounts.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)

    rally.enableLogging('rally.hist.statecount')  # name of file you want logging to go to

    if not args:
        errout(USAGE)
        sys.exit(1)

    rally.setWorkspace(workspace)
    rally.setProject(project)

    artifact_type = args[0]
    if artifact_type not in VALID_ARTIFACT_TYPES:
github RallyTools / RallyRestToolkitForPython / examples / builddefs.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]

    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace)
    rally.enableLogging("rally.history.blddefs")

    for workspace, project in wps:
        rally.setWorkspace(workspace)
        print("workspace: %s  project: %s\n" % (workspace, project))
        response = rally.get('BuildDefinition', fetch=True, 
                             query='Project.Name = "%s"' % project, 
                             order='Name', workspace=workspace, project=project)
        if response.errors:
            print(response.errors)
            sys.exit(9)
github RallyTools / RallyRestToolkitForPython / examples / addtags.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, user, password, apikey, workspace, project = rallyWorkset(options)
    #rally = Rally(server, user, password, apikey=apikey, workspace=workspace)
    rally = Rally(server, user, password, workspace=workspace, project=project)
    rally.enableLogging("rally.history.addtags")

    if len(args) < 2:
        print(USAGE)
        sys.exit(1)

    story_id = args.pop(0)
    tag_names = args[:]
    tags = []

    story = rally.get('Story', fetch="FormattedID,Name,Description,Tags", 
                       query="FormattedID = %s" % story_id,
                       server_ping=False, isolated_workspace=True, instance=True)
github RallyTools / RallyRestToolkitForPython / examples / periscope.py View on Github external
def main(args):
    options = [opt for opt in args if opt.startswith('--')]
    args    = [arg for arg in args if arg not in options]
    server, username, password, apikey, workspace, project = rallyWorkset(options)
    if apikey:
        rally = Rally(server, apikey=apikey, workspace=workspace, project=project)
    else:
        rally = Rally(server, user=username, password=password, workspace=workspace, project=project)
    rally.enableLogging('rally.hist.periscope')  # name of file for logging content

    for workspace in rally.getWorkspaces():
        print("%s %s" % (workspace.oid, workspace.Name))
        for project in rally.getProjects(workspace=workspace.Name):
            print("    %12.12s  %-36.36s   |%s|" % (project.oid, project.Name, project.State))
        print("")