// configuration from the configuration of the network that's
// already running. If the resulting configuration is a no-component
// network then that indicates that the entire network is being undeployed.
// Otherwise, we simply update the existing configuration and allow the
// network's manager to handle deployment and undeployment of components.
NetworkConfig updatedConfig = Configs.unmergeNetworks(tempContext.config(), network);
final NetworkContext context = ContextBuilder.buildContext(updatedConfig, cluster);
// If the new configuration has no components then undeploy the entire network.
if (context.components().isEmpty()) {
// We need to watch the network's status key to determine when the network's