Esempio n. 1
0
def addHost(name):
    s = ConfigSubsection()
    s.name = ConfigText(default=name, fixed_size=False)
    s.enable_incoming = ConfigYesNo(default=False)
    s.enable_outgoing = ConfigYesNo(default=False)
    s.address = ConfigText(fixed_size=False)
    s.password = ConfigPassword()
    s.protocol = ConfigSelection(
        default="growl",
        choices=[
            ("growl", "Growl"),
            ("gntp", "GNTP"),
            ("snarl", "Snarl"),
            ("prowl", "Prowl"),
            ("syslog", "Syslog UDP"),
        ],
    )
    s.level = ConfigSelection(
        default="-1",
        choices=[
            ("-1", _("Low (Yes/No)")),
            ("0", _("Normal (Information)")),
            ("1", _("High (Warning)")),
            ("2", _("Highest (Emergency)")),
        ],
    )
    s.blacklist = ConfigSet(choices=[])
    config.plugins.growlee.hosts.append(s)
    return s
Esempio n. 2
0
def addHost(name):
	s = ConfigSubsection()
	s.name = ConfigText(default=name, fixed_size=False)
	s.enable_incoming = ConfigYesNo(default=False)
	s.enable_outgoing = ConfigYesNo(default=False)
	s.address = ConfigText(fixed_size=False)
	s.password = ConfigPassword()
	s.protocol = ConfigSelection(default="growl", choices=[("growl", "Growl"), ("snarl", "Snarl"), ("prowl", "Prowl"), ("syslog", "Syslog UDP")])
	s.level = ConfigSelection(default="-1", choices=[("-1", _("Low (Yes/No)")), ("0", _("Normal (Information)")), ("1", _("High (Warning)")), ("2", _("Highest (Emergency)"))])
	s.blacklist = ConfigSet(choices=[])
	config.plugins.growlee.hosts.append(s)
	return s
Esempio n. 3
0
while i < growlee.hostcount.value:
    addHost(str(i + 1))
    i += 1

# XXX: change to new config format
# NOTE: after some time, remove this and hardcode default length to 1
# since internally we assume to have at least 1 host configured
if growlee.hostcount.value == 0:
    growlee.enable_outgoing = ConfigYesNo(default=False)
    growlee.enable_incoming = ConfigYesNo(default=False)
    growlee.address = ConfigText(fixed_size=False)
    growlee.password = ConfigPassword()
    password = growlee.password.value
    growlee.prowl_api_key = ConfigText()
    growlee.protocol = ConfigSelection(
        default="growl", choices=[("growl", "Growl"), ("snarl", "Snarl"), ("prowl", "Prowl")]
    )
    growlee.level = ConfigSelection(
        default="-1",
        choices=[
            ("-1", _("Low (Yes/No)")),
            ("0", _("Normal (Information)")),
            ("1", _("High (Warning)")),
            ("2", _("Highest (Emergency)")),
        ],
    )
    growlee.blacklist = ConfigSet(choices=[])
    if growlee.protocol.value == "prowl":
        password = growlee.prowl_api_key.value

    s = addHost(_("Converted connection"))
Esempio n. 4
0
while i < growlee.hostcount.value:
    addHost(str(i + 1))
    i += 1

# XXX: change to new config format
# NOTE: after some time, remove this and hardcode default length to 1
# since internally we assume to have at least 1 host configured
if growlee.hostcount.value == 0:
    growlee.enable_outgoing = ConfigYesNo(default=False)
    growlee.enable_incoming = ConfigYesNo(default=False)
    growlee.address = ConfigText(fixed_size=False)
    growlee.password = ConfigPassword()
    password = growlee.password.value
    growlee.prowl_api_key = ConfigText()
    growlee.protocol = ConfigSelection(default="growl",
                                       choices=[("growl", "Growl"),
                                                ("snarl", "Snarl"),
                                                ("prowl", "Prowl")])
    growlee.level = ConfigSelection(default="-1",
                                    choices=[("-1", _("Low (Yes/No)")),
                                             ("0", _("Normal (Information)")),
                                             ("1", _("High (Warning)")),
                                             ("2", _("Highest (Emergency)"))])
    growlee.blacklist = ConfigSet(choices=[])
    if growlee.protocol.value == "prowl":
        password = growlee.prowl_api_key.value

    s = addHost(_("Converted connection"))
    s.enable_incoming.value = growlee.enable_incoming.value
    s.enable_outgoing.value = growlee.enable_outgoing.value
    s.address.value = growlee.address.value
    s.password.value = password