chef-solr 0.8.10 → 0.8.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.10
1
+ 0.8.14
@@ -16,7 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'rubygems'
20
19
  require 'chef/mixin/xml_escape'
21
20
  require 'chef/log'
22
21
  require 'chef/config'
@@ -35,7 +34,7 @@ require 'uri'
35
34
  class Chef
36
35
  class Solr
37
36
 
38
- VERSION = "0.8.9"
37
+ VERSION = "0.8.14"
39
38
 
40
39
  include Chef::Mixin::XMLEscape
41
40
 
@@ -114,25 +114,36 @@ class Chef
114
114
 
115
115
  def initialize
116
116
  super
117
- Chef::Log.level = Chef::Config[:log_level]
118
117
  end
119
118
 
120
119
  def setup_application
121
- Chef::Daemon.change_privilege
120
+ # Need to redirect stdout and stderr so Java process inherits them.
121
+ # If -L wasn't specified, Chef::Config[:log_location] will be an IO
122
+ # object, otherwise it will be a String.
123
+ #
124
+ # Open this as a privileged user and hang onto it
125
+ if Chef::Config[:log_location].kind_of?(String)
126
+ @logfile = File.new(Chef::Config[:log_location], "a")
127
+ end
128
+
129
+ Chef::Log.level = Chef::Config[:log_level]
122
130
 
123
131
  # Build up a client
124
- c = Chef::Client.new
125
- c.build_node(nil, true)
132
+ node = Chef::Node.new
133
+ node.platform = :default
134
+ node.platform_version = 42
135
+
136
+ Chef::Daemon.change_privilege
126
137
 
127
138
  solr_base = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "..", "..", "solr"))
128
139
 
129
140
  # Create the Jetty container
130
141
  unless File.directory?(Chef::Config[:solr_jetty_path])
131
142
  Chef::Log.warn("Initializing the Jetty container")
132
- solr_jetty_dir = Chef::Resource::Directory.new(Chef::Config[:solr_jetty_path], nil, c.node)
143
+ solr_jetty_dir = Chef::Resource::Directory.new(Chef::Config[:solr_jetty_path], nil, node)
133
144
  solr_jetty_dir.recursive(true)
134
145
  solr_jetty_dir.run_action(:create)
135
- solr_jetty_untar = Chef::Resource::Execute.new("untar_jetty", nil, c.node)
146
+ solr_jetty_untar = Chef::Resource::Execute.new("untar_jetty", nil, node)
136
147
  solr_jetty_untar.command("tar zxvf #{File.join(solr_base, 'solr-jetty.tar.gz')}")
137
148
  solr_jetty_untar.cwd(Chef::Config[:solr_jetty_path])
138
149
  solr_jetty_untar.run_action(:run)
@@ -141,10 +152,10 @@ class Chef
141
152
  # Create the solr home
142
153
  unless File.directory?(Chef::Config[:solr_home_path])
143
154
  Chef::Log.warn("Initializing Solr home directory")
144
- solr_home_dir = Chef::Resource::Directory.new(Chef::Config[:solr_home_path], nil, c.node)
155
+ solr_home_dir = Chef::Resource::Directory.new(Chef::Config[:solr_home_path], nil, node)
145
156
  solr_home_dir.recursive(true)
146
157
  solr_home_dir.run_action(:create)
147
- solr_jetty_untar = Chef::Resource::Execute.new("untar_solr_home", nil, c.node)
158
+ solr_jetty_untar = Chef::Resource::Execute.new("untar_solr_home", nil, node)
148
159
  solr_jetty_untar.command("tar zxvf #{File.join(solr_base, 'solr-home.tar.gz')}")
149
160
  solr_jetty_untar.cwd(Chef::Config[:solr_home_path])
150
161
  solr_jetty_untar.run_action(:run)
@@ -153,7 +164,7 @@ class Chef
153
164
  # Create the solr data path
154
165
  unless File.directory?(Chef::Config[:solr_data_path])
155
166
  Chef::Log.warn("Initializing Solr data directory")
156
- solr_data_dir = Chef::Resource::Directory.new(Chef::Config[:solr_data_path], nil, c.node)
167
+ solr_data_dir = Chef::Resource::Directory.new(Chef::Config[:solr_data_path], nil, node)
157
168
  solr_data_dir.recursive(true)
158
169
  solr_data_dir.run_action(:create)
159
170
  end
@@ -164,15 +175,6 @@ class Chef
164
175
  Chef::Daemon.daemonize("chef-solr")
165
176
  end
166
177
 
167
- # Need to redirect stdout and stderr so Java process inherits them.
168
- # If -L wasn't specified, Chef::Config[:log_location] will be an IO
169
- # object, otherwise it will be a String.
170
- if Chef::Config[:log_location].kind_of?(String)
171
- logfile = File.new(Chef::Config[:log_location], "w")
172
- STDOUT.reopen(logfile)
173
- STDERR.reopen(logfile)
174
- end
175
-
176
178
  Dir.chdir(Chef::Config[:solr_jetty_path]) do
177
179
  command = "java -Xmx#{Chef::Config[:solr_heap_size]} -Xms#{Chef::Config[:solr_heap_size]}"
178
180
  command << " -Dsolr.data.dir=#{Chef::Config[:solr_data_path]}"
@@ -180,6 +182,17 @@ class Chef
180
182
  command << " #{Chef::Config[:solr_java_opts]}" if Chef::Config[:solr_java_opts]
181
183
  command << " -jar #{File.join(Chef::Config[:solr_jetty_path], 'start.jar')}"
182
184
  Chef::Log.info("Starting Solr with #{command}")
185
+
186
+ # Opened earlier before we dropped privileges
187
+ if @logfile
188
+ # Don't need it anymore
189
+ Chef::Log.close
190
+
191
+ STDOUT.reopen(@logfile)
192
+ STDERR.reopen(@logfile)
193
+ @logfile.close
194
+ end
195
+
183
196
  Kernel.exec(command)
184
197
 
185
198
  end
@@ -16,7 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'rubygems'
20
19
  require 'chef/log'
21
20
  require 'chef/config'
22
21
  require 'chef/solr'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 10
9
- version: 0.8.10
8
+ - 14
9
+ version: 0.8.14
10
10
  platform: ruby
11
11
  authors:
12
12
  - Adam Jacob
@@ -14,13 +14,14 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-01 00:00:00 -07:00
17
+ date: 2010-05-07 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: libxml-ruby
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
@@ -35,6 +36,7 @@ dependencies:
35
36
  name: uuidtools
36
37
  prerelease: false
37
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
38
40
  requirements:
39
41
  - - ">="
40
42
  - !ruby/object:Gem::Version
@@ -49,14 +51,15 @@ dependencies:
49
51
  name: chef
50
52
  prerelease: false
51
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
52
55
  requirements:
53
56
  - - "="
54
57
  - !ruby/object:Gem::Version
55
58
  segments:
56
59
  - 0
57
60
  - 8
58
- - 10
59
- version: 0.8.10
61
+ - 14
62
+ version: 0.8.14
60
63
  type: :runtime
61
64
  version_requirements: *id003
62
65
  description:
@@ -102,6 +105,7 @@ rdoc_options:
102
105
  require_paths:
103
106
  - lib
104
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
105
109
  requirements:
106
110
  - - ">="
107
111
  - !ruby/object:Gem::Version
@@ -109,6 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
113
  - 0
110
114
  version: "0"
111
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
+ none: false
112
117
  requirements:
113
118
  - - ">="
114
119
  - !ruby/object:Gem::Version
@@ -118,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
123
  requirements: []
119
124
 
120
125
  rubyforge_project:
121
- rubygems_version: 1.3.6
126
+ rubygems_version: 1.3.6.1
122
127
  signing_key:
123
128
  specification_version: 3
124
129
  summary: Search indexing for Chef