-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_ticket.py
More file actions
89 lines (66 loc) · 1.96 KB
/
Copy pathget_ticket.py
File metadata and controls
89 lines (66 loc) · 1.96 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permission.
#
#
#
import sys, os, getpass
try:
import tacticenv
except ImportError:
pass
from tactic_client_lib import TacticServerStub
def main(args):
server = TacticServerStub(setup=False)
server.get_info_from_user(force=True)
return
"""
old_server_name = server.server_name
old_project_code = server.project_code
default_login = getpass.getuser()
print
server_name = raw_input("Enter name of TACTIC server (%s): " % old_server_name)
if not server_name:
server_name = old_server_name
print
login = raw_input("Enter user name (%s): " % default_login)
if not login:
login = default_login
print
password = getpass.getpass("Enter password: ")
print
project_code = raw_input("Project (%s): " % old_project_code)
if not project_code:
project_code = old_project_code
server.set_server(server_name)
# commit info to a file
if os.name == "nt":
dir = "C:/sthpw/etc"
else:
dir = "/tmp/sthpw/etc"
if not os.path.exists(dir):
os.makedirs(dir)
filename = "%s.tacticrc" % login
path = "%s/%s" % (dir,filename)
# do the actual work
ticket = server.get_ticket(login, password)
print "Got ticket [%s] for [%s]" % (ticket, login)
file = open(path, 'w')
file.write("login=%s\n" % login)
file.write("server=%s\n" % server_name)
file.write("ticket=%s\n" % ticket)
if project_code:
file.write("project=%s\n" % project_code)
file.close()
print
print "Saved to [%s]" % path
"""
if __name__ == '__main__':
executable = sys.argv[0]
args = sys.argv[1:]
main(args)