passenger 6.0.13 → 6.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,7 +25,7 @@
25
25
  require 'optparse'
26
26
  require 'net/http'
27
27
  require 'socket'
28
- require 'rexml/document'
28
+ require 'json'
29
29
  PhusionPassenger.require_passenger_lib 'constants'
30
30
  PhusionPassenger.require_passenger_lib 'admin_tools/instance_registry'
31
31
  PhusionPassenger.require_passenger_lib 'config/command'
@@ -148,8 +148,8 @@ module PhusionPassenger
148
148
  end
149
149
 
150
150
  def select_app_group_name_exact(name)
151
- query_pool_xml.elements.each("info/supergroups/supergroup/group") do |group|
152
- if group.elements["name"].text == name
151
+ query_pool_json.each do |group|
152
+ if group[:name] == name
153
153
  @groups << group
154
154
  end
155
155
  end
@@ -161,8 +161,8 @@ module PhusionPassenger
161
161
 
162
162
  def query_group_names
163
163
  result = []
164
- query_pool_xml.elements.each("info/supergroups/supergroup/group") do |group|
165
- result << group.elements["name"].text
164
+ query_pool_json.each do |group|
165
+ result << group[:name]
166
166
  end
167
167
  result << "Cancel"
168
168
  result
@@ -204,8 +204,8 @@ module PhusionPassenger
204
204
  app_root = Dir.pwd
205
205
  end
206
206
  regex = /^#{Regexp.escape(app_root)}/
207
- query_pool_xml.elements.each("info/supergroups/supergroup/group") do |group|
208
- if group.elements["app_root"].text =~ regex
207
+ query_pool_json.each do |group|
208
+ if group[:app_root] =~ regex
209
209
  @groups << group
210
210
  end
211
211
  end
@@ -218,7 +218,7 @@ module PhusionPassenger
218
218
  def perform_restart
219
219
  restart_method = @options[:rolling_restart] ? "rolling" : "blocking"
220
220
  @groups.each do |group|
221
- group_name = group.elements["name"].text
221
+ group_name = group[:name]
222
222
  puts "Restarting #{group_name}"
223
223
  request = Net::HTTP::Post.new("/pool/restart_app_group.json")
224
224
  try_performing_full_admin_basic_auth(request, @instance)
@@ -249,15 +249,19 @@ module PhusionPassenger
249
249
  end
250
250
  end
251
251
 
252
- def query_pool_xml
253
- request = Net::HTTP::Get.new("/pool.xml")
252
+ def query_pool_json
253
+ request = Net::HTTP::Get.new("/pool.json")
254
254
  try_performing_ro_admin_basic_auth(request, @instance)
255
255
  response = @instance.http_request("agents.s/core_api", request)
256
256
  if response.code.to_i / 100 == 2
257
- REXML::Document.new(response.body)
257
+ if RUBY_VERSION >= '2.3'
258
+ JSON.parse(response.body, symbolize_names: true).to_a.map{|(key,value)| {name: key.to_s, app_root: value.dig(:app_root,0,:value)}}
259
+ else
260
+ JSON.parse(response.body, symbolize_names: true).to_a.map{|(key,value)| {name: key.to_s, app_root: value[:app_root][0][:value]}}
261
+ end
258
262
  elsif response.code.to_i == 401
259
263
  if response["pool-empty"] == "true"
260
- REXML::Document.new('<?xml version="1.0" encoding="iso8859-1"?><info version="3"></info>')
264
+ []
261
265
  elsif @options[:ignore_app_not_running]
262
266
  print_instance_querying_permission_error
263
267
  exit
@@ -40,8 +40,13 @@ module PhusionPassenger
40
40
  data = input[:text]
41
41
  end
42
42
  @colors = options[:colors] || AnsiColors.new
43
- @template = ERB.new(@colors.ansi_colorize(data),
44
- nil, '-', '@buffer')
43
+
44
+ if RUBY_VERSION >= '2.6'
45
+ @template = ERB.new(@colors.ansi_colorize(data), trim_mode: '-', eoutvar: '@buffer')
46
+ else
47
+ @template = ERB.new(@colors.ansi_colorize(data), nil, '-', '@buffer')
48
+ end
49
+
45
50
  @template.filename = filename if filename
46
51
  options.each_pair do |name, value|
47
52
  self[name] = value
@@ -104,7 +104,7 @@ module PhusionPassenger
104
104
  'Jenkinsfile',
105
105
  'Passenger.sublime-project',
106
106
  'Vagrantfile',
107
- 'yarn.lock',
107
+ 'package-lock.json',
108
108
  'build/support/vendor/*/.*',
109
109
  'build/support/vendor/*/spec/**/*',
110
110
  'dev/*/**/*',
@@ -75,7 +75,7 @@ module PhusionPassenger
75
75
  #
76
76
  # Connect to the engine's server and wait until it disconnects the socket
77
77
  # because of timeout. Keep doing this until we can no longer connect.
78
- while true
78
+ loop do
79
79
  if @options[:socket_file]
80
80
  socket = UNIXSocket.new(@options[:socket_file])
81
81
  else
@@ -110,14 +110,14 @@ module PhusionPassenger
110
110
  command = "#{Shellwords.escape @nginx_binary}" \
111
111
  " -c #{Shellwords.escape path}" \
112
112
  " -p #{Shellwords.escape @working_dir}" \
113
- " -t"
113
+ ' -t'
114
114
  output = `#{command} 2>&1`
115
115
  if $? && $?.exitstatus != 0
116
116
  output.gsub!(path, file)
117
117
  output = PlatformInfo.send(:reindent, output, 4)
118
118
 
119
119
  message = "*** ERROR: the Nginx configuration that #{PROGRAM_NAME}" \
120
- " Standalone generated internally contains problems. The error " \
120
+ ' Standalone generated internally contains problems. The error ' \
121
121
  "message returned by the Nginx engine is:\n\n" \
122
122
  "#{output}\n\n"
123
123
  debug_log_file = Utils::TmpIO.new('passenger-standalone',
@@ -130,16 +130,16 @@ module PhusionPassenger
130
130
  debug_log_file.close
131
131
  end
132
132
  if @options[:nginx_config_template] && file == 'nginx.conf'
133
- message << "This probably means that you have a problem in your " \
133
+ message << 'This probably means that you have a problem in your ' \
134
134
  "Nginx configuration template. Please fix your template.\n\n" \
135
135
  "Tip: to debug your template, re-run #{SHORT_PROGRAM_NAME} " \
136
- "Standalone with the `--debug-nginx-config` option. This " \
137
- "allows you to see how the final Nginx config file looks like."
136
+ 'Standalone with the `--debug-nginx-config` option. This ' \
137
+ 'allows you to see how the final Nginx config file looks like.'
138
138
  else
139
- message << "This probably means that you have found a bug in " \
139
+ message << 'This probably means that you have found a bug in ' \
140
140
  "#{PROGRAM_NAME} Standalone. Please report this bug to our " \
141
141
  "Github issue tracker: https://github.com/phusion/passenger/issues\n\n" \
142
- "In the bug report, please include this error message, as " \
142
+ 'In the bug report, please include this error message, as ' \
143
143
  "well as the contents of the file #{debug_log_file.path}"
144
144
  end
145
145
 
@@ -155,13 +155,13 @@ module PhusionPassenger
155
155
  end
156
156
  return {
157
157
  :identifier => 'Nginx',
158
- :start_command => "#{Shellwords.escape @nginx_binary} " +
159
- "-c #{Shellwords.escape nginx_config_path} " +
158
+ :start_command => "#{Shellwords.escape @nginx_binary} " \
159
+ "-c #{Shellwords.escape nginx_config_path} " \
160
160
  "-p #{Shellwords.escape @working_dir}",
161
- :stop_command => "#{Shellwords.escape @nginx_binary} " +
162
- "-c #{Shellwords.escape nginx_config_path} " +
163
- "-p #{Shellwords.escape @working_dir} " +
164
- "-s quit",
161
+ :stop_command => "#{Shellwords.escape @nginx_binary} " \
162
+ "-c #{Shellwords.escape nginx_config_path} " \
163
+ "-p #{Shellwords.escape @working_dir} " \
164
+ '-s quit',
165
165
  :ping_command => ping_spec,
166
166
  :pid_file => @options[:pid_file],
167
167
  :log_file => @options[:log_file],
@@ -179,8 +179,13 @@ module PhusionPassenger
179
179
  def write_nginx_config_file(path)
180
180
  File.open(path, 'w') do |f|
181
181
  f.chmod(0644)
182
- erb = ERB.new(File.read(nginx_config_template_filename), nil,
183
- "-", next_eoutvar)
182
+
183
+ if RUBY_VERSION >= '2.6'
184
+ erb = ERB.new(File.read(nginx_config_template_filename), trim_mode: "-", eoutvar: next_eoutvar)
185
+ else
186
+ erb = ERB.new(File.read(nginx_config_template_filename), nil, '-', next_eoutvar)
187
+ end
188
+
184
189
  erb.filename = nginx_config_template_filename
185
190
 
186
191
  # The template requires some helper methods which are defined in start_command.rb.
@@ -279,7 +284,13 @@ module PhusionPassenger
279
284
 
280
285
  def include_passenger_internal_template(name, indent = 0, fix_existing_indenting = true, the_binding = get_binding)
281
286
  path = "#{PhusionPassenger.resources_dir}/templates/standalone/#{name}"
282
- erb = ERB.new(File.read(path), nil, "-", next_eoutvar)
287
+
288
+ if RUBY_VERSION >= '2.6'
289
+ erb = ERB.new(File.read(path), trim_mode: "-", eoutvar: next_eoutvar)
290
+ else
291
+ erb = ERB.new(File.read(path), nil, "-", next_eoutvar)
292
+ end
293
+
283
294
  erb.filename = path
284
295
  result = erb.result(the_binding)
285
296
 
@@ -31,7 +31,7 @@ module PhusionPassenger
31
31
 
32
32
  PACKAGE_NAME = 'passenger'
33
33
  # Run 'rake src/cxx_supportlib/Constants.h configkit_schemas_inline_comments' after changing this number.
34
- VERSION_STRING = '6.0.13'
34
+ VERSION_STRING = '6.0.14'
35
35
 
36
36
  # Tip: find the SHA-256 with ./dev/nginx_version_sha2 <VERSION>
37
37
  PREFERRED_NGINX_VERSION = '1.20.2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.13
4
+ version: 6.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-27 00:00:00.000000000 Z
11
+ date: 2022-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake