def clean_nt4_workgroup(self): workgroup = self.cleaned_data.get("nt4_workgroup") try: validate_netbios_name(workgroup) except Exception as e: raise forms.ValidationError(_("workgroup: %s" % e)) return workgroup
def clean_ldap_netbiosname_a(self): netbiosname = self.cleaned_data.get("ldap_netbiosname_a") try: validate_netbios_name(netbiosname) except Exception as e: raise forms.ValidationError(e) return netbiosname
def clean_ldap_netbiosalias(self): netbiosalias = self.cleaned_data.get("ldap_netbiosalias") if netbiosalias: try: validate_netbios_name(netbiosalias) except Exception as e: raise forms.ValidationError(e) return netbiosalias
def clean_ldap_netbiosname_b(self): netbiosname_a = self.cleaned_data.get("ldap_netbiosname_a") netbiosname = self.cleaned_data.get("ldap_netbiosname_b") if not netbiosname: return netbiosname if netbiosname_a and netbiosname_a == netbiosname: raise forms.ValidationError( _('NetBIOS cannot be the same as the first.')) try: validate_netbios_name(netbiosname) except Exception as e: raise forms.ValidationError(e) return netbiosname
def clean_ldap_netbiosname_b(self): netbiosname_a = self.cleaned_data.get("ldap_netbiosname_a") netbiosname = self.cleaned_data.get("ldap_netbiosname_b") if not netbiosname: return netbiosname if netbiosname_a and netbiosname_a == netbiosname: raise forms.ValidationError(_( 'NetBIOS cannot be the same as the first.' )) try: validate_netbios_name(netbiosname) except Exception as e: raise forms.ValidationError(e) return netbiosname
def clean_ad_netbiosname_b(self): netbiosname_a = self.cleaned_data.get("ad_netbiosname_a") netbiosname = self.cleaned_data.get("ad_netbiosname_b") if not netbiosname: return netbiosname if netbiosname_a and netbiosname_a == netbiosname: with client as c: system_dataset = c.call('systemdataset.config') if system_dataset['path'] == "freenas-boot": raise forms.ValidationError( _('When the system dataset is located on the boot device, the same NetBIOS name cannot be used on both controllers.' )) try: validate_netbios_name(netbiosname) except Exception as e: raise forms.ValidationError(e) return netbiosname