Congressional Quarterly via Getty Images Sen. John McCain (R-Ariz.) is letting Eric Fanning get a confirmation hearing for his nomination as Army secretary. It only took four months!

WASHINGTON -- Sen. John McCain (R-Ariz.) finally set a confirmation hearing for Eric Fanning, who President Barack Obama nominated months ago to be the secretary of the Army.

Fanning will appear before the Senate Armed Services Committee, which McCain chairs, on Thursday. If confirmed by the full Senate, he will make history as the first openly gay person to fill the post.

Fanning has served in a number of senior positions at the Defense Department, and he had been filling in as acting Army secretary since he was nominated in September. But last week, the Pentagon announced Fanning was pulling out of that role and taking a different position until his Senate confirmation. It was all rather mysterious, until McCain indicated he and others on the committee had concerns Fanning would be violating federal law if he kept serving as acting secretary while waiting for his confirmation vote.

"You don't put people in jobs until they are confirmed by the Senate. That’s pretty straightforward," McCain said last week.

Since he relinquished his role as acting secretary, Fanning is now cleared for a hearing, committee spokesman Dustin Walker told HuffPost on Monday.

"A number of SASC members had concerns about Mr. Fanning's nomination related to the Federal Vacancies Reform Act," said Walker. "That issue has now been addressed and a hearing has been scheduled to consider Mr. Fanning's nomination."

Former Rep. Patrick Murphy (D-Pa.) was confirmed earlier this month as acting undersecretary, the Army's second-highest post. He is temporarily filling in as acting Army secretary until Fanning gets confirmed.

PHOTO GALLERY Scenes From 114th Congress And Capitol Hill