コード例 #1
0
    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']
コード例 #2
0
ファイル: forms.py プロジェクト: func09/freenas
    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']
コード例 #3
0
ファイル: forms.py プロジェクト: steveschnepp/freenas
    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']
コード例 #4
0
    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']
コード例 #5
0
ファイル: views.py プロジェクト: steveschnepp/freenas
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})
コード例 #6
0
ファイル: views.py プロジェクト: steveschnepp/freenas
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})
コード例 #7
0
ファイル: views.py プロジェクト: func09/freenas
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,
        })
コード例 #8
0
ファイル: views.py プロジェクト: func09/freenas
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,
        })
コード例 #9
0
ファイル: forms.py プロジェクト: CsMAr51/freenas
    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']