瀏覽代碼

iprange -> ip_range

Signed-off-by: Joffrey F <[email protected]>
Joffrey F 7 年之前
父節點
當前提交
064471e640

+ 1 - 1
compose/config/config_schema_v2.0.json

@@ -311,7 +311,7 @@
       "type": "object",
       "properties": {
         "subnet": {"type": "string"},
-        "iprange": {"type": "string"},
+        "ip_range": {"type": "string"},
         "gateway": {"type": "string"},
         "aux_addresses": {
           "type": "object",

+ 1 - 1
compose/config/config_schema_v2.1.json

@@ -365,7 +365,7 @@
       "type": "object",
       "properties": {
         "subnet": {"type": "string"},
-        "iprange": {"type": "string"},
+        "ip_range": {"type": "string"},
         "gateway": {"type": "string"},
         "aux_addresses": {
           "type": "object",

+ 1 - 1
compose/config/config_schema_v2.2.json

@@ -374,7 +374,7 @@
       "type": "object",
       "properties": {
         "subnet": {"type": "string"},
-        "iprange": {"type": "string"},
+        "ip_range": {"type": "string"},
         "gateway": {"type": "string"},
         "aux_addresses": {
           "type": "object",

+ 1 - 1
compose/config/config_schema_v2.3.json

@@ -418,7 +418,7 @@
       "type": "object",
       "properties": {
         "subnet": {"type": "string"},
-        "iprange": {"type": "string"},
+        "ip_range": {"type": "string"},
         "gateway": {"type": "string"},
         "aux_addresses": {
           "type": "object",

+ 1 - 1
compose/config/config_schema_v2.4.json

@@ -417,7 +417,7 @@
       "type": "object",
       "properties": {
         "subnet": {"type": "string"},
-        "iprange": {"type": "string"},
+        "ip_range": {"type": "string"},
         "gateway": {"type": "string"},
         "aux_addresses": {
           "type": "object",

+ 32 - 0
tests/unit/config/config_test.py

@@ -1344,6 +1344,38 @@ class ConfigTest(unittest.TestCase):
         assert ('networks.foo.ipam.config contains an invalid type,'
                 ' it should be an object') in excinfo.exconly()
 
+    def test_config_valid_ipam_config(self):
+        ipam_config = {
+            'subnet': '172.28.0.0/16',
+            'ip_range': '172.28.5.0/24',
+            'gateway': '172.28.5.254',
+            'aux_addresses': {
+                'host1': '172.28.1.5',
+                'host2': '172.28.1.6',
+                'host3': '172.28.1.7',
+            },
+        }
+        networks = config.load(
+            build_config_details(
+                {
+                    'version': str(V2_1),
+                    'networks': {
+                        'foo': {
+                            'driver': 'default',
+                            'ipam': {
+                                'driver': 'default',
+                                'config': [ipam_config],
+                            }
+                        }
+                    }
+                },
+                filename='filename.yml',
+            )
+        ).networks
+
+        assert 'foo' in networks
+        assert networks['foo']['ipam']['config'] == [ipam_config]
+
     def test_config_valid_service_names(self):
         for valid_name in ['_', '-', '.__.', '_what-up.', 'what_.up----', 'whatup']:
             services = config.load(