Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Show 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 @@
...
@@ -40,10 +40,10 @@
<th>
{% trans "IP" %}:
</th>
<th>
{% trans "IP" %}:
</th>
<td>
{{ i.hostname }}
</td>
<td>
{{ i.hostname }}
</td>
</tr>
</tr>
<tr>
{% if i.nat %}
<tr>
<th>
{% trans "Port" %}:
</th>
<th>
{% trans "Port" %}:
</th>
<td>
{{ i.port}}
</td>
<td>
{{ i.port}}
</td>
</tr>
</tr>
{% endif %}
<tr>
<tr>
<th>
{% trans "Username" %}:
</th>
<th>
{% trans "Username" %}:
</th>
<td>
cloud
</td>
<td>
cloud
</td>
...
...
one/views.py
View file @
a154a24c
...
@@ -104,9 +104,12 @@ def ajax_template_name_unique(request):
...
@@ -104,9 +104,12 @@ def ajax_template_name_unique(request):
def
vm_credentials
(
request
,
iid
):
def
vm_credentials
(
request
,
iid
):
try
:
try
:
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
vm
=
get_object_or_404
(
Instance
,
pk
=
iid
,
owner
=
request
.
user
)
proto
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
is_ipv6
=
len
(
request
.
META
[
"REMOTE_ADDR"
]
.
split
(
'.'
))
==
1
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
proto
)
vm
.
hostname
=
vm
.
get_connect_host
(
use_ipv6
=
is_ipv6
)
vm
.
port
=
vm
.
get_port
(
use_ipv6
=
proto
)
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
}))
return
render_to_response
(
'vm-credentials.html'
,
RequestContext
(
request
,
{
'i'
:
vm
}))
except
:
except
:
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
return
HttpResponse
(
_
(
"Could not get Virtual Machine credentials."
),
status
=
404
)
...
@@ -355,6 +358,11 @@ vm_list = login_required(VmListView.as_view())
...
@@ -355,6 +358,11 @@ vm_list = login_required(VmListView.as_view())
@login_required
@login_required
def
vm_show
(
request
,
iid
):
def
vm_show
(
request
,
iid
):
inst
=
get_object_or_404
(
Instance
,
id
=
iid
,
owner
=
request
.
user
)
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
:
try
:
ports
=
inst
.
firewall_host
.
list_ports
()
ports
=
inst
.
firewall_host
.
list_ports
()
except
:
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