"""CFNgin info action."""importloggingfromtypingimportAnyfrom..importexceptionsfrom.baseimportBaseActionLOGGER=logging.getLogger(__name__)
[docs]classAction(BaseAction):"""Get information on CloudFormation stacks. Displays the outputs for the set of CloudFormation stacks. """NAME="info"@propertydef_stack_action(self)->Any:"""Run against a step."""returnNone
[docs]defrun(self,*_args:Any,**_kwargs:Any)->None:"""Get information on CloudFormation stacks."""LOGGER.info("outputs for stacks: %s",self.context.get_fqn())ifnotself.context.stacks:LOGGER.warning("no stacks detected (error in config?)")forstackinself.context.stacks:provider=self.build_provider()try:provider_stack=provider.get_stack(stack.fqn)exceptexceptions.StackDoesNotExist:LOGGER.info("%s:stack does not exist",stack.fqn)continueLOGGER.info("%s:",stack.fqn)if"Outputs"inprovider_stack:foroutputinprovider_stack["Outputs"]:LOGGER.info("\t%s: %s",output.get("OutputKey"),output.get("OutputValue"))