Skip to content

Commit 9fcf2e1

Browse files
committed
Manually merge PR143 to improve cloud instance status page information and layout with helpful suggestions from users/colleagues
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@6159 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent 709e86e commit 9fcf2e1

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

mig/shared/cloud.py

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,7 @@ def _get_jump_host(configuration, client_id, cloud_id, manage=False):
10561056
return jump_host
10571057
addr = lookup_user_service_value(configuration, client_id, service,
10581058
'service_jumphost_address', '')
1059+
jump_host['hostalias'] = '%s-cloud-jump' % cloud_id
10591060
jump_host['address'] = jump_host['fqdn'] = addr
10601061
jump_host['fqdn'] = cloud_fqdn_from_ip(configuration, addr)[0]
10611062
jump_host['user'] = lookup_user_service_value(
@@ -1152,39 +1153,60 @@ def cloud_remove_jump_host_key(configuration, client_id, cloud_id, auth_keys,
11521153
def cloud_ssh_login_help(configuration, client_id, cloud_id, label, address,
11531154
port, image):
11541155
"""Return complete ssh login instructions for saved cloud_dict instance on
1155-
cloud_id.
1156+
cloud_id. Output is explicitly html-formatted.
11561157
"""
11571158
_logger = configuration.logger
1158-
base_msg = """You can connect with ssh as user %s on host %s and port %d.
1159-
"""
1159+
base_msg = """<p>
1160+
You can connect with ssh as user %s on host %s and port %d.
1161+
<br/>"""
11601162
jump_msg = """Please note that you MUST explicitly ssh jump through host
11611163
%(fqdn)s as user %(user)s to reach the instance.
1162-
"""
1164+
<br/>"""
11631165
jump_host = cloud_login_jump_host(configuration, client_id, cloud_id)
11641166
fqdn = cloud_fqdn_from_ip(configuration, address)[0]
11651167
username = cloud_login_username(configuration, cloud_id, image)
11661168
msg = base_msg % (username, fqdn, port)
11671169
jump_opt = ''
11681170
ssh_config = """Host %s
1169-
HostName %s
1170-
User %s
1171-
# Path to your ssh private key matching pub key set on your Cloud Setup page
1172-
IdentityFile ~/.ssh/id_rsa
1173-
IdentitiesOnly yes
1171+
Hostname %s
1172+
User %s
1173+
# Path to your ssh private key matching pub key set on your Cloud Setup page
1174+
IdentityFile ~/.ssh/id_rsa
1175+
IdentitiesOnly yes
11741176
""" % (label, fqdn, username)
11751177
if jump_host['fqdn']:
11761178
msg += jump_msg % jump_host
11771179
jump_opt = "-J%(user)s@%(fqdn)s" % jump_host
1178-
ssh_config += """ProxyJump %(user)s@%(fqdn)s
1180+
ssh_config += """ ProxyJump %(hostalias)s
1181+
1182+
Host %(hostalias)s %(fqdn)s
1183+
Hostname %(fqdn)s
1184+
User %(user)s
1185+
# Path to your ssh private key matching pub key set on your Cloud Setup page
1186+
IdentityFile ~/.ssh/id_rsa
11791187
""" % jump_host
11801188
msg += """Example explicit ssh command:
1189+
<pre class='codeblock'>
1190+
<code>
11811191
ssh %s %s@%s
1192+
</code>
1193+
</pre>
1194+
</p>
11821195
""" % (jump_opt, username, fqdn)
1183-
msg += """
1196+
msg += """<p>
11841197
Alternatively you can add something like:
1198+
<pre class='codeblock'>
1199+
<code>
11851200
%s
1186-
to your ~/.ssh/config to allow the simple ssh command:
1201+
</code>
1202+
</pre>
1203+
to your ~/.ssh/config to allow connecting with the simple ssh command:
1204+
<pre class='codeblock'>
1205+
<code>
11871206
ssh %s
1207+
</code>
1208+
</pre>
1209+
</p>
11881210
""" % (ssh_config, label)
11891211

11901212
return msg

mig/shared/functionality/reqcloudservice.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def _ssh_help(configuration, client_id, cloud_id, cloud_dict,
109109
image = cloud_dict.get('INSTANCE_IMAGE', 'UNKNOWN')
110110
msg = cloud_ssh_login_help(configuration, client_id, cloud_id, label,
111111
address, port, image)
112-
# Wrap lines as html
113-
return msg.replace('\n', '<br/>')
112+
return msg
114113

115114

116115
def signature():

0 commit comments

Comments
 (0)