File tree Expand file tree Collapse file tree
tests/unit/network/v2/vpnaas Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,13 +85,15 @@ def take_action(
8585 self , parsed_args : argparse .Namespace
8686 ) -> tuple [Sequence [str ], Iterable [Any ]]:
8787 client = self .app .client_manager .network
88- attrs = {}
88+ attrs : dict [ str , Any ] = {}
8989 if parsed_args .project is not None :
90- attrs ['project_id' ] = identity_common .find_project (
91- self .app .client_manager .identity ,
90+ identity_client = self .app .client_manager .sdk_connection .identity
91+ project_id = identity_common .find_project_id_sdk (
92+ identity_client ,
9293 parsed_args .project ,
9394 parsed_args .project_domain ,
94- ).id
95+ )
96+ attrs ['project_id' ] = project_id
9597 if parsed_args .description :
9698 attrs ['description' ] = parsed_args .description
9799
Original file line number Diff line number Diff line change @@ -207,12 +207,14 @@ def take_action(
207207 ) -> tuple [Sequence [str ], Iterable [Any ]]:
208208 client = self .app .client_manager .network
209209 attrs = _get_common_attrs (parsed_args )
210- if 'project' in parsed_args and parsed_args .project is not None :
211- attrs ['project_id' ] = identity_common .find_project (
212- self .app .client_manager .identity ,
210+ if parsed_args .project is not None :
211+ identity_client = self .app .client_manager .sdk_connection .identity
212+ project_id = identity_common .find_project_id_sdk (
213+ identity_client ,
213214 parsed_args .project ,
214215 parsed_args .project_domain ,
215- ).id
216+ )
217+ attrs ['project_id' ] = project_id
216218 if parsed_args .name :
217219 attrs ['name' ] = str (parsed_args .name )
218220 obj = client .create_vpn_ike_policy (** attrs )
Original file line number Diff line number Diff line change @@ -246,12 +246,14 @@ def take_action(
246246 ) -> tuple [Sequence [str ], Iterable [Any ]]:
247247 client = self .app .client_manager .network
248248 attrs = _get_common_attrs (client , parsed_args )
249- if 'project' in parsed_args and parsed_args .project is not None :
250- attrs ['project_id' ] = identity_common .find_project (
251- self .app .client_manager .identity ,
249+ if parsed_args .project is not None :
250+ identity_client = self .app .client_manager .sdk_connection .identity
251+ project_id = identity_common .find_project_id_sdk (
252+ identity_client ,
252253 parsed_args .project ,
253254 parsed_args .project_domain ,
254- ).id
255+ )
256+ attrs ['project_id' ] = project_id
255257 if parsed_args .vpnservice :
256258 _vpnservice_id = client .find_vpn_service (
257259 parsed_args .vpnservice , ignore_missing = False
Original file line number Diff line number Diff line change @@ -200,12 +200,14 @@ def take_action(
200200 ) -> tuple [Sequence [str ], Iterable [Any ]]:
201201 client = self .app .client_manager .network
202202 attrs = _get_common_attrs (parsed_args )
203- if 'project' in parsed_args and parsed_args .project is not None :
204- attrs ['project_id' ] = identity_common .find_project (
205- self .app .client_manager .identity ,
203+ if parsed_args .project is not None :
204+ identity_client = self .app .client_manager .sdk_connection .identity
205+ project_id = identity_common .find_project_id_sdk (
206+ identity_client ,
206207 parsed_args .project ,
207208 parsed_args .project_domain ,
208- ).id
209+ )
210+ attrs ['project_id' ] = project_id
209211 if parsed_args .name :
210212 attrs ['name' ] = str (parsed_args .name )
211213 obj = client .create_vpn_ipsec_policy (** attrs )
Original file line number Diff line number Diff line change @@ -131,12 +131,14 @@ def take_action(
131131 ) -> tuple [Sequence [str ], Iterable [Any ]]:
132132 client = self .app .client_manager .network
133133 attrs = _get_common_attrs (client , parsed_args )
134- if 'project' in parsed_args and parsed_args .project is not None :
135- attrs ['project_id' ] = identity_common .find_project (
136- self .app .client_manager .identity ,
134+ if parsed_args .project is not None :
135+ identity_client = self .app .client_manager .sdk_connection .identity
136+ project_id = identity_common .find_project_id_sdk (
137+ identity_client ,
137138 parsed_args .project ,
138139 parsed_args .project_domain ,
139- ).id
140+ )
141+ attrs ['project_id' ] = project_id
140142 if parsed_args .name :
141143 attrs ['name' ] = str (parsed_args .name )
142144 if parsed_args .router :
You can’t perform that action at this time.
0 commit comments