forked from RallyTools/RallyRestToolkitForPython
-
Notifications
You must be signed in to change notification settings - Fork 1
/
rallyfire.py
executable file
·63 lines (50 loc) · 2.65 KB
/
rallyfire.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
#################################################################################################
#
# rallyfire - Examplar script to test the basic connectivity to a Rally server
# and obtain basic workspace and project information
#
#################################################################################################
import sys
from pyral import Rally, rallySettings
#################################################################################################
errout = sys.stderr.write
#################################################################################################
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, workspace, project = rallySettings(options)
print " ".join(["|%s|" % item for item in [server, user, password, workspace, project]])
#rally = Rally(server, user, password, workspace=workspace, project=project,
# verify_ssl_cert=False)
rally = Rally(server, user, password, workspace=workspace, project=project)
#rally = Rally(server, user, password, debug=True)
# add in the debug=True keyword arg if you want more verbiage ...
#rally = Rally(server, user, password, workspace=workspace, project=project, debug=True)
specified_workspace = workspace
workspace = rally.getWorkspace()
print "Workspace: %s " % workspace.Name
if specified_workspace != workspace.Name:
print " ** The workspace you specified: %s is not a valid workspace name for your account, using your default workspace instead" % specified_workspace
#print "Workspace: %12.12s %-18.18s (%s)" % (workspace.oid, workspace.Name, workspace.ref)
project = rally.getProject()
print "Project : %s " % project.Name
#print "Project : %12.12s %-18.18s (%s)" % (project.oid, project.Name, project.ref)
# uncomment this to see all of your accessible workspaces and projects
# workspaces = rally.getWorkspaces()
# for workspace in workspaces:
# print " ", workspace.Name
# projects = rally.getProjects(workspace=workspace.Name)
# if projects:
# print ""
# print " Projects:"
# for project in projects:
# print " ", project.Name
# else:
# print " No projects"
# print ""
sys.exit(0)
#################################################################################################
#################################################################################################
if __name__ == '__main__':
main(sys.argv[1:])