/*
 * Licensed to Elastic Search and Shay Banon under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. Elastic Search licenses this
 * file to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.elasticsearch.discovery.cloud;

import org.elasticsearch.cloud.compute.CloudComputeService;
import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.discovery.zen.ZenDiscovery;
import org.elasticsearch.discovery.zen.ping.ZenPingService;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.TransportService;
import org.elasticsearch.util.collect.ImmutableList;
import org.elasticsearch.util.guice.inject.Inject;
import org.elasticsearch.util.settings.Settings;

/**
 * @author kimchy (shay.banon)
 */
public class CloudDiscovery extends ZenDiscovery {

    @Inject public CloudDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService,
                                  ClusterService clusterService, ZenPingService pingService, CloudComputeService computeService) {
        super(settings, clusterName, threadPool, transportService, clusterService, pingService);
        if (settings.getAsBoolean("cloud.enabled", true)) {
            pingService.zenPings(ImmutableList.of(new CloudZenPing(settings, threadPool, transportService, clusterName, computeService)));
        }
    }
}

@@ -1900,46 +1900,33 @@
     
-pingService.zenPings(ImmutableList.of(
+CloudZenPing cloudPing = 
 new 
@@ -2006,16 +2006,123 @@
 Service)
+;%0A            cloudPing.setNodesProvider(this);%0A            pingService.zenPings(ImmutableList.of(cloudPing
 ));%0A    

fix NPE since we need to provide the nodes provider