File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def get_pod(pod_id: str):
8888
8989def create_pod (
9090 name : str ,
91- image_name : str ,
91+ image_name : Optional [ str ] = "" ,
9292 gpu_type_id : Optional [str ] = None ,
9393 cloud_type : str = "ALL" ,
9494 support_public_ip : bool = True ,
@@ -141,6 +141,10 @@ def create_pod(
141141 >>> pod_id = runpod.create_pod("test", "runpod/stack", instance_id="cpu3c-2-4")
142142 """
143143 # Input Validation
144+
145+ if not image_name and not template_id :
146+ raise ValueError ("Either image_name or template_id must be provided" )
147+
144148 if gpu_type_id is not None :
145149 get_gpu (gpu_type_id ) # Check if GPU exists, will raise ValueError if not.
146150 if cloud_type not in ["ALL" , "COMMUNITY" , "SECURE" ]:
Original file line number Diff line number Diff line change @@ -136,6 +136,18 @@ def test_create_pod(self):
136136 "cloud_type must be one of ALL, COMMUNITY or SECURE" ,
137137 )
138138
139+ with self .assertRaises (ValueError ) as context :
140+ pod = ctl_commands .create_pod (
141+ name = "POD_NAME" ,
142+ gpu_type_id = "NVIDIA A100 80GB PCIe" ,
143+ network_volume_id = "NETWORK_VOLUME_ID" ,
144+ )
145+
146+ self .assertEqual (
147+ str (context .exception ),
148+ "Either image_name or template_id must be provided" ,
149+ )
150+
139151 def test_stop_pod (self ):
140152 """
141153 Test stop_pod
You can’t perform that action at this time.
0 commit comments