Sentinel: call sentinelFlushConfig() to persist state when needed.

Also the sentinel configuration rewriting was modified in order to
account for failover in progress, where we need to provide the promoted
slave address as master address, and the old master address as one of
the slaves address.
Sentinel: rewriteConfigSentinelOption() sub-iterators var typo fixed.
Sentinel: arity of known-sentinel/slave is 4 not 3.
Sentinel: when writing config on disk, remember sentinels runid.
Sentinel: no longer used defines removed.
Sentinel: failover script execution fixed.
Sentinel: various fixes to leader election implementation.
Sentinel: distinguish between is-master-down-by-addr requests.

Some are just to know if the master is down, and in this case the runid
in the request is set to "*", others are actually in order to seek for a
vote and get elected. In the latter case the runid is set to the runid
of the instance seeking for the vote.
CONFIG REWRITE: don't add the signature if it already exists.

At the end of the file, CONFIG REWRITE adds a comment line that:

    # Generated by CONFIG REWRITE

Followed by the additional config options required. However this was
added again and again at every rewrite in praticular conditions (when a
given set of options change in a given time during the time).

Now if it was alrady encountered, it is not added a second time.

This is especially important for Sentinel that rewrites the config at
every state change.