How to disable Filesystem/URL Snapshots in 2.x

I want to disable FS and URL snapshots in Elasticsearch 2.x. Essentially do not want users of the cluster messing around with the filesystem. Users are allowed to configure S3 repositories only.

I achieved this in 1.x by having a plugin do the following

repositoriesModule.registerRepository(FsRepository.TYPE, AbstractModule.class)

But 2.x seems to disallow registering same module twice and throws the following error

[2016-03-17 14:40:43,195][ERROR][bootstrap ] Exception ElasticsearchException[failed to invoke onModule]; nested: InvocationTargetException; nested: IllegalArgumentException[Can't register the same [repository] more than once for [url]]; at org.elasticsearch.plugins.PluginsService.processModule(PluginsService.java:232) at org.elasticsearch.plugins.PluginsService.processModules(PluginsService.java:217) at org.elasticsearch.node.Node.(Node.java:198) at org.elasticsearch.node.Node.(Node.java:128) at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:145) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.elasticsearch.plugins.PluginsService.processModule(PluginsService.java:229) ... 7 more Caused by: java.lang.IllegalArgumentException: Can't register the same [repository] more than once for [url] at org.elasticsearch.common.util.ExtensionPoint$ClassMap.registerExtension(ExtensionPoint.java:104) at org.elasticsearch.repositories.RepositoryTypesRegistry.registerRepository(RepositoryTypesRegistry.java:39) at org.elasticsearch.repositories.RepositoriesModule.registerRepository(RepositoriesModule.java:48) at org.elasticsearch.plugin.cloud.aws.CloudAwsPlugin.onModule(CloudAwsPlugin.java:113) ... 12 more

I think that's an interesting use case and I'd probably open an issue about this: add a setting to disable fs repo on startup. Or add such a fine grained support in Shield. I don't think Shield supports that today.

@Igor_Motov WDYT?

Thanks! I have filed https://github.com/elastic/elasticsearch/issues/17181

In general, I liked the ability in 1.x to be able to override default implementations with custom plugins but I cant find a way to do something similar with 2.x