The issue of this being a National Security Threat-
Almost immediately after the scandal broke, people began to say that Petraeus presented a risk to National security. Now obviously there is always a touch of Partisanship bias in a situation like this, but from a civilian standpoint, critics are essentially saying that by engaging in an inappropriate relationship with Broadwell that Petraeus essentially ran the risk of destroying "the brand"; and in this case the brand was the US Government.
While any employee who works for any company is entitled to their own personal life, there are some positions in which your personal life is an extension of your professional life. People want to see how you handle yourself outside of your 9-5. And they also want to make sure that people in your inner circle know how to handle themselves as well. The Officer's Wives clubs in the military have two purposes: essentially they provide services for military members and their families, but they also serve as a marketing tool for the military. The wives are a symbol of representation for their spouses, and many times superior officers look at the spouses as a sign of Officer conduct. Wives undergo informal "interviews" and investigations when their husband's are up for promotion in the higher ranks. A "proper" Officer's Wife is expected to be poised, educated, and supportive. They must also show the proper balance between being strong willed and knowing when to not rock the boat. A superior officer also wants to be sure that an Officer's Wife knows the unwritten code of the military, and would never share secrets of the organization. A wife must be able to be trusted with military secrets, and someone who is a 'Firecracker' or 'Line Crosser' is definitely a risk to the military. In the eyes of Petraeus' critics, Broadwell is definitely a 'Line Crosser'. Broadwell was never properly vetted, but Mrs. Petraeus was...no one was worried about Mrs. Petraeus spilling military secrets. But now that Petraeus has betrayed her trust, who is to say that she (or Broadwell for that matter) may not spill the tea in the spirit of revenge.
Many military professionals underestimate the power of marketing themselves during their time in service. Military personnel are some of the most highly trained professionals in the world, and receive educational opportunities that many civilians would never be able to receive. Being able to use that background as a springboard into a new career path is heaven sent. But the key to successfully transitioning into your next career is protecting your brand at all times, and being cautious and strategic with networking opportunities. The last thing you want to do is attach yourself to the wrong person. It is essentially career suicide when people are looking at you in terms of leadership and accountability. Learn to keep a low profile, and be careful about blurring the lines between business and professional.
In the event that you do in fact make a decision that is detrimental to your brand, there are ways to bounce back over time. Showing your passion and commitment to being an expert in your field are definitely advantageous. People want to know that you actually care about what you do, and are not simply in it for the perks or accolades; especially when it comes to trusting you with sensitive information. Gaining trust after a public mishap may take time, but if you remain diligent about proving your commitment to your long term goals, people will eventually return to looking at your professional accomplishments instead of your personal hiccups.
Keeping a low profile during your time of transition is also a good idea. The one good thing that General Petraeus has done in the wake of the storm is to keep his mouth shut. He has been virtually nonexistent; issuing a small plea for privacy at the onslaught of the situation, and then slowly returning back to his corner to repair his home life. You haven't seen him cruising to the grocery store, or doing any exclusive interviews. He has taken a humble approach to accepting his fate and mending fences with his family. In the event that the public does forgive Petraeus, it will be important for people to believe that he has a sense of remorse. Behind closed doors, he could actually care less, who knows? But what's important is that the public must be convinced that he does actually care about cleaning up his mistakes.