Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovery settings in elasticsearch.yml.erb #9

Closed
ryan-roemer opened this issue Mar 10, 2012 · 4 comments
Closed

Discovery settings in elasticsearch.yml.erb #9

ryan-roemer opened this issue Mar 10, 2012 · 4 comments

Comments

@ryan-roemer
Copy link

Hi Karel,

Very minor issue, but I hit this in elasticsearch.yml.erb at this section:

<% if node.elasticsearch[:discovery][:type] %>
discovery:
  type: <%= node.elasticsearch[:discovery][:type] %>
<% end %>
<% unless node.elasticsearch[:cloud][:ec2].values.compact.empty? %>
  ec2.groups: <%= node.elasticsearch[:cloud][:ec2][:security_group] %>
<% end %>

I actually have aws settings (and thus node.elasticsearch[:cloud][:ec2]), but I have not yet enabled discovery, which lead to an incorrect YAML directive. I think:

<% if node.elasticsearch[:discovery][:type] %>
discovery:
  type: <%= node.elasticsearch[:discovery][:type] %>
  <% unless node.elasticsearch[:cloud][:ec2].values.compact.empty? %>
  ec2.groups: <%= node.elasticsearch[:cloud][:ec2][:security_group] %>
  <% end %>
<% end %>

might be more appropriate.

@karmi
Copy link
Contributor

karmi commented Mar 10, 2012

Ryan, could you post a (sanitized) data_bags/elasticsearch/aws.json so I understand the issue better?

@ryan-roemer
Copy link
Author

Here's an analogue to my data bag (I actually tweaked the attributes to use an encrypted databag):

{
  "id": "elasticsearch",
  "cloud": {
    "ec2": {
      "security_group": "SOMETHING"
    },
    "aws": {
      "secret_key": "SECRET",
      "access_key": "ACCESS"
    }
  }
}

As I do have an ES security group, but am not yet running an ES cluster. This produces a YAML config of:

  ec2.groups: SOMETHING

(without a 0-level indent member discovery) instead of:

discovery:
  type: SOMETHING
  ec2.groups: SOMETHING

which causes a YAML config error.

So, I think it's fair to say you just must have discovery set if you set ec2.groups, but it could be more permissive in case someone sets the cloud.ec2 and not discovery. Totally up to you, and once again -- thanks for the great cookbook and responsiveness to issues!

@karmi karmi closed this as completed in f1fc6ef Mar 11, 2012
@karmi
Copy link
Contributor

karmi commented Mar 11, 2012

Hello Ryan,

see f1fc6ef, I think it's fair to use full namespaces in the YAML file, which makes everything more resilient, and the readability does not suffer too much :)

@ryan-roemer
Copy link
Author

The full namespaces work well, and don't get in to tortured "if-this-then-that-but-not..." template conditionals. Great idea. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants