示例#1
0
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)
示例#2
0
 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
示例#3
0
 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
示例#4
0
 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
示例#5
0
 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
示例#6
0
 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
示例#7
0
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)
示例#8
0
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)
示例#9
0
文件: forms.py 项目: binRick/adagios
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]
示例#10
0
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)