Skip to content

Commit a7a507a

Browse files
author
jtimberman
committed
Also for CHEF-1018, should correct command for --version in --help
1 parent 4153d02 commit a7a507a

4 files changed

Lines changed: 31 additions & 31 deletions

File tree

chef-solr/lib/chef/solr.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -76,7 +76,7 @@ def post_to_solr(doc)
7676

7777
def solr_add(data)
7878
data = [data] unless data.kind_of?(Array)
79-
79+
8080
Chef::Log.debug("adding to SOLR: #{data.inspect}")
8181
xml_document = LibXML::XML::Document.new
8282
xml_add = LibXML::XML::Node.new("add")
@@ -100,40 +100,40 @@ def solr_add(data)
100100
def solr_commit(opts={})
101101
post_to_solr(generate_single_element("commit", opts))
102102
end
103-
103+
104104
def solr_optimize(opts={})
105105
post_to_solr(generate_single_element("optimize", opts))
106106
end
107-
107+
108108
def solr_rollback
109109
post_to_solr(generate_single_element("rollback"))
110110
end
111-
111+
112112
def solr_delete_by_id(ids)
113113
post_to_solr(generate_delete_document("id", ids))
114114
end
115-
115+
116116
def solr_delete_by_query(queries)
117117
post_to_solr(generate_delete_document("query", queries))
118118
end
119119

120120
def rebuild_index(url=Chef::Config[:couchdb_url], db=Chef::Config[:couchdb_database])
121121
solr_delete_by_query("X_CHEF_database_CHEF_X:#{db}")
122122
solr_commit
123-
123+
124124
results = {}
125125
[Chef::ApiClient, Chef::Node, Chef::OpenIDRegistration, Chef::Role, Chef::WebUIUser].each do |klass|
126126
results[klass.name] = reindex_all(klass) ? "success" : "failed"
127127
end
128128
databags = Chef::DataBag.cdb_list(true)
129129
Chef::Log.info("Reloading #{databags.size.to_s} #{Chef::DataBag} objects into the indexer")
130-
databags.each { |i| i.add_to_index; i.list(true).each { |x| x.add_to_index } }
131-
results[Chef::DataBag.name] = "success"
130+
databags.each { |i| i.add_to_index; i.list(true).each { |x| x.add_to_index } }
131+
results[Chef::DataBag.name] = "success"
132132
results
133133
end
134134

135135
private
136-
136+
137137
def reindex_all(klass, metadata={})
138138
begin
139139
items = klass.cdb_list(true)
@@ -207,7 +207,7 @@ def to_params(params_hash)
207207
def escape(s)
208208
s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
209209
'%'+$1.unpack('H2'*$1.size).join('%').upcase
210-
}.tr(' ', '+')
210+
}.tr(' ', '+')
211211
end
212212

213213
end

chef-solr/lib/chef/solr/application/indexer.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -29,14 +29,14 @@ class Chef
2929
class Solr
3030
class Application
3131
class Indexer < Chef::Application
32-
33-
option :config_file,
32+
33+
option :config_file,
3434
:short => "-c CONFIG",
3535
:long => "--config CONFIG",
3636
:default => "/etc/chef/solr.rb",
3737
:description => "The configuration file to use"
3838

39-
option :log_level,
39+
option :log_level,
4040
:short => "-l LEVEL",
4141
:long => "--log_level LEVEL",
4242
:description => "Set the log level (debug, info, warn, error, fatal)",
@@ -94,13 +94,13 @@ class Indexer < Chef::Application
9494
option :amqp_vhost,
9595
:long => "--amqp-vhost VHOST",
9696
:description => "The amqp vhost"
97-
97+
9898
option :version,
9999
:short => "-v",
100100
:long => "--version",
101-
:description => "Show chef-solr version",
101+
:description => "Show chef-solr-indexer version",
102102
:boolean => true,
103-
:proc => lambda {|v| puts "chef-solr: #{Chef::Solr::VERSION}"},
103+
:proc => lambda {|v| puts "chef-solr-indexer: #{::Chef::Solr::VERSION}"},
104104
:exit => 0
105105

106106
Signal.trap("INT") do
@@ -110,15 +110,15 @@ class Indexer < Chef::Application
110110
end
111111
fatal!("SIGINT received, stopping", 2)
112112
end
113-
114-
Kernel.trap("TERM") do
113+
114+
Kernel.trap("TERM") do
115115
begin
116116
AmqpClient.instance.stop
117117
rescue Bunny::ProtocolError, Bunny::ConnectionError, Bunny::UnsubscribeError
118118
end
119119
fatal!("SIGTERM received, stopping", 1)
120120
end
121-
121+
122122
def initialize
123123
super
124124

chef-solr/lib/chef/solr/application/rebuild.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
88
# You may obtain a copy of the License at
9-
#
9+
#
1010
# http://www.apache.org/licenses/LICENSE-2.0
11-
#
11+
#
1212
# Unless required by applicable law or agreed to in writing, software
1313
# distributed under the License is distributed on an "AS IS" BASIS,
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,14 +26,14 @@ class Chef
2626
class Solr
2727
class Application
2828
class Rebuild < Chef::Application
29-
30-
option :config_file,
29+
30+
option :config_file,
3131
:short => "-c CONFIG",
3232
:long => "--config CONFIG",
3333
:default => "/etc/chef/solr.rb",
3434
:description => "The configuration file to use"
3535

36-
option :log_level,
36+
option :log_level,
3737
:short => "-l LEVEL",
3838
:long => "--log_level LEVEL",
3939
:description => "Set the log level (debug, info, warn, error, fatal)",
@@ -67,9 +67,9 @@ class Rebuild < Chef::Application
6767
option :version,
6868
:short => "-v",
6969
:long => "--version",
70-
:description => "Show chef-solr version",
70+
:description => "Show chef-solr-rebuild version",
7171
:boolean => true,
72-
:proc => lambda {|v| puts "chef-solr: #{Chef::Solr::VERSION}"},
72+
:proc => lambda {|v| puts "chef-solr-rebuild: #{::Chef::Solr::VERSION}"},
7373
:exit => 0
7474

7575
def initialize

chef-solr/lib/chef/solr/application/solr.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Solr < Chef::Application
103103
:long => "--version",
104104
:description => "Show chef-solr version",
105105
:boolean => true,
106-
:proc => lambda {|v| puts "chef-solr: #{Chef::Solr::VERSION}"},
106+
:proc => lambda {|v| puts "chef-solr: #{::Chef::Solr::VERSION}"},
107107
:exit => 0
108108

109109
def initialize

0 commit comments

Comments
 (0)