summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Server/Hostbase/hostbase/models.py1
-rw-r--r--src/lib/Server/Hostbase/hostbase/views.py21
-rw-r--r--src/lib/Server/Plugins/Hostbase.py9
3 files changed, 10 insertions, 21 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/models.py b/src/lib/Server/Hostbase/hostbase/models.py
index 887df5b39..4c29c8178 100644
--- a/src/lib/Server/Hostbase/hostbase/models.py
+++ b/src/lib/Server/Hostbase/hostbase/models.py
@@ -84,7 +84,6 @@ class IP(models.Model):
interface = models.ForeignKey(Interface,
edit_inline=models.TABULAR, num_in_admin=1)
ip_addr = models.IPAddressField(core=True)
- num = models.IntegerField()
def __str__(self):
return self.ip_addr
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py
index 6349f88d7..241c01296 100644
--- a/src/lib/Server/Hostbase/hostbase/views.py
+++ b/src/lib/Server/Hostbase/hostbase/views.py
@@ -218,8 +218,7 @@ def edit(request, host_id):
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
mx.save()
- new_ip = IP(interface=inter, num=len(ips),
- ip_addr=request.POST['%dip_addr' % inter.id])
+ new_ip = IP(interface=inter, ip_addr=request.POST['%dip_addr' % inter.id])
new_ip.save()
new_name = "-".join([host.hostname.split(".")[0],
new_ip.ip_addr.split(".")[2]])
@@ -250,8 +249,7 @@ def edit(request, host_id):
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
mx.save()
- new_ip = IP(interface=new_inter, num=0,
- ip_addr=request.POST['ip_addr_new'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new'])
new_ip.save()
new_name = "-".join([host.hostname.split(".")[0],
new_ip.ip_addr.split(".")[2]])
@@ -279,8 +277,7 @@ def edit(request, host_id):
hdwr_type=request.POST['hdwr_type_new'],
dhcp=False)
new_inter.save()
- new_ip = IP(interface=new_inter, num=0,
- ip_addr=request.POST['ip_addr_new'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new'])
new_ip.save()
new_name = "-".join([host.hostname.split(".")[0],
new_ip.ip_addr.split(".")[2]])
@@ -519,8 +516,7 @@ def new(request):
dhcp=request.POST.has_key('dhcp_new'))
new_inter.save()
if request.POST['mac_addr_new'] and request.POST['ip_addr_new']:
- new_ip = IP(interface=new_inter,
- num=0, ip_addr=request.POST['ip_addr_new'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new'])
new_ip.save()
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
@@ -548,8 +544,7 @@ def new(request):
hdwr_type=request.POST['hdwr_type_new1'],
dhcp=False)
new_inter.save()
- new_ip = IP(interface=new_inter, num=0,
- ip_addr=request.POST['ip_addr_new1'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new1'])
new_ip.save()
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
@@ -579,8 +574,7 @@ def new(request):
dhcp=request.POST.has_key('dhcp_new2'))
new_inter.save()
if request.POST['mac_addr_new2'] and request.POST['ip_addr_new2']:
- new_ip = IP(interface=new_inter, num=0,
- ip_addr=request.POST['ip_addr_new2'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new2'])
new_ip.save()
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
@@ -609,8 +603,7 @@ def new(request):
hdwr_type=request.POST['hdwr_type_new2'],
dhcp=False)
new_inter.save()
- new_ip = IP(interface=new_inter, num=0,
- ip_addr=request.POST['ip_addr_new2'])
+ new_ip = IP(interface=new_inter, ip_addr=request.POST['ip_addr_new2'])
new_ip.save()
mx, created = MX.objects.get_or_create(priority=settings.PRIORITY, mx=settings.DEFAULT_MX)
if created:
diff --git a/src/lib/Server/Plugins/Hostbase.py b/src/lib/Server/Plugins/Hostbase.py
index b5a09e760..85766ed65 100644
--- a/src/lib/Server/Plugins/Hostbase.py
+++ b/src/lib/Server/Plugins/Hostbase.py
@@ -68,11 +68,8 @@ class Hostbase(Plugin):
}
self.Entries['ConfigFile'] = {}
self.__rmi__ = ['rebuildState']
- try:
- self.rebuildState(None)
- except:
- raise PluginInitError
-
+ self.rebuildState(None)
+
def FetchFile(self, entry, metadata):
'''Return prebuilt file data'''
fname = entry.get('name').split('/')[-1]
@@ -240,7 +237,7 @@ class Hostbase(Plugin):
for filename in reversenames:
originlist = []
cursor.execute("""
- SELECT h.hostname, p.ip_addr, p.num FROM ((hostbase_host h
+ SELECT h.hostname, p.ip_addr FROM ((hostbase_host h
INNER JOIN hostbase_interface i ON h.id = i.host_id)
INNER JOIN hostbase_ip p ON i.id = p.interface_id)
WHERE p.ip_addr LIKE '%s%%%%' AND h.status = 'active' ORDER BY p.ip_addr