Update cookbooks and add wordpress cookbook
This commit is contained in:
@@ -2,27 +2,43 @@ partial_search Cookbook CHANGELOG
|
||||
=================================
|
||||
This file is used to list changes made in each version of the partial_search cookbook.
|
||||
|
||||
v1.0.9 (2015-10-21)
|
||||
-------------------
|
||||
-------------------
|
||||
* Updated description to clarify that this cookbook is no longer needed for chef-client 12.0
|
||||
* Updated .gitignore file
|
||||
* Added .foodcritic file to exclude rules that don't apply
|
||||
* Added Test Kitchen config
|
||||
* Added Chef standard Rubocop config
|
||||
* Added Travis CI testing to use Chef DK
|
||||
* Added Berksfile
|
||||
* Added Gemfile with the latest development dependencies
|
||||
* Updated contributing and testing docs
|
||||
* Added maintainers.md and maintainers.toml files
|
||||
* Added Travis and cookbook version badges to the readme
|
||||
* Updated Opscode -> Chef Software
|
||||
* Added a Rakefile for simplified testing
|
||||
* Added a Chefignore file
|
||||
* Resolved Rubocop warnings
|
||||
* Added source_url and issues_url to the metadata
|
||||
* Added basic convergence Chefspec test
|
||||
|
||||
v1.0.8 (2014-02-25)
|
||||
-------------------
|
||||
- [COOK-4260] Update compatibility in README.md
|
||||
|
||||
|
||||
v1.0.6
|
||||
------
|
||||
- **Hotfix** - Revert client-side caching bug
|
||||
|
||||
|
||||
v1.0.4
|
||||
------
|
||||
### New Feature
|
||||
- **[COOK-2584](https://tickets.opscode.com/browse/COOK-2584)** - Add client-side result cache
|
||||
|
||||
- **[COOK-2584](https://tickets.chef.io/browse/COOK-2584)** - Add client-side result cache
|
||||
|
||||
v1.0.2
|
||||
------
|
||||
### Bug
|
||||
|
||||
- [COOK-3164]: `partial_search` should use
|
||||
`Chef::Config[:chef_server_url]` instead of `search_url`
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
Partial Search Cookbook
|
||||
=======================
|
||||
[Partial Search](http://docs.opscode.com/essentials_search.html#partial-search)
|
||||
is a search API available on Chef Server. (see Notes below for version compatibility)
|
||||
[](http://travis-ci.org/chef-cookbooks/partial_search)
|
||||
[](https://supermarket.chef.io/cookbooks/partial_search)
|
||||
|
||||
[Partial Search](http://docs.chef.io/essentials_search.html#partial-search)
|
||||
is a search API available on Chef Server. (see Notes below for version compatibility)
|
||||
It can be used to reduce the network bandwidth and the memory used by
|
||||
chef-client to process search results.
|
||||
|
||||
@@ -9,14 +12,13 @@ This cookbook provides an experimental interface to the partial search
|
||||
API by providing a `partial_search` method that can be used instead of
|
||||
the `search` method in your recipes.
|
||||
|
||||
Since Chef Client 11.10.0 the partial_search capability has been built-in
|
||||
so it does not require this cookbook.
|
||||
|
||||
The `partial_search` method allows you to retrieve just the attributes
|
||||
of interest. For example, you can execute a search to return just the
|
||||
name and IP addresses of the nodes in your infrastructure rather than
|
||||
receiving an array of complete node objects and post-processing them.
|
||||
|
||||
NOTE: Since Chef Client 12.0 the partial_search capability has been built-in
|
||||
so it does not require this cookbook.
|
||||
|
||||
Install
|
||||
-------
|
||||
@@ -62,11 +64,11 @@ Notes
|
||||
|
||||
License & Authors
|
||||
-----------------
|
||||
- Author:: Adam Jacob (<adam@opscode.com>)
|
||||
- Author:: John Keiser (<jkeiser@opscode.com>)
|
||||
- Author:: Adam Jacob (<adam@chef.io>)
|
||||
- Author:: John Keiser (<jkeiser@chef.io>)
|
||||
|
||||
```text
|
||||
Copyright:: 2012-2013, Opscode, Inc.
|
||||
Copyright:: 2012-2015, Chef Software, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Author:: Adam Jacob (<adam@opscode.com>)
|
||||
# Author:: John Keiser (<jkeiser@opscode.com>)
|
||||
# Copyright:: Copyright (c) 2012 Opscode, Inc.
|
||||
# Author:: Adam Jacob (<adam@chef.io>)
|
||||
# Author:: John Keiser (<jkeiser@chef.io>)
|
||||
# Copyright:: Copyright (c) 2012 Chef Software, Inc.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -29,17 +29,16 @@ require 'chef/data_bag_item'
|
||||
|
||||
class Chef
|
||||
class PartialSearch
|
||||
|
||||
attr_accessor :rest
|
||||
|
||||
def initialize(url=nil)
|
||||
def initialize(url = nil)
|
||||
@rest = ::Chef::REST.new(url || ::Chef::Config[:chef_server_url])
|
||||
end
|
||||
|
||||
# Search Solr for objects of a given type, for a given query. If you give
|
||||
# it a block, it will handle the paging for you dynamically.
|
||||
def search(type, query='*:*', args={}, &block)
|
||||
raise ArgumentError, "Type must be a string or a symbol!" unless (type.kind_of?(String) || type.kind_of?(Symbol))
|
||||
def search(type, query = '*:*', args = {}, &block)
|
||||
fail ArgumentError, 'Type must be a string or a symbol!' unless type.is_a?(String) || type.is_a?(Symbol)
|
||||
|
||||
sort = args.include?(:sort) ? args[:sort] : 'X_CHEF_id_CHEF_X asc'
|
||||
start = args.include?(:start) ? args[:start] : 0
|
||||
@@ -53,31 +52,32 @@ class Chef
|
||||
response_rows = response['rows']
|
||||
end
|
||||
if block
|
||||
response_rows.each { |o| block.call(o) unless o.nil?}
|
||||
unless (response["start"] + response_rows.length) >= response["total"]
|
||||
nstart = response["start"] + rows
|
||||
response_rows.each { |o| block.call(o) unless o.nil? }
|
||||
unless (response['start'] + response_rows.length) >= response['total']
|
||||
nstart = response['start'] + rows
|
||||
args_hash = {
|
||||
:keys => args[:keys],
|
||||
:sort => sort,
|
||||
:start => nstart,
|
||||
:rows => rows
|
||||
keys: args[:keys],
|
||||
sort: sort,
|
||||
start: nstart,
|
||||
rows: rows
|
||||
}
|
||||
search(type, query, args_hash, &block)
|
||||
end
|
||||
true
|
||||
else
|
||||
[ response_rows, response["start"], response["total"] ]
|
||||
[response_rows, response['start'], response['total']]
|
||||
end
|
||||
end
|
||||
|
||||
def list_indexes
|
||||
response = @rest.get_rest("search")
|
||||
@rest.get_rest('search')
|
||||
end
|
||||
|
||||
private
|
||||
def escape(s)
|
||||
s && URI.escape(s.to_s)
|
||||
end
|
||||
|
||||
def escape(s)
|
||||
s && URI.escape(s.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -123,7 +123,7 @@ end
|
||||
# puts "#{node[:name]}: #{node[:ip]}"
|
||||
# end
|
||||
#
|
||||
def partial_search(type, query='*:*', *args, &block)
|
||||
def partial_search(type, query = '*:*', *args, &block)
|
||||
# Support both the old (positional args) and new (hash args) styles of calling
|
||||
if args.length == 1 && args[0].is_a?(Hash)
|
||||
args_hash = args[0]
|
||||
@@ -138,7 +138,7 @@ def partial_search(type, query='*:*', *args, &block)
|
||||
Chef::PartialSearch.new.search(type, query, args_hash, &block)
|
||||
# Otherwise, do the iteration for the end user
|
||||
else
|
||||
results = Array.new
|
||||
results = []
|
||||
Chef::PartialSearch.new.search(type, query, args_hash) do |o|
|
||||
results << o
|
||||
end
|
||||
|
||||
@@ -1,29 +1 @@
|
||||
{
|
||||
"name": "partial_search",
|
||||
"version": "1.0.8",
|
||||
"description": "Provides experimental interface to partial search API in Opscode Hosted Chef",
|
||||
"long_description": "Partial Search Cookbook\n=======================\n[Partial Search](http://docs.opscode.com/essentials_search.html#partial-search)\nis a search API available on Chef Server. (see Notes below for version compatibility) \nIt can be used to reduce the network bandwidth and the memory used by\nchef-client to process search results.\n\nThis cookbook provides an experimental interface to the partial search\nAPI by providing a `partial_search` method that can be used instead of\nthe `search` method in your recipes.\n\nSince Chef Client 11.10.0 the partial_search capability has been built-in\nso it does not require this cookbook.\n\nThe `partial_search` method allows you to retrieve just the attributes\nof interest. For example, you can execute a search to return just the\nname and IP addresses of the nodes in your infrastructure rather than\nreceiving an array of complete node objects and post-processing them.\n\n\nInstall\n-------\nUpload this cookbook and include it in the dependencies of any\ncookbook where you would like to use `partial_search`.\n\n\nUsage\n-----\nWhen you call `partial_search`, you need to specify the key paths of the\nattributes you want returned. Key paths are specified as an array\nof strings. Each key path is mapped to a short name of your\nchoosing. Consider the following example:\n\n```ruby\npartial_search(:node, 'role:web',\n :keys => { 'name' => [ 'name' ],\n 'ip' => [ 'ipaddress' ],\n 'kernel_version' => [ 'kernel', 'version' ]\n }\n).each do |result|\n puts result['name']\n puts result['ip']\n puts result['kernel_version']\nend\n```\n\nIn the example above, two attributes will be extracted (on the\nserver) from the nodes that match the search query. The result will\nbe a simple hash with keys 'name' and 'ip'.\n\n\nNotes\n-----\n* We would like your feedback on this feature and the interface\n provided by this cookbook. Please send comments to the chef-dev\n mailing list.\n\n* The partial search API is available in the Open Source Chef Server since 11.0.4\n\n* The partial search API is available in Enterprise Chef Server since 1.2.2\n\n\nLicense & Authors\n-----------------\n- Author:: Adam Jacob (<adam@opscode.com>)\n- Author:: John Keiser (<jkeiser@opscode.com>)\n\n```text\nCopyright:: 2012-2013, Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
}
|
||||
}
|
||||
{"name":"partial_search","version":"1.0.9","description":"Provides experimental interface to partial search API in Chef Software Hosted Chef for Chef-Client pre-12.0","long_description":"Partial Search Cookbook\n=======================\n[](http://travis-ci.org/chef-cookbooks/partial_search)\n[](https://supermarket.chef.io/cookbooks/partial_search)\n\n[Partial Search](http://docs.chef.io/essentials_search.html#partial-search)\nis a search API available on Chef Server. (see Notes below for version compatibility)\nIt can be used to reduce the network bandwidth and the memory used by\nchef-client to process search results.\n\nThis cookbook provides an experimental interface to the partial search\nAPI by providing a `partial_search` method that can be used instead of\nthe `search` method in your recipes.\n\nThe `partial_search` method allows you to retrieve just the attributes\nof interest. For example, you can execute a search to return just the\nname and IP addresses of the nodes in your infrastructure rather than\nreceiving an array of complete node objects and post-processing them.\n\nNOTE: Since Chef Client 12.0 the partial_search capability has been built-in\nso it does not require this cookbook.\n\nInstall\n-------\nUpload this cookbook and include it in the dependencies of any\ncookbook where you would like to use `partial_search`.\n\n\nUsage\n-----\nWhen you call `partial_search`, you need to specify the key paths of the\nattributes you want returned. Key paths are specified as an array\nof strings. Each key path is mapped to a short name of your\nchoosing. Consider the following example:\n\n```ruby\npartial_search(:node, 'role:web',\n :keys => { 'name' => [ 'name' ],\n 'ip' => [ 'ipaddress' ],\n 'kernel_version' => [ 'kernel', 'version' ]\n }\n).each do |result|\n puts result['name']\n puts result['ip']\n puts result['kernel_version']\nend\n```\n\nIn the example above, two attributes will be extracted (on the\nserver) from the nodes that match the search query. The result will\nbe a simple hash with keys 'name' and 'ip'.\n\n\nNotes\n-----\n* We would like your feedback on this feature and the interface\n provided by this cookbook. Please send comments to the chef-dev\n mailing list.\n\n* The partial search API is available in the Open Source Chef Server since 11.0.4\n\n* The partial search API is available in Enterprise Chef Server since 1.2.2\n\n\nLicense & Authors\n-----------------\n- Author:: Adam Jacob (<adam@chef.io>)\n- Author:: John Keiser (<jkeiser@chef.io>)\n\n```text\nCopyright:: 2012-2015, Chef Software, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}}
|
||||
@@ -1,7 +0,0 @@
|
||||
name "partial_search"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Provides experimental interface to partial search API in Opscode Hosted Chef"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.0.8"
|
||||
Reference in New Issue
Block a user