I'm sure the Obama White House did not require much persuasion to leak word of the President's role in approving the successful anti-pirate operation off the coast of Somalia, but I'm going to guess they won't be so quick to take credit the first time some military operation goes bad. As the administration will soon learn, the president is largely a prisoner of circumstance when it comes to external events like this. The flip side of taking credit for good news is that you're more likely to be held responsible for bad news.
(To be fair, it makes sense to take credit for positive news given the way voters tend to judge incumbents. The evidence suggests that the president will be blamed by voters for negative events that happen during their time in office so they might as well take credit for the good stuff.)