What a difference three years can make. When White House aides were leaking juicy details of the raid that killed Osama bin Laden in 2011, then Secretary of Defense Robert Gates famously exploded. “Shut the f— up,” he demanded.

That same White House team is no doubt wishing Gates had taken his own advice before publishing Duty: Memoirs of a Secretary at War. That account of his Pentagon tenure, including an unvarnished look at the way he felt the Obama Administration dissed the U.S. military, is due out next week, although much of its content has already…leaked.

National security types are in a tizzy over the story line, orbiting around a detached Obama, a cabal of power-hungry White House aides, and a Vice President who kept warning the commander-in-chief that those in uniform couldn’t be trusted. Jane Average, along with GI Joe, may be scratching their heads and wondering: isn’t writing a book like this illegal for such a high link in the chain of command? Especially when the nation is at war? Perhaps a violation of the Uniform Code of Military Justice? Bad manners?

By all accounts, legal and otherwise, Gates is free to publish such a tell-all, assuming it has been scrubbed of any classified information. In other words, it passes the tell test, if not the smell test.

“It’s a question of political good taste,” says Eugene Fidell, a lecturer on military law at Yale University and former president of the National Institute of Military Justice. Gates, as a civilian, isn’t subject to the Uniform Code of Military Justice’s ban on a soldier’s “contemptuous words” toward the President, he says. “But I think he might have well waited a little longer.”

The volume also sends up a red flag about the wisdom of a new President reaching across the political aisle for help. That’s what Obama did when he asked Gates, a Republican selected by President George W. Bush to run the Pentagon in 2006, to stay on the job in the new Administration. “It does raise the question of what is the loyalty and discretion expected of a person of one party, who is permitted to hold high office by a President of the other party,” Fidell says. “To me, there is some difficulty there — I think there’s a kind of cheesiness to it.”

Current and former military officers say that although Gates did nothing wrong in publishing his book while the Obama Administration remains in office, most agree with Fidell that it probably would have been better if he had waited until there was a new occupant at 1600 Pennsylvania Ave. There are concerns that such reporting will make Presidents more guarded in their dealings with their Cabinet officers.

One retired four-star officer wishes Gates had voiced some of these concerns when he was still running the Defense Department. “On a personal basis, I wish this would have come out while he was in the job,” says Anthony Zinni, a retired Marine general who served as chief of U.S. Central Command. “If the White House was over-controlling, what did he do about it — other than carp about it, after the fact?”

But Zinni, echoing what some active-duty officers say, like that Gates has the guts to publicly state his thoughts, instead of leaking them, anonymously, to someone like author Bob Woodward. “Maybe it’s too soon, and it might have been more appropriate after the Administration left,” he says. “But overall, I think it’s healthy for the American people to see how the inner workings go, either positively or negatively.”

“He swore an oath to the Constitution—not to the President,” adds Barry McCaffrey, a retired Army general. “Believe this book adds to the public policy debate. Let his argument stand or fall on its own merits.”

“Of course, we’ll now hear no end of personal attacks on him, but I believe he viewed writing this book as a last, essential duty to his country,” Peters says. “ I have not always agreed with Gates, but never questioned his integrity or motives .”