def validate_cli(ami_id, environment, deployment, play): """ Method to validate that an AMI was built for a particular EDP. """ ami_id = ami_id.strip() try: edp_matched = validate_edp(ami_id, environment, deployment, play) except Exception as err: # pylint: disable=broad-except traceback.print_exc() click.secho("Error validating AMI: {0}.\nMessage: {1}".format(ami_id, err.message), fg="red") sys.exit(1) sys.exit(0 if edp_matched else 1)
def validate_cli(ami_id, environment, deployment, play): """ Method to validate that an AMI was built for a particular EDP. """ ami_id = ami_id.strip() try: edp_matched = validate_edp(ami_id, environment, deployment, play) except Exception as err: # pylint: disable=broad-except traceback.print_exc() click.secho("Error validating AMI: {0}.\nMessage: {1}".format( ami_id, err), fg='red') sys.exit(1) sys.exit(0 if edp_matched else 1)
def test_ami_edp_validate_ami_id(self, expected_ret, edp): fake_ami_id = self._make_fake_ami() self.assertEqual(ec2.validate_edp(fake_ami_id, *edp), expected_ret)