def __init__(self, *args, **kwargs): super(JailCreateForm, self).__init__(*args, **kwargs) logfile = "/var/tmp/warden.log" try: os.unlink(logfile) except: pass self.fields['jail_type'].widget.attrs['onChange'] = ( "jail_type_toggle();") self.fields['jail_32bit'].widget.attrs['onChange'] = ( "jail_32bit_toggle();") self.fields['jail_vnet'].widget.attrs['onChange'] = ( "jail_vnet_toggle();") self.fields['jail_nat'].widget.attrs['onChange'] = ( "jail_nat_toggle();") addrs = guess_adresses() if addrs['high_ipv6']: self.fields['jail_ipv6'].initial = addrs['high_ipv6'] if addrs['high_ipv4']: self.fields['jail_ipv4'].initial = addrs['high_ipv4'] if addrs['bridge_ipv4']: self.fields['jail_bridge_ipv4'].initial = addrs['bridge_ipv4'] if addrs['bridge_ipv6']: self.fields['jail_bridge_ipv6'].initial = addrs['bridge_ipv6']
def __init__(self, *args, **kwargs): super(JailCreateForm, self).__init__(*args, **kwargs) logfile = "/var/tmp/warden.log" try: os.unlink(logfile) except: pass self.fields['jail_type'].widget.attrs['onChange'] = ( "jail_type_toggle();" ) self.fields['jail_32bit'].widget.attrs['onChange'] = ( "jail_32bit_toggle();" ) self.fields['jail_vnet'].widget.attrs['onChange'] = ( "jail_vnet_toggle();" ) self.fields['jail_nat'].widget.attrs['onChange'] = ( "jail_nat_toggle();" ) addrs = guess_adresses() if addrs['high_ipv6']: self.fields['jail_ipv6'].initial = addrs['high_ipv6'] if addrs['high_ipv4']: self.fields['jail_ipv4'].initial = addrs['high_ipv4'] if addrs['bridge_ipv4']: self.fields['jail_bridge_ipv4'].initial = addrs['bridge_ipv4'] if addrs['bridge_ipv6']: self.fields['jail_bridge_ipv6'].initial = addrs['bridge_ipv6']
def __init__(self, *args, **kwargs): super(JailCreateForm, self).__init__(*args, **kwargs) self.fields['jail_type'].widget.attrs['onChange'] = ( "jail_type_toggle();" ) self.fields['jail_32bit'].widget.attrs['onChange'] = ( "jail_32bit_toggle();" ) self.fields['jail_vnet'].widget.attrs['onChange'] = ( "jail_vnet_toggle();" ) self.fields['jail_nat'].widget.attrs['onChange'] = ( "jail_nat_toggle();" ) addrs = guess_adresses() if addrs['high_ipv6']: self.fields['jail_ipv6'].initial = addrs['high_ipv6'] if addrs['high_ipv4']: self.fields['jail_ipv4'].initial = addrs['high_ipv4'] if addrs['bridge_ipv4']: self.fields['jail_bridge_ipv4'].initial = addrs['bridge_ipv4'] if addrs['bridge_ipv6']: self.fields['jail_bridge_ipv6'].initial = addrs['bridge_ipv6']
def __init__(self, *args, **kwargs): super(JailCreateForm, self).__init__(*args, **kwargs) self.fields['jail_type'].widget.attrs['onChange'] = ( "jail_type_toggle();") self.fields['jail_32bit'].widget.attrs['onChange'] = ( "jail_32bit_toggle();") self.fields['jail_vnet'].widget.attrs['onChange'] = ( "jail_vnet_toggle();") self.fields['jail_nat'].widget.attrs['onChange'] = ( "jail_nat_toggle();") addrs = guess_adresses() if addrs['high_ipv6']: self.fields['jail_ipv6'].initial = addrs['high_ipv6'] if addrs['high_ipv4']: self.fields['jail_ipv4'].initial = addrs['high_ipv4'] if addrs['bridge_ipv4']: self.fields['jail_bridge_ipv4'].initial = addrs['bridge_ipv4'] if addrs['bridge_ipv6']: self.fields['jail_bridge_ipv6'].initial = addrs['bridge_ipv6']
def install_available(request, oid): try: if not jail_path_configured(): jail_auto_configure() addrs = guess_adresses() if not addrs["high_ipv4"]: raise MiddlewareError(_("You must configure your network interface and a default " "gateway")) except MiddlewareError, e: return render(request, "plugins/install_error.html", {"error": e.value})
def upload(request, jail_id=-1): # FIXME: duplicated code with available_install try: if not jail_path_configured(): jail_auto_configure() addrs = guess_adresses() if not addrs["high_ipv4"]: raise MiddlewareError(_("You must configure your network interface and a default " "gateway")) except MiddlewareError, e: return render(request, "plugins/install_error.html", {"error": e.value})
def install_available(request, oid): try: if not jail_path_configured(): jail_auto_configure() addrs = guess_adresses() if not addrs['high_ipv4']: raise MiddlewareError( _("You must configure your network interface and a default " "gateway")) except MiddlewareError, e: return render(request, "plugins/install_error.html", { 'error': e.value, })
def upload(request, jail_id=-1): #FIXME: duplicated code with available_install try: if not jail_path_configured(): jail_auto_configure() addrs = guess_adresses() if not addrs['high_ipv4']: raise MiddlewareError( _("You must configure your network interface and a default " "gateway")) except MiddlewareError, e: return render(request, "plugins/install_error.html", { 'error': e.value, })
def __init__(self, *args, **kwargs): super(JailCreateForm, self).__init__(*args, **kwargs) self.logfile = "/var/tmp/warden.log" self.statusfile = "/var/tmp/status" try: os.unlink(self.logfile) except: pass try: os.unlink(self.statusfile) except: pass os.environ['EXTRACT_TARBALL_STATUSFILE'] = self.statusfile types = ((jt.jt_name, jt.jt_name) for jt in JailTemplate.objects.all()) self.fields['jail_type'].choices = types self.fields['jail_type'].widget.attrs['onChange'] = ( "jail_type_toggle();" ) self.fields['jail_32bit'].widget.attrs['onChange'] = ( "jail_32bit_toggle();" ) self.fields['jail_vnet'].widget.attrs['onChange'] = ( "jail_vnet_toggle();" ) self.fields['jail_nat'].widget.attrs['onChange'] = ( "jail_nat_toggle();" ) addrs = guess_adresses() if addrs['high_ipv6']: self.fields['jail_ipv6'].initial = addrs['high_ipv6'] if addrs['high_ipv4']: self.fields['jail_ipv4'].initial = addrs['high_ipv4'] if addrs['bridge_ipv4']: self.fields['jail_bridge_ipv4'].initial = addrs['bridge_ipv4'] if addrs['bridge_ipv6']: self.fields['jail_bridge_ipv6'].initial = addrs['bridge_ipv6']