yet even more sex to the configuration dialog
authorOliver Maurhart <oliver.maurhart@ait.ac.at>
Wed, 25 Jun 2014 20:56:40 +0200
changeset 2040c3136908f4f
parent 203 0cc33b647a4e
child 206 be839e4a1370
yet even more sex to the configuration dialog
OpenSecurity/bin/opensecurityd.pyw
OpenSecurity/bin/ui/configure_dialog.py
     1.1 --- a/OpenSecurity/bin/opensecurityd.pyw	Wed Jun 25 20:46:31 2014 +0200
     1.2 +++ b/OpenSecurity/bin/opensecurityd.pyw	Wed Jun 25 20:56:40 2014 +0200
     1.3 @@ -231,6 +231,7 @@
     1.4          return json.dumps(json.loads(res), indent = 4)
     1.5  
     1.6  
     1.7 +
     1.8  class os_sdvm:
     1.9      """OpenSecurity '/sdvms/[VM]' handler
    1.10      
    1.11 @@ -311,7 +312,12 @@
    1.12          """get the list of SDVMs"""
    1.13          log_call(web.ctx.environ)
    1.14          global gvm_mgr
    1.15 -        return str(gvm_mgr.listSDVM()).replace("'",'"') 
    1.16 +
    1.17 +        d = {}
    1.18 +        for sdvm in gvm_mgr.listSDVM():
    1.19 +            d[sdvm] = gvm_mgr.getHostOnlyIP(sdvm)
    1.20 +
    1.21 +        return json.dumps(d, indent = 4)
    1.22              
    1.23      def POST(self):
    1.24          """create a new SDVM"""
     2.1 --- a/OpenSecurity/bin/ui/configure_dialog.py	Wed Jun 25 20:46:31 2014 +0200
     2.2 +++ b/OpenSecurity/bin/ui/configure_dialog.py	Wed Jun 25 20:56:40 2014 +0200
     2.3 @@ -228,6 +228,9 @@
     2.4              i = QtGui.QTreeWidgetItem(self.ui.tvMachines)
     2.5              i.setIcon(0, self._icon_machine)
     2.6              i.setText(0, m)
     2.7 +            i.setIcon(1, self._icon_network)
     2.8 +            i.setText(1, machines[m])
     2.9 +
    2.10  
    2.11              properties = json.load(urllib2.urlopen('http://127.0.0.1:8080/sdvms/' + m))
    2.12              for p in properties:
    2.13 @@ -236,11 +239,9 @@
    2.14                  j.setText(0, p)
    2.15                  j.setText(1, properties[p])
    2.16  
    2.17 -            ip = urllib2.urlopen('http://127.0.0.1:8080/sdvms/' + m + '/ip')   
    2.18 -            j = QtGui.QTreeWidgetItem(i)
    2.19              j.setIcon(0, self._icon_network)
    2.20              j.setText(0, 'ip')
    2.21 -            j.setText(1, ip.read())
    2.22 +            j.setText(1, machines[m])
    2.23  
    2.24  
    2.25          #except: