Just 'don't' say no!
Back when Kirstjen Nielsen was appointed Department of Homeland Security secretary, a former senior member of DHS from the previous administration did not expect her to last out the summer. And, yet — here is this short article, Don’t Call It A Comeback: How Kirstjen Nielsen Clawed Back From The Brink.
Which gets to "how to keep the boss happy." The article explains that she has found a way to not "say no" and instead give options to President Trump that he can find one that is acceptable. In actuality, it is not a bad strategy for anyone serving a mercurial boss. These are the situations that people think about when offered a political appointment — they fear being swept up into decision making not based on reason.
Even with an ethical boss, I call the skill of managing upward, "putting the bell on the cat." You never know where the "cat" (boss) is going, but you need to keep track of where she or he is at all times on issues.
Claire Rubin, Senior Researcher — exemplar, shared the above link.