def ensure_container_agent_enabled(node, to_enable):
 d = is_container_agent_running(node)
 def change_if_needed(enabled):
  if (enabled != to_enable):
   return set_container_agent_enabled_on_node(node, to_enable)
 d.addCallback(change_if_needed)
 return d

def ensure_container_agent_enabled ( node , to_enable ) : d = is_container_agent_running ( node ) def change_if_needed ( enabled ) : if ( enabled != to_enable ) : return set_container_agent_enabled_on_node ( node , to_enable ) d . addCallback ( change_if_needed ) return d
ensure the container agent is enabled/disabled as specified .