Example #1
0
 def validators(self):
     """Validators validate the input on change and give UI feedback
     """
     return {"logrotate.max_size": valid.Number(bounds=[0, None]),
             "rsyslog.address": (valid.Empty() | valid.FQDNOrIPAddress()),
             "rsyslog.port": valid.Port(),
             "netconsole.address": (valid.Empty() |
                                    valid.FQDNOrIPAddress()),
             "netconsole.port": valid.Port(),
             }
Example #2
0
    def validators(self):
        ip_or_empty = valid.IPAddress() | valid.Empty()
        fqdn_ip_or_empty = valid.FQDNOrIPAddress() | valid.Empty()

        valid_bond_name = valid.RegexValidator("^(bond[0-9]{1,2}|007)$",
                                               "a valid bond name (bond[0-99])"
                                               )
                                               # No regex, but for users ^

        return {"hostname": fqdn_ip_or_empty,
                "dns[0]": ip_or_empty,
                "dns[1]": ip_or_empty,
                "ntp[0]": fqdn_ip_or_empty,
                "ntp[1]": fqdn_ip_or_empty,

                "dialog.nic.ipv4.address": valid.IPv4Address() | valid.Empty(),
                "dialog.nic.ipv4.netmask": valid.IPv4Address() | valid.Empty(),
                "dialog.nic.ipv4.gateway": valid.IPv4Address() | valid.Empty(),
                "dialog.nic.ipv6.address": valid.IPv6Address() | valid.Empty(),
                "dialog.nic.ipv6.netmask": (valid.Number(bounds=[0, 128]) |
                                            valid.Empty()),
                "dialog.nic.ipv6.gateway": valid.IPv6Address() | valid.Empty(),
                "dialog.nic.vlanid": (valid.Number(bounds=[0, 4096]) |
                                      valid.Empty()),

                "bond.name": valid_bond_name,
                "bond.options": valid.Text(min_length=1)
                }
Example #3
0
 def validators(self):
     """Validators validate the input on change and give UI feedback
     """
     return {
         "logrotate.max_size":
         valid.Number(bounds=[0, None]),
         "logrotate.interval":
         valid.Options(dict(self._intervals).keys()),
         "rsyslog.address": (valid.Empty() | valid.FQDNOrIPAddress()),
         "rsyslog.port":
         valid.Port(),
         "netconsole.address":
         (valid.Empty() | valid.FQDNOrIPAddress(allow_ipv6=False)),
         "netconsole.port":
         valid.Port(),
     }
Example #4
0
 def validators(self):
     """Validators validate the input on change and give UI feedback
     """
     # The address must be fqdn, ipv4 or ipv6 address
     return {"ping.address": valid.FQDNOrIPAddress(),
             #"ping.count": valid.Number(bounds=[1, 20]),
             }
Example #5
0
    def update(self, servers):
        assert type(servers) is list
        # Preparation
        servers = [i.strip() for i in servers]
        servers = [i for i in servers if i not in ["", None]]

        # Validation
        validator = lambda v: valid.FQDNOrIPAddress()
        map(validator, servers)

        # Mangling to match the conf file
        return {"OVIRT_NTP": ",".join(servers) or None
                }
Example #6
0
    def validators(self):
        ip_or_empty = valid.IPAddress() | valid.Empty()
        fqdn_ip_or_empty = valid.FQDNOrIPAddress() | valid.Empty()

        return {
            "hostname": fqdn_ip_or_empty,
            "dns[0]": ip_or_empty,
            "dns[1]": ip_or_empty,
            "ntp[0]": fqdn_ip_or_empty,
            "ntp[1]": fqdn_ip_or_empty,
            "dialog.nic.ipv4.address": valid.IPv4Address() | valid.Empty(),
            "dialog.nic.ipv4.netmask": valid.IPv4Address() | valid.Empty(),
            "dialog.nic.ipv4.gateway": valid.IPv4Address() | valid.Empty(),
            "dialog.nic.vlanid":
            (valid.Number(bounds=[0, 4096]) | valid.Empty()),
        }
Example #7
0
 def validators(self):
     return {
         "rhn.user":
         valid.Text(),
         "rhn.profilename":
         valid.Empty() | valid.Text(min_length=3),
         "rhn.url":
         valid.Empty() | valid.URL(),
         "rhn.ca":
         valid.Empty() | valid.URL(),
         "rhn.proxyhost":
         (valid.FQDNOrIPAddress() | valid.URL() | valid.Empty()),
         "rhn.proxyport":
         valid.Port() | valid.Empty(),
         "rhn.proxyuser":
         valid.Text() | valid.Empty(),
     }
Example #8
0
 def validators(self):
     return {
         "rhn.username":
         valid.Ascii(),
         "rhn.profilename":
         valid.Ascii() | valid.Empty(),
         "rhn.url":
         valid.Empty() | valid.URL(),
         "rhn.ca":
         valid.Empty() | valid.URL(),
         "rhn.proxyhost":
         (valid.FQDNOrIPAddress() | valid.URL() | valid.Empty()),
         "rhn.proxyport":
         valid.Port() | valid.Empty(),
         "rhn.proxyuser":
         valid.Text() | valid.Empty(),
         "rhn.org":
         valid.Text() | valid.Empty(),
         "rhn.environment":
         valid.Text() | valid.Empty(),
         "rhn.activation_key":
         valid.Text() | valid.Empty(),
     }
Example #9
0
 def validators(self):
     return {
         "collectd.address": valid.Empty() | valid.FQDNOrIPAddress(),
         "collectd.port": valid.Port(),
     }
Example #10
0
 def update(self, server, port):
     valid.FQDNOrIPAddress()(server)
     valid.Port()(port)
Example #11
0
 def update(self, name, target_name, target_host, target_port):
     # FIXME add more validation
     valid.IQN()(name)
     (valid.Empty(or_none=True) | valid.IQN())(target_name)
     (valid.Empty(or_none=True) | valid.FQDNOrIPAddress())(target_host)
     (valid.Empty(or_none=True) | valid.Port())(target_port)
Example #12
0
 def update(self, nfs, ssh, local):
     (valid.Empty(or_none=True) | valid.FQDNOrIPAddress())(nfs)
     (valid.Empty(or_none=True) | valid.URL())(ssh)
     (valid.Empty(or_none=True) | valid.Boolean())(local)
     return {"OVIRT_KDUMP_LOCAL": "true" if local else None
             }
Example #13
0
 def update(self, hostname):
     (valid.Empty() | valid.FQDNOrIPAddress())(hostname)
Example #14
0
 def update(self, enabled, server, certname):
     valid.Boolean()(enabled)
     (valid.Empty() | valid.FQDNOrIPAddress())(server)
     (valid.Empty() | valid.Text())(certname)
     return {"OVIRT_PUPPET_ENABLED": "yes" if enabled else None}
Example #15
0
 def validators(self):
     return {
         "puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
     }
Example #16
0
 def update(self, servers):
     assert type(servers) is list
     servers = filter(lambda i: i.strip() not in ["", None], servers)
     map(valid.FQDNOrIPAddress(), servers)
     return {"OVIRT_NTP": ",".join(servers) or None}
Example #17
0
 def update(self, ip, hostname):
     if ip:
         (valid.Empty() | valid.FQDNOrIPAddress())(ip)
Example #18
0
 def update(self, server, port, cert_path):
     (valid.Empty() | valid.FQDNOrIPAddress())(server)
     (valid.Empty() | valid.Port())(port)
Example #19
0
 def validators(self):
     return {
         "puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
         "puppet.certname": valid.Text() | valid.Empty()
     }
Example #20
0
 def validators(self):
     fqdn_ip_or_empty = valid.FQDNOrIPAddress() | valid.Empty()
     return {
         "collectd.ip": valid.Empty() | valid.FQDNOrIPAddress(),
         "collectd.hostname": fqdn_ip_or_empty,
     }