Browse Source

Merge "Now `name` is a positional argument in cluster creation"

tags/2.8.0
Zuul 1 year ago
parent
commit
b9f9e1c529

+ 1
- 1
magnumclient/osc/v1/cluster_templates.py View File

@@ -71,7 +71,7 @@ class CreateClusterTemplate(command.ShowOne):
71 71
         parser = super(CreateClusterTemplate, self).get_parser(prog_name)
72 72
 
73 73
         parser.add_argument(
74
-            '--name',
74
+            'name',
75 75
             metavar='<name>',
76 76
             help=_('Name of the cluster template to create.'))
77 77
         parser.add_argument(

+ 1
- 1
magnumclient/osc/v1/clusters.py View File

@@ -86,7 +86,7 @@ class CreateCluster(command.Command):
86 86
                             default=1,
87 87
                             metavar='<master-count>',
88 88
                             help='The number of master nodes for the cluster.')
89
-        parser.add_argument('--name',
89
+        parser.add_argument('name',
90 90
                             metavar='<name>',
91 91
                             help='Name of the cluster to create.')
92 92
         parser.add_argument('--node-count',

+ 3
- 5
magnumclient/tests/osc/unit/v1/test_cluster_templates.py View File

@@ -91,7 +91,7 @@ class TestClusterTemplateCreate(TestClusterTemplate):
91 91
             '--coe', self.new_ct.coe,
92 92
             '--external-network', self.new_ct.external_network_id,
93 93
             '--image', self.new_ct.image_id,
94
-            '--name', self.new_ct.name
94
+            self.new_ct.name
95 95
         ]
96 96
         verifylist = [
97 97
             ('coe', self.new_ct.coe),
@@ -109,13 +109,11 @@ class TestClusterTemplateCreate(TestClusterTemplate):
109 109
 
110 110
         arglist = [
111 111
             '--external-network', self.new_ct.external_network_id,
112
-            '--image', self.new_ct.image_id,
113
-            '--name', self.new_ct.name
112
+            '--image', self.new_ct.image_id
114 113
         ]
115 114
         verifylist = [
116 115
             ('external_network', self.new_ct.external_network_id),
117
-            ('image', self.new_ct.image_id),
118
-            ('name', self.new_ct.name)
116
+            ('image', self.new_ct.image_id)
119 117
         ]
120 118
         self.assertRaises(magnum_fakes.MagnumParseException,
121 119
                           self.check_parser, self.cmd, arglist, verifylist)

+ 6
- 4
magnumclient/tests/osc/unit/v1/test_clusters.py View File

@@ -46,7 +46,7 @@ class TestClusterCreate(TestCluster):
46 46
             'labels': {},
47 47
             'keypair': None,
48 48
             'master_count': 1,
49
-            'name': None,
49
+            'name': 'fake-cluster-1',
50 50
             'node_count': 1
51 51
         }
52 52
 
@@ -69,10 +69,12 @@ class TestClusterCreate(TestCluster):
69 69
         """Verifies required arguments."""
70 70
 
71 71
         arglist = [
72
-            '--cluster-template', self._cluster.cluster_template_id
72
+            '--cluster-template', self._cluster.cluster_template_id,
73
+            self._cluster.name
73 74
         ]
74 75
         verifylist = [
75
-            ('cluster_template', self._cluster.cluster_template_id)
76
+            ('cluster_template', self._cluster.cluster_template_id),
77
+            ('name', self._cluster.name)
76 78
         ]
77 79
         parsed_args = self.check_parser(self.cmd, arglist, verifylist)
78 80
         self.cmd.take_action(parsed_args)
@@ -82,7 +84,7 @@ class TestClusterCreate(TestCluster):
82 84
         """Verifies missing required arguments."""
83 85
 
84 86
         arglist = [
85
-            '--name', self._cluster.name
87
+            self._cluster.name
86 88
         ]
87 89
         verifylist = [
88 90
             ('name', self._cluster.name)

Loading…
Cancel
Save