And Petraeus is more equal than others. Had an unknown officer who doesn't have stars (or an enlisted) done what Petraeus did, he/she would be thrown in prison and the key destroyed.
Obviously, there is a hierarchy of equalness.
His clear violation of law was the transfer of documents. Even that, though, assumes there were not traditions of CIA directors carrying around secure documents. At one level, just about everything they touched would become classified. Allowing his mistress to have access to them was different.
However, he was not in the military at the time, so what any military member would have done is irrelevant. He was the director of the CIA...a civilian position. He retired from the Army on Aug 11, 2011 and took the CIA job on Sep 6, 2011. The Army regs did not apply to him after he retired.