Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
940f9eaa
Commit
940f9eaa
authored
Oct 10, 2013
by
Christos Stavrakakis
Browse files
cyclades: Fix helpdesk code and tests for new nets
parent
43e14023
Changes
5
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/helpdesk/templates/helpdesk/networks_list.html
View file @
940f9eaa
...
...
@@ -47,7 +47,7 @@
<td>
{{ nic.updated }}
</td>
<td>
{{ nic.index }}
</td>
<td>
{{ nic.mac }}
</td>
<td>
{{ nic.ipv4 }}
</td>
<td>
{{ nic.ipv4
_address
}}
</td>
<td>
{{ nic.ipv6 }}
</td>
<td>
{{ nic.get_firewall_profile_display }} ({{nic.firewall_profile}})
</td>
</tr>
...
...
snf-cyclades-app/synnefo/helpdesk/templates/helpdesk/vms_list.html
View file @
940f9eaa
...
...
@@ -83,8 +83,8 @@
<td>
{{ nic.updated }}
</td>
<td>
{{ nic.index }}
</td>
<td>
{{ nic.mac }}
</td>
<td>
{{ nic.ipv4 }}
</td>
<td>
{{ nic.ipv6 }}
</td>
<td>
{{ nic.ipv4
_address
}}
</td>
<td>
{{ nic.ipv6
_address
}}
</td>
<td>
{{ nic.get_firewall_profile_display }} ({{nic.firewall_profile}})
</td>
</tr>
{% empty %}
...
...
snf-cyclades-app/synnefo/helpdesk/templatetags/helpdesk_tags.py
View file @
940f9eaa
...
...
@@ -10,7 +10,7 @@ def vm_public_ip(vm):
address
"""
try
:
return
vm
.
nics
.
filter
(
network__public
=
True
)[
0
].
ipv4
return
vm
.
nics
.
filter
(
network__public
=
True
)[
0
].
ipv4
_address
except
IndexError
:
return
"No public ip"
...
...
snf-cyclades-app/synnefo/helpdesk/tests.py
View file @
940f9eaa
...
...
@@ -111,12 +111,15 @@ class HelpdeskTests(TestCase):
vm2u2
=
mfactory
.
VirtualMachineFactory
(
userid
=
USER2
,
name
=
"user2 vm2"
,
pk
=
1003
)
netpub
=
mfactory
.
NetworkFactory
(
public
=
True
)
net1u1
=
mfactory
.
NetworkFactory
(
public
=
False
,
userid
=
USER1
)
nic1
=
mfactory
.
NetworkInterfaceFactory
(
machine
=
vm1u2
,
network
=
net1u1
)
nic2
=
mfactory
.
NetworkInterfaceFactory
(
machine
=
vm1u1
,
network
=
netpub
,
ipv4
=
"195.251.222.211"
)
nic1
=
mfactory
.
NetworkInterfaceFactory
(
machine
=
vm1u2
,
userid
=
vm1u2
.
userid
,
network__public
=
False
,
network__userid
=
USER1
)
ip2
=
mfactory
.
IPv4AddressFactory
(
nic__machine
=
vm1u1
,
userid
=
vm1u1
.
userid
,
network__public
=
True
,
network__userid
=
None
,
address
=
"195.251.222.211"
)
def
test_enabled_setting
(
self
):
settings
.
HELPDESK_ENABLED
=
False
...
...
snf-cyclades-app/synnefo/helpdesk/views.py
View file @
940f9eaa
...
...
@@ -46,7 +46,7 @@ from urllib import unquote
import
astakosclient
from
snf_django.lib
import
astakos
from
synnefo.db.models
import
VirtualMachine
,
NetworkInterface
,
Network
from
synnefo.db.models
import
VirtualMachine
,
IPAddress
,
Network
# server actions specific imports
from
synnefo.api
import
util
...
...
@@ -185,11 +185,11 @@ def account(request, search_query):
if
is_ip
:
try
:
nic
=
NetworkInterface
.
objects
.
filter
(
ipv4
=
search_query
).
exclude
(
machine__deleted
=
True
)
.
get
()
search_query
=
nic
.
machine
.
userid
ip
=
IPAddress
.
objects
.
filter
(
address
=
search_query
,
deleted
=
False
)
\
.
get
()
search_query
=
ip
.
userid
is_uuid
=
True
except
NetworkInterface
.
DoesNotExist
:
except
IPAddress
.
DoesNotExist
:
account_exists
=
False
account
=
None
...
...
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