Exemple #1
0
 def valuespec(cls):
     return Dictionary(
         elements=[
             ("conditions",
              Dictionary(title=_("Conditions"),
                         elements=cls.get_host_conditions(),
                         optional_keys=[])),
             ("refer_to",
              CascadingDropdown(
                  title=_("Refer to:"),
                  choices=[
                      ('host', _("The found hosts themselves")),
                      ('child', _("The found hosts' childs")),
                      ('child_with', _("The found hosts' childs (with child filtering)"),
                       Tuple(elements=[
                           DictHostTagCondition(title=_("Child Host Tags:"), help_txt=""),
                           _bi_host_choice_vs(_("Child host name:")),
                       ])),
                      ('parent', _("The found hosts' parents")),
                  ],
                  help=_(
                      'When selecting <i>The found hosts\' childs</i>, the conditions '
                      '(tags and host name) are used to match a host, but you will get one '
                      'node created for each child of the matched host. The '
                      'place holder <tt>$HOSTNAME$</tt> contains the name of the found child '
                      'and the place holder <tt>$HOSTALIAS$</tt> contains it\'s alias.<br><br>'
                      'When selecting <i>The found hosts\' parents</i>, the conditions '
                      '(tags and host name) are used to match a host, but you will get one '
                      'node created for each of the parent hosts of the matched host. '
                      'The place holder <tt>$HOSTNAME$</tt> contains the name of the child '
                      'host and <tt>$2$</tt> the name of the parent host.'),
              )),
         ],
         optional_keys=[],
     )
Exemple #2
0
 def get_host_conditions(cls):
     return [
         ("host_folder",
          DropdownChoice(
              title=_("Folder"),
              help=_("The rule is only applied to hosts directly in or below this folder."),
              choices=watolib.Folder.folder_choices(),
              encode_value=False,
          )),
         ("host_tags", DictHostTagCondition(title=_("Host Tags"), help_txt="")),
         ("host_labels", LabelCondition(title=_("Host Labels"), help_txt="")),
         ("host_choice", _bi_host_choice_vs(_("Filter Host"))),
     ]