"port": int( os.environ['MESOS_{}_PORT'.format( os.environ['MESOS_NODE_TYPE'].upper() )] ),
            "address": os.environ['IPV4_PRIVATE']
        } }
        
        consul_service_zk = { "service": {
            "id": service_name_master_zk,
            "name": service_name_master_zk,
            "port": 0,
            "address": "zk://{}{}".format( zk_str, os.environ['MESOS_ZK_PATH'] )
        } }

        Utils.write_json(consul_service, consul_service_path)
        Utils.write_json(consul_service_zk, consul_service_zk_path)
        LOG.info( 'Consul service written to: {}'.format( consul_service_path ) )
        LOG.info( 'Consul Mesos master zookeeper service written to: {}'.format( consul_service_zk_path ) )
        Utils.reload_consul(LOG)

        ##
        ## DONE:
        ##

        LOG.info( 'Yay - DONE \o/.' )
    else:
        LOG.error( 'No config to write.' )
        exit(102)
        
else:
    LOG.warn( 'Not enough {} services: {} vs expected {}.'.format(
                             service_name_zk,
                             len(parsed_input),
                             os.environ['EXPECTED_CONSENSUS_SERVERS'] ) )