コード例 #1
0
class Couplet(resources.ScannableResource):
    class Meta:
        identifier = AutoId()

    address = attributes.Hostname()
    password = attributes.Password(crypt)
    internal_id = attributes.String(user_read_only=True, optional=True)
コード例 #2
0
    def test_hostname(self):
        hostname = attributes.Hostname()
        for value in ('intel.com', '127.0.0.1', 'my-laptop'):
            hostname.validate(value)
        for value in ('intel.-com', 'my_laptop', 'x.' * 128, 'x' * 64):
            with self.assertRaises(ValueError):
                hostname.validate(value)

        self.assertEqual(hostname.cast('host.intel.com'), 'host.intel.com')
コード例 #3
0
    def test_hostname(self):
        hostname = attributes.Hostname()
        for value in ("whamcloud.com", "127.0.0.1", "my-laptop"):
            hostname.validate(value)
        for value in ("whamcloud.-com", "my_laptop", "x." * 128, "x" * 64):
            with self.assertRaises(ValueError):
                hostname.validate(value)

        self.assertEqual(hostname.cast("host.whamcloud.com"),
                         "host.whamcloud.com")
class Resource1(ScannableResource):
    class Meta:
        identifier = GlobalId("address1", "address2")

    address_1 = attributes.Hostname()
    address_2 = attributes.Hostname()
コード例 #5
0
class Couplet(resources.ScannableResource):
    class Meta:
        identifier = identifiers.GlobalId('address_1', 'address_2')

    address_1 = attributes.Hostname()
    address_2 = attributes.Hostname()