@@ -381,11 +381,13 @@ def get_change_set_status(client, change_set_name, settings):
381381 return status
382382
383383
384- def plan (settings , root_stack ):
384+ def plan (settings , root_stack , apply = None , cleanup = None ):
385385 """
386386 Function to create a recursive change-set and return diffs
387387 :param ComposeXSettings settings:
388388 :param ComposeXStack root_stack:
389+ :param apply: Optional[bool] - Whether to apply the change-set (True/False). Default is None (prompt user).
390+ :param cleanup: Optional[bool] - Whether to clean up the change-set (True/False). Default is None (prompt user).
389391 :return:
390392 """
391393 validate_stack_availability (settings , root_stack )
@@ -408,14 +410,20 @@ def plan(settings, root_stack):
408410 )
409411 status = get_change_set_status (client , change_set_name , settings )
410412 if status :
411- apply_q = input ("Want to apply? [yN]: " )
412- if apply_q in ["y" , "Y" , "YES" , "Yes" , "yes" ]:
413+ if apply is None :
414+ apply_q = input ("Want to apply? [yN]: " )
415+ apply = apply_q .lower () in ["y" , "yes" ]
416+
417+ if apply :
413418 client .execute_change_set (
414419 ChangeSetName = change_set_name ,
415420 StackName = settings .name ,
416421 DisableRollback = settings .disable_rollback ,
417422 )
418423 else :
419- delete_q = input ("Cleanup ChangeSet ? [yN]: " )
420- if delete_q in ["y" , "Y" , "YES" , "Yes" , "yes" ]:
424+ if cleanup is None :
425+ delete_q = input ("Cleanup ChangeSet ? [yN]: " )
426+ cleanup = delete_q .lower () in ["y" , "yes" ]
427+
428+ if cleanup :
421429 client .delete_stack (StackName = settings .name )
0 commit comments