Пример #1
0
 def update(self, pwauth, num_bytes, disable_aesni):
     valid.Boolean()(pwauth)
     (valid.Number() | valid.Empty(or_none=True))(num_bytes)
     (valid.Boolean() | valid.Empty(or_none=True))(disable_aesni)
     return {"OVIRT_SSH_PWAUTH": "yes" if pwauth else None,
             "OVIRT_DISABLE_AES_NI": "true" if disable_aesni else None
             }
Пример #2
0
 def update(self, bootproto, ipaddr, netmask, gateway):
     if bootproto not in ["auto", "static", "none", "dhcp", None]:
         raise exceptions.InvalidData("Unknown bootprotocol: %s" %
                                      bootproto)
     (valid.IPv6Address() | valid.Empty(or_none=True))(ipaddr)
     (valid.IPv6Address() | valid.Empty(or_none=True))(netmask)
     (valid.IPv6Address() | valid.Empty(or_none=True))(gateway)
Пример #3
0
 def validators(self):
     number_or_empty = valid.Number(bounds=[0, None]) | \
         valid.Empty()
     return {
         "strongrng.num_bytes": number_or_empty,
         "passwd.admin.password": valid.Empty() | valid.Text(min_length=5)
     }
Пример #4
0
    def update(self, mserver, mport, cert_path, fprint):
        if validate_server(mserver):
            mserver, mport = mserver.split(":")
        else:
            mport = config.ENGINE_PORT

        (valid.Empty(or_none=True) | valid.Text())(mserver)
        (valid.Empty(or_none=True) | valid.Port())(mport)
Пример #5
0
 def validators(self):
     """Validators validate the input on change and give UI feedback
     """
     # FIXME improve validation for ssh and nfs
     return {"kdump.type": valid.Options(dict(self._types).keys()),
             "kdump.ssh_location": valid.Empty() | valid.SSHAddress(),
             "kdump.nfs_location": valid.Empty() | valid.NFSAddress(),
             }
Пример #6
0
 def update(self, iface, bootproto, ipaddr=None, netmask=None, gateway=None,
            vlanid=None):
     if bootproto not in ["static", "none", "dhcp", None]:
         raise exceptions.InvalidData("Unknown bootprotocol: %s" %
                                      bootproto)
     (valid.IPv4Address() | valid.Empty(or_none=True))(ipaddr)
     (valid.IPv4Address() | valid.Empty(or_none=True))(netmask)
     (valid.IPv4Address() | valid.Empty(or_none=True))(gateway)
Пример #7
0
 def validators(self):
     number_or_empty = valid.Number(bounds=[0, None]) | \
         valid.Empty()
     return {"strongrng.num_bytes": number_or_empty,
             "passwd.admin.password":
             valid.Empty() | valid.Text(min_length=5),
             "ssh.port":
             (valid.Port(value=22) | valid.Port(exclude_reserved=True))
             }
Пример #8
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(),
             }
Пример #9
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)
                }
Пример #10
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(),
     }
Пример #11
0
    def validators(self):

        return {
            "vdsm_cfg.address": valid.Text() | valid.Empty(),
            "vdsm_cfg.port": valid.Port(),
            "vdsm_cfg.password": valid.Text(),
        }
 def update(self, imagepath, pxe, force_enable=None):
     if not isinstance(pxe, bool):
         pxe = True if pxe.lower() == 'true' else False
     (valid.Empty() | valid.Text())(imagepath)
     (valid.Boolean()(pxe))
     return {
         "OVIRT_HOSTED_ENGINE_IMAGE_PATH": imagepath,
         "OVIRT_HOSTED_ENGINE_PXE": "yes" if pxe else None,
         "OVIRT_HOSTED_ENGINE_FORCE_ENABLE": "yes" if force_enable else None
     }
Пример #13
0
 def strong_rng(self, num_bytes=None):
     if (valid.Empty() | valid.Number(bounds=[0, None])).\
        validate(num_bytes):
         self.__update_profile(num_bytes)
     elif num_bytes is None:
         pass
     else:
         self.logger.warning("Unknown value for RNG num bytes: " +
                             "%s" % num_bytes)
     return self.rng_status().rng_bytes
Пример #14
0
 def strong_rng(self, num_bytes=None):
     import ovirtnode.ovirtfunctions as ofunc
     rng, aes = ofunc.rng_status()
     if (valid.Empty() | valid.Number(bounds=[0, None])).\
        validate(num_bytes):
         self.__update_profile(num_bytes, aes)
     elif num_bytes is None:
         pass
     else:
         self.logger.warning("Unknown value for RNG num bytes: " +
                             "%s" % num_bytes)
     return ofunc.rng_status()[0]
Пример #15
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(),
     }
Пример #16
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()),
        }
Пример #17
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(),
     }
Пример #18
0
 def validators(self):
     return {
         "iscsi.initiator_name": valid.IQN(),
         "nfsv4.domain": (valid.Empty() | valid.FQDN()),
     }
Пример #19
0
 def validators(self):
     return {
         "collectd.address": valid.Empty() | valid.FQDNOrIPAddress(),
         "collectd.port": valid.Port(),
     }
Пример #20
0
 def update(self, server, port, cert_path):
     (valid.Empty() | valid.FQDNOrIPAddress())(server)
     (valid.Empty() | valid.Port())(port)
Пример #21
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)
Пример #22
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
             }
Пример #23
0
 def update(self, hostname):
     (valid.Empty() | valid.FQDNOrIPAddress())(hostname)
Пример #24
0
 def validators(self):
     return {
         "puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
     }
Пример #25
0
 def update(self, domain):
     (valid.Empty() | valid.FQDN())(domain)
     return {"OVIRT_NFSV4_DOMAIN": domain or None
             }
Пример #26
0
 def update(self, ip, hostname):
     if ip:
         (valid.Empty() | valid.FQDNOrIPAddress())(ip)
Пример #27
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}
Пример #28
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,
     }
Пример #29
0
 def validators(self):
     return {
         "puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
         "puppet.certname": valid.Text() | valid.Empty()
     }
 def validators(self):
     return {"hosted_engine.diskpath": valid.Empty() |
             valid.URL() | valid.FileURL()}