104 |
104 |
To do so, open the following file with an appropriate remote desktop client.""")
|
105 |
105 |
CONNECT_LINUX_WINDOWS_SUBMESSAGE = _("""If you don't have one already
|
106 |
106 |
installed, we suggest the use of <a target="_blank" href="http://sourceforge.net/projects/tsclient/files/tsclient/tsclient-unstable/tsclient-2.0.1.tar.bz2/download">tsclient</a>.""")
|
107 |
|
|
108 |
107 |
CONNECT_WINDOWS_LINUX_MESSAGE = _("""A direct connection to this machine can be established using the <a target="_blank"
|
109 |
108 |
href="http://en.wikipedia.org/wiki/Secure_Shell">SSH Protocol</a>.
|
110 |
109 |
Open an ssh client such as PuTTY and type the following:""")
|
111 |
110 |
CONNECT_WINDOWS_LINUX_SUBMESSAGE = _("""If you do not have an ssh client already installed,
|
112 |
111 |
<a target="_blank" href="http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe">Download PuTTY</a>""")
|
113 |
|
CONNECT_WINDOWS_WINDOWS_MESSAGE = _("Trying to connect from windows to windows")
|
114 |
112 |
|
|
113 |
CONNECT_WINDOWS_WINDOWS_MESSAGE = _("""A direct connection to this machine can be
|
|
114 |
established using Remote Desktop. Click on the following link, and if asked open it using "Remote Desktop Connection" """)
|
|
115 |
CONNECT_WINDOWS_WINDOWS_SUBMESSAGE = _("""Save this file to disk for future use""")
|
115 |
116 |
|
116 |
117 |
# info/subinfo for all os combinations
|
117 |
118 |
#
|
118 |
119 |
# [0] info gets displayed on top of the message box
|
119 |
120 |
# [1] subinfo gets displayed on the bottom as extra info
|
120 |
121 |
# provided to the user when needed
|
121 |
|
CONNECT_PROMT_MESSAGES = {
|
|
122 |
CONNECT_PROMPT_MESSAGES = {
|
122 |
123 |
'linux': {
|
123 |
124 |
'linux': [CONNECT_LINUX_LINUX_MESSAGE, ""],
|
124 |
125 |
'windows': [CONNECT_LINUX_WINDOWS_MESSAGE, CONNECT_LINUX_WINDOWS_SUBMESSAGE]
|
125 |
126 |
},
|
126 |
127 |
'windows': {
|
127 |
128 |
'linux': [CONNECT_WINDOWS_LINUX_MESSAGE, CONNECT_WINDOWS_LINUX_SUBMESSAGE],
|
128 |
|
'windows': [CONNECT_WINDOWS_WINDOWS_MESSAGE, ""]
|
|
129 |
'windows': [CONNECT_WINDOWS_WINDOWS_MESSAGE, CONNECT_WINDOWS_WINDOWS_SUBMESSAGE]
|
129 |
130 |
}
|
130 |
131 |
}
|
131 |
132 |
|
|
133 |
# retrieve domain prefix from settings
|
|
134 |
DOMAIN_PREFIX = getattr(settings, 'MACHINE_DOMAIN_PREFIX', getattr(settings, 'BACKEND_PREFIX_ID', ""))
|
|
135 |
|
|
136 |
# domain template string
|
|
137 |
DOMAIN_TPL = "%s%%s" % DOMAIN_PREFIX
|
|
138 |
|
132 |
139 |
def machines_connect(request):
|
133 |
140 |
ip_address = request.GET.get('ip_address','')
|
134 |
141 |
operating_system = metadata_os = request.GET.get('os','')
|
135 |
142 |
server_id = request.GET.get('srv', 0)
|
136 |
143 |
host_os = request.GET.get('host_os','Linux').lower()
|
137 |
144 |
username = request.GET.get('username', None)
|
138 |
|
domain = request.GET.get("domain", "snf-%d" % int(server_id))
|
|
145 |
domain = request.GET.get("domain", DOMAIN_TPL % int(server_id))
|
139 |
146 |
|
140 |
147 |
# guess host os
|
141 |
148 |
if host_os != "windows":
|
... | ... | |
189 |
196 |
|
190 |
197 |
# try to find a specific message
|
191 |
198 |
try:
|
192 |
|
connect_message = CONNECT_PROMT_MESSAGES[host_os][operating_system][0]
|
193 |
|
subinfo = CONNECT_PROMT_MESSAGES[host_os][operating_system][1]
|
|
199 |
connect_message = CONNECT_PROMPT_MESSAGES[host_os][operating_system][0]
|
|
200 |
subinfo = CONNECT_PROMPT_MESSAGES[host_os][operating_system][1]
|
194 |
201 |
except KeyError:
|
195 |
202 |
connect_message = _("You are trying to connect from a %s machine to a %s machine") % (host_os, operating_system)
|
196 |
203 |
subinfo = ""
|