Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
a154a24c
authored
Mar 21, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webui: show port only if necessary
parent
db60e34b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
one/templates/vm-credentials.html
+2
-2
one/views.py
+11
-3
No files found.
one/templates/vm-credentials.html
View file @
a154a24c
...
...
@@ -40,10 +40,10 @@
<th>
{% trans "IP" %}:
</th>
<td>
{{ i.hostname }}
</td>
</tr>
<tr>
{% if i.nat %}
<tr>
<th>
{% trans "Port" %}:
</th>
<td>
{{ i.port}}
</td>
</tr>
</tr>
{% endif %}
<tr>
<th>
{% trans "Username" %}:
</th>
<td>
cloud
</td>
...
...
one/views.py
View file @
a154a24c
...
...
@@ -104,9 +104,12 @@ def ajax_template_name_unique(request):
def
vm_credentials
(
request
,
iid
):
try
:
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
proto
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
proto
)
vm
.
port
=
vm
.
get_port
(
use_ipv6
=
proto
)
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
vm
.
is_ipv6
=
is_ipv6
vm
.
hostname_v4
=
vm
.
get_connect_host
(
use_ipv6
=
False
)
vm
.
nat
=
vm
.
template
.
network
.
nat
vm
.
port
=
vm
.
get_port
(
use_ipv6
=
is_ipv6
)
return
render_to_response
(
'vm-credentials.html'
,
RequestContext
(
request
,
{
'i'
:
vm
}))
except
:
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
...
...
@@ -355,6 +358,11 @@ vm_list = login_required(VmListView.as_view())
@login_required
def
vm_show
(
request
,
iid
):
inst
=
get_object_or_404
(
Instance
,
id
=
iid
,
owner
=
request
.
user
)
is_ipv6
=
True
#len(request.META["REMOTE_ADDR"].split('.')) == 1
inst
.
is_ipv6
=
is_ipv6
inst
.
hostname_v4
=
inst
.
get_connect_host
(
use_ipv6
=
False
)
inst
.
nat
=
inst
.
template
.
network
.
nat
inst
.
port
=
inst
.
get_port
(
use_ipv6
=
is_ipv6
)
try
:
ports
=
inst
.
firewall_host
.
list_ports
()
except
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment