def get_all_templates(): all_templates = okconfig.get_templates() service_templates = filter(lambda x: 'host' not in x, all_templates) return map( lambda x: (x, _("Standard %(service_template)s checks") % { "service_template": x }), service_templates)
def clean(self): cleaned_data = super(AddTemplateForm,self).clean() force = self.cleaned_data.get('force') host_name = self.cleaned_data.get('host_name') templates = self.cleaned_data.get('templates') for i in templates: if i not in okconfig.get_templates().keys(): self._errors['templates'] = self.error_class( ['template %s was not found'%i] ) if not force and host_name not in okconfig.get_hosts(): self._errors['host_name'] = self.error_class(['Host name not found Use force to write template anyway']) return cleaned_data
def clean(self): cleaned_data = super(AddHostForm, self).clean() force = self.cleaned_data.get("force") host_name = self.cleaned_data.get("host_name") templates = self.cleaned_data.get("templates") for i in templates: if i not in okconfig.get_templates().keys(): self._errors["templates"] = self.error_class(["template %s was not found" % i]) if not force and host_name in okconfig.get_hosts(): self._errors["host_name"] = self.error_class(["Host name already exists. Use force to overwrite"]) return cleaned_data
def clean(self): cleaned_data = super(AddHostForm, self).clean() force = self.cleaned_data.get('force') host_name = self.cleaned_data.get('host_name') templates = self.cleaned_data.get('templates') for i in templates: if i not in okconfig.get_templates().keys(): self._errors['templates'] = self.error_class( [_('template %s was not found') % i]) if not force and host_name in okconfig.get_hosts(): self._errors['host_name'] = self.error_class( [_('Host name already exists. Use force to overwrite')]) return cleaned_data
def get_all_templates(): all_templates = okconfig.get_templates() service_templates = filter(lambda x: 'host' not in x, all_templates) return map(lambda x: (x, "Standard " + x + " checks"), service_templates)
def get_all_templates(): all_templates = okconfig.get_templates() service_templates = [x for x in all_templates if 'host' not in x] return [(x, _("Standard %(service_template)s checks") % { "service_template": x }) for x in service_templates]
def get_all_templates(): all_templates = okconfig.get_templates() service_templates = filter(lambda x: 'host' not in x, all_templates) return map(lambda x: (x, _("Standard %(service_template)s checks") % {"service_template": x}), service_templates)