{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/14081","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14081/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14081/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14081/events","html_url":"https://github.com/elastic/elasticsearch/issues/14081","id":111144091,"number":14081,"title":"Document details about config file name suffix impact on parser used","user":{"login":"robin13","id":174291,"avatar_url":"https://avatars.githubusercontent.com/u/174291?v=3","gravatar_id":"","url":"https://api.github.com/users/robin13","html_url":"https://github.com/robin13","followers_url":"https://api.github.com/users/robin13/followers","following_url":"https://api.github.com/users/robin13/following{/other_user}","gists_url":"https://api.github.com/users/robin13/gists{/gist_id}","starred_url":"https://api.github.com/users/robin13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robin13/subscriptions","organizations_url":"https://api.github.com/users/robin13/orgs","repos_url":"https://api.github.com/users/robin13/repos","events_url":"https://api.github.com/users/robin13/events{/privacy}","received_events_url":"https://api.github.com/users/robin13/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/doc","name":"doc","color":"b3694f"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-13T09:40:14Z","updated_at":"2015-10-13T11:09:40Z","closed_at":null,"body":"Config files can be defined in YAML or JSON format.  In most cases the examples are in yaml, but it seems that in some cases a file without a suffix can be interpreted as JSON (even if it is YAML) which will fail.\r\n\r\n> @spinscale \r\n> _Elasticsearch has the notion of a XContent construct, which can either be YAML, JSON, SMILE or CBOR and is usually detected by its first characters_\r\n\r\nIn specific example, a file was created `shield/user_roles` (note: no `.yml` suffix!) which resulted in this error:\r\n\r\n```\r\n[2015-10-11 11:54:23,475][ERROR][shield.authc.support ] [node1] failed to parse role mappings file [/etc/elasticsearch/shield/role_mapping]. skipping/removing all mappings... \r\norg.elasticsearch.common.settings.SettingsException: Failed to load settings from [/etc/elasticsearch/shield/role_mapping] \r\nat org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:985) \r\nat org.elasticsearch.shield.authc.support.DnRoleMapper.parseFile(DnRoleMapper.java:118) \r\nat org.elasticsearch.shield.authc.support.DnRoleMapper.parseFileLenient(DnRoleMapper.java:102) \r\nat org.elasticsearch.shield.authc.support.DnRoleMapper.<init>(DnRoleMapper.java:73) \r\nat org.elasticsearch.shield.authc.ldap.LdapRealm$Factory.create(LdapRealm.java:63) \r\nat org.elasticsearch.shield.authc.ldap.LdapRealm$Factory.create(LdapRealm.java:43) \r\nat org.elasticsearch.shield.authc.Realms.initRealms(Realms.java:114) \r\nat org.elasticsearch.shield.authc.Realms.doStart(Realms.java:56) \r\nat org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:85) \r\nat org.elasticsearch.node.internal.InternalNode.start(InternalNode.java:238) \r\nat org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:128) \r\nat org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:216) \r\nat org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32) \r\nCaused by: org.elasticsearch.common.jackson.core.JsonParseException: Unrecognized token 'admin': was expecting ('true', 'false' or 'null') \r\nat [Source: admin: \r\n- \"cn=ABC123,ou=Users,dc=corporate\" \r\n; line: 1, column: 6] \r\nat org.elasticsearch.common.jackson.core.JsonParser._constructError(JsonParser.java:1419) \r\nat org.elasticsearch.common.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508) \r\nat org.elasticsearch.common.jackson.core.json.ReaderBasedJsonParser._reportInvalidToken(ReaderBasedJsonParser.java:2300) \r\nat org.elasticsearch.common.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:1459) \r\nat org.elasticsearch.common.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:683) \r\nat org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken(JsonXContentParser.java:51) \r\nat org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:60) \r\nat org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:45) \r\nat org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:982) \r\n... 12 more \r\n```\r\n\r\nSuggest more explicit documentation around config file type options and the rules governing how the format is guessed if not obvious by file suffix."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/147684749","html_url":"https://github.com/elastic/elasticsearch/issues/14081#issuecomment-147684749","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/14081","id":147684749,"user":{"login":"spinscale","id":667544,"avatar_url":"https://avatars.githubusercontent.com/u/667544?v=3","gravatar_id":"","url":"https://api.github.com/users/spinscale","html_url":"https://github.com/spinscale","followers_url":"https://api.github.com/users/spinscale/followers","following_url":"https://api.github.com/users/spinscale/following{/other_user}","gists_url":"https://api.github.com/users/spinscale/gists{/gist_id}","starred_url":"https://api.github.com/users/spinscale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spinscale/subscriptions","organizations_url":"https://api.github.com/users/spinscale/orgs","repos_url":"https://api.github.com/users/spinscale/repos","events_url":"https://api.github.com/users/spinscale/events{/privacy}","received_events_url":"https://api.github.com/users/spinscale/received_events","type":"User","site_admin":false},"created_at":"2015-10-13T11:09:40Z","updated_at":"2015-10-13T11:09:40Z","body":"the config file you are referring to is not an ordinary config file, but one that is not `xContent` compatible, as it basically looks like `/etc/group`. The config file in the exception is another shield file, that indeed is load by `xContent` mechanisms\r\n\r\nChecking the exception this is indeed a problem due to `SettingsLoaderFactory.loadFromResource()`, which is checking for the file suffixes and falls back to JSON, see https://github.com/elastic/elasticsearch/blob/master/core/src/main/java/org/elasticsearch/common/settings/loader/SettingsLoaderFactory.java#L37-L48"}}