Final answer:
The policy that barred homosexuals from openly serving in the U.S. military and led to discharge if they were discovered was known as 'Don't Ask, Don't Tell' (DADT), enacted in 1993 and repealed in 2011.
Step-by-step explanation:
The policy you are referring to is Don't Ask, Don't Tell (DADT). This policy was a compromise measure enacted in December of 1993 by President Bill Clinton. Under DADT, service members were not to be asked about their sexual orientation and homosexuals could serve in the military as long as their sexual orientation was not disclosed. However, any servicemember who revealed themselves to be homosexual would be subject to discharge. This policy was in force until it was deemed unconstitutional, leading to its repeal in 2010 and the subsequent end of its enforcement by a federal court in July 2011. Since then, homosexuals may serve openly in the U.S. military.