刀搜索环境和使用通配符的字段的角色

时间:2016-02-26 21:20:20

标签: solr chef knife

我正在改变一个属性:

default['splunk']['auth'] = "admin:changeme"

为:

default['splunk']['auth']['username'] = "admin"
default['splunk']['auth']['password'] = "changeme"

我希望确保我不会错过/忘记某些事情......

很容易确保我在烹饪书中没有错过任何内容:

nickh@BONHENRY:~/Repositories/chef$ ack-grep "\[.splunk.?\]\[.auth.?\]"
cookbooks/splunk_cookbook/attributes/default.rb
36:default['splunk']['auth']['username']          = "admin"
37:default['splunk']['auth']['password']          = "changeme"

cookbooks/splunk_cookbook/attributes/README.md
72:* `node['splunk']['auth']['username']` - The default admin username to use instead of splunks "admin"
73:* `node['splunk']['auth']['password']` - The default admin password to use instead of splunks "changeme"

cookbooks/splunk_cookbook/recipes/server.rb
219:  command "#{splunk_cmd} edit user admin -password #{node['splunk']['auth']['password']} -roles admin -auth admin:changeme && echo true > /opt/splunk_setup_passwd"
228:    command "#{splunk_cmd} enable listen #{node['splunk']['receiver_port']} -auth #{node['splunk']['auth']['username']}:#{node['splunk']['auth']['password']}"
326:      command "#{splunk_cmd} edit licenser-localslave -master_uri 'https://#{node['splunk']['dedicated_search_master']}:8089' -auth #{node['splunk']['auth']['username']}:#{node['splunk']['auth']['passwor
391:    command "/opt/splunk/bin/splunk login -auth #{node['splunk']['auth']['username']}:#{node['splunk']['auth']['password']}"

cookbooks/splunk_cookbook/recipes/forwarder.rb
78:execute "#{splunk_cmd} edit user admin -password #{node['splunk']['auth']['password']} -roles admin -auth admin:changeme && echo true > /opt/splunk_setup_passwd" do

但是,我不确定grep /搜索JSON角色/环境的好方法......

这有效:

 nickh@BONHENRY:~/Repositories/chef$ knife search environment "override_attributes_splunk_auth:*" -i
 1 items found

 prod-acme

但是,你知道为什么会这样吗:

 nickh@BONHENRY:~/Repositories/chef$ knife search environment "*:*" -i
 108 items found

但这不是吗? :

 nickh@BONHENRY:~/Repositories/chef$ knife search environment "*splunk_auth:*" -i
 ERROR: knife search failed: invalid index name or query

有没有一种简单/更好的方法可以做到我没想到/没有意识到?我可以用我的Solr查询更改一些可以使其工作的内容吗?

提前致谢: - )

1 个答案:

答案 0 :(得分:0)

因为*:*是搜索系统中完全绕过Solr的特例。 Chef的搜索索引使用查询的转换版本,这样我就不会认为在facet名称中使用glob是安全的。我建议运行knife download environments/(类似于角色),然后在本地JSON文件上执行grep。