Advertisement
pentux

Opennebula 4.0 Sunstone Error

May 8th, 2013
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.62 KB | None | 0 0
  1. application error
  2. NoMethodError at /
  3. undefined method `[]' for nil:NilClass
  4. file: index.erb
  5. location: evaluate_source
  6. line: 68
  7. BACKTRACE
  8. (condense)
  9. JUMP TO: GET POST COOKIES ENV
  10. /usr/share/opennebula/sunstone/views/index.erb in evaluate_source
  11. 61. };
  12. 62.
  13. 63.
  14. 64. </script>
  15. 65. <script src="js/plugins/config-tab.js" type="text/javascript"></script>
  16. 66.
  17. 67. <!-- enabled tabs: -->
  18. 68. <%- view['enabled_tabs'].each do |tab_name| -%>
  19. 69. <script src="js/plugins/<%= tab_name %>.js" type="text/javascript"></script>
  20. 70. <%- end -%>
  21. 71. <!-- end tabs -->
  22. 72.
  23. 73. </head>
  24. 74. <body>
  25. 75. <div class="outer-center" id="tabs_content">
  26. /usr/lib/ruby/vendor_ruby/tilt/template.rb in cached_evaluate
  27. 137. # Redefine itself to use method compilation the next time:
  28. 138. def self.cached_evaluate(scope, locals, &block)
  29. 139. method = compiled_method(locals.keys)
  30. 140. method.bind(scope).call(locals, &block)
  31. 141. end
  32. 142.
  33. 143. # Use instance_eval the first time:
  34. 144. evaluate_source(scope, locals, &block)
  35. 145. end
  36. 146.
  37. 147. # Generates all template source by combining the preamble, template, and
  38. 148. # postamble and returns a two-tuple of the form: [source, offset], where
  39. 149. # source is the string containing (Ruby) source code for the template and
  40. 150. # offset is the integer line offset where line reporting should begin.
  41. 151. #
  42. /usr/lib/ruby/vendor_ruby/tilt/template.rb in evaluate
  43. 120. compile!
  44. 121. else
  45. 122. raise NotImplementedError
  46. 123. end
  47. 124. end
  48. 125.
  49. 126. def evaluate(scope, locals, &block)
  50. 127. cached_evaluate(scope, locals, &block)
  51. 128. end
  52. 129.
  53. 130. # Process the template and return the result. The first time this
  54. 131. # method is called, the template source is evaluated with instance_eval.
  55. 132. # On the sequential method calls it will compile the template to an
  56. 133. # unbound method which will lead to better performance. In any case,
  57. 134. # template executation is guaranteed to be performed in the scope object
  58. /usr/lib/ruby/vendor_ruby/tilt/template.rb in render
  59. 69. prepare
  60. 70. end
  61. 71.
  62. 72. # Render the template in the given scope with the locals specified. If a
  63. 73. # block is given, it is typically available within the template via
  64. 74. # +yield+.
  65. 75. def render(scope=Object.new, locals={}, &block)
  66. 76. evaluate scope, locals || {}, &block
  67. 77. end
  68. 78.
  69. 79. # The basename of the template file.
  70. 80. def basename(suffix='')
  71. 81. File.basename(file, suffix) if file
  72. 82. end
  73. 83.
  74. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in render
  75. 556. layout_engine = options.delete(:layout_engine) || engine
  76. 557. scope = options.delete(:scope) || self
  77. 558.
  78. 559. # compile and render template
  79. 560. layout_was = @default_layout
  80. 561. @default_layout = false
  81. 562. template = compile_template(engine, data, options, views)
  82. 563. output = template.render(scope, locals, &block)
  83. 564. @default_layout = layout_was
  84. 565.
  85. 566. # render layout
  86. 567. if layout
  87. 568. options = options.merge(:views => views, :layout => false, :eat_errors => eat_errors, :scope => scope)
  88. 569. catch(:layout_missing) { return render(layout_engine, layout, options, locals) { output } }
  89. 570. end
  90. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in erb
  91. 448. # :views Views directory to use.
  92. 449. module Templates
  93. 450. module ContentTyped
  94. 451. attr_accessor :content_type
  95. 452. end
  96. 453.
  97. 454. def erb(template, options={}, locals={})
  98. 455. render :erb, template, options, locals
  99. 456. end
  100. 457.
  101. 458. def erubis(template, options={}, locals={})
  102. 459. render :erubis, template, options, locals
  103. 460. end
  104. 461.
  105. 462. def haml(template, options={}, locals={})
  106. /usr/share/opennebula/sunstone/sunstone-server.rb in GET /
  107. 255. response.set_cookie("one-user_id",
  108. 256. :value=>"#{session[:user_id]}",
  109. 257. :expires=>time)
  110. 258. response.set_cookie("one-user_gid",
  111. 259. :value=>"#{session[:user_gid]}",
  112. 260. :expires=>time)
  113. 261.
  114. 262. erb :index
  115. 263. end
  116. 264.
  117. 265. get '/login' do
  118. 266. content_type 'text/html', :charset => 'utf-8'
  119. 267. if !authorized?
  120. 268. erb :login
  121. 269. end
  122. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call
  123. 1144. define_method(method_name, &block)
  124. 1145. unbound_method = instance_method method_name
  125. 1146. pattern, keys = compile(path)
  126. 1147. conditions, @conditions = @conditions, []
  127. 1148. remove_method method_name
  128. 1149.
  129. 1150. [ block.arity != 0 ?
  130. 1151. proc { unbound_method.bind(self).call(*@block_params) } :
  131. 1152. proc { unbound_method.bind(self).call },
  132. 1153. pattern, keys, conditions ]
  133. 1154. end
  134. 1155.
  135. 1156. def compile(path)
  136. 1157. keys = []
  137. 1158. if path.respond_to? :to_str
  138. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in compile!
  139. 1144. define_method(method_name, &block)
  140. 1145. unbound_method = instance_method method_name
  141. 1146. pattern, keys = compile(path)
  142. 1147. conditions, @conditions = @conditions, []
  143. 1148. remove_method method_name
  144. 1149.
  145. 1150. [ block.arity != 0 ?
  146. 1151. proc { unbound_method.bind(self).call(*@block_params) } :
  147. 1152. proc { unbound_method.bind(self).call },
  148. 1153. pattern, keys, conditions ]
  149. 1154. end
  150. 1155.
  151. 1156. def compile(path)
  152. 1157. keys = []
  153. 1158. if path.respond_to? :to_str
  154. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in instance_eval
  155. 717.
  156. 718. route_eval(&pass_block) if pass_block
  157. 719. route_missing
  158. 720. end
  159. 721.
  160. 722. # Run a route block and throw :halt with the result.
  161. 723. def route_eval(&block)
  162. 724. throw :halt, instance_eval(&block)
  163. 725. end
  164. 726.
  165. 727. # If the current request matches pattern and conditions, fill params
  166. 728. # with keys and call the given block.
  167. 729. # Revert params afterwards.
  168. 730. #
  169. 731. # Returns pass block.
  170. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in route_eval
  171. 717.
  172. 718. route_eval(&pass_block) if pass_block
  173. 719. route_missing
  174. 720. end
  175. 721.
  176. 722. # Run a route block and throw :halt with the result.
  177. 723. def route_eval(&block)
  178. 724. throw :halt, instance_eval(&block)
  179. 725. end
  180. 726.
  181. 727. # If the current request matches pattern and conditions, fill params
  182. 728. # with keys and call the given block.
  183. 729. # Revert params afterwards.
  184. 730. #
  185. 731. # Returns pass block.
  186. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in route!
  187. 701. end
  188. 702.
  189. 703. # Run routes defined on the class and all superclasses.
  190. 704. def route!(base = settings, pass_block=nil)
  191. 705. if routes = base.routes[@request.request_method]
  192. 706. routes.each do |pattern, keys, conditions, block|
  193. 707. pass_block = process_route(pattern, keys, conditions) do
  194. 708. route_eval(&block)
  195. 709. end
  196. 710. end
  197. 711. end
  198. 712.
  199. 713. # Run routes defined in superclass.
  200. 714. if base.superclass.respond_to?(:routes)
  201. 715. return route!(base.superclass, pass_block)
  202. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in process_route
  203. 751. {}
  204. 752. end
  205. 753. @params = @original_params.merge(params)
  206. 754. @block_params = values
  207. 755. catch(:pass) do
  208. 756. conditions.each { |cond|
  209. 757. throw :pass if instance_eval(&cond) == false }
  210. 758. yield
  211. 759. end
  212. 760. end
  213. 761. ensure
  214. 762. @params = @original_params
  215. 763. end
  216. 764.
  217. 765. # No matching route was found or all routes passed. The default
  218. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in catch
  219. 748. elsif values.any?
  220. 749. {'captures' => values}
  221. 750. else
  222. 751. {}
  223. 752. end
  224. 753. @params = @original_params.merge(params)
  225. 754. @block_params = values
  226. 755. catch(:pass) do
  227. 756. conditions.each { |cond|
  228. 757. throw :pass if instance_eval(&cond) == false }
  229. 758. yield
  230. 759. end
  231. 760. end
  232. 761. ensure
  233. 762. @params = @original_params
  234. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in process_route
  235. 748. elsif values.any?
  236. 749. {'captures' => values}
  237. 750. else
  238. 751. {}
  239. 752. end
  240. 753. @params = @original_params.merge(params)
  241. 754. @block_params = values
  242. 755. catch(:pass) do
  243. 756. conditions.each { |cond|
  244. 757. throw :pass if instance_eval(&cond) == false }
  245. 758. yield
  246. 759. end
  247. 760. end
  248. 761. ensure
  249. 762. @params = @original_params
  250. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in route!
  251. 700. base.filters[type].each { |block| instance_eval(&block) }
  252. 701. end
  253. 702.
  254. 703. # Run routes defined on the class and all superclasses.
  255. 704. def route!(base = settings, pass_block=nil)
  256. 705. if routes = base.routes[@request.request_method]
  257. 706. routes.each do |pattern, keys, conditions, block|
  258. 707. pass_block = process_route(pattern, keys, conditions) do
  259. 708. route_eval(&block)
  260. 709. end
  261. 710. end
  262. 711. end
  263. 712.
  264. 713. # Run routes defined in superclass.
  265. 714. if base.superclass.respond_to?(:routes)
  266. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in each
  267. 699. filter! type, base.superclass if base.superclass.respond_to?(:filters)
  268. 700. base.filters[type].each { |block| instance_eval(&block) }
  269. 701. end
  270. 702.
  271. 703. # Run routes defined on the class and all superclasses.
  272. 704. def route!(base = settings, pass_block=nil)
  273. 705. if routes = base.routes[@request.request_method]
  274. 706. routes.each do |pattern, keys, conditions, block|
  275. 707. pass_block = process_route(pattern, keys, conditions) do
  276. 708. route_eval(&block)
  277. 709. end
  278. 710. end
  279. 711. end
  280. 712.
  281. 713. # Run routes defined in superclass.
  282. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in route!
  283. 699. filter! type, base.superclass if base.superclass.respond_to?(:filters)
  284. 700. base.filters[type].each { |block| instance_eval(&block) }
  285. 701. end
  286. 702.
  287. 703. # Run routes defined on the class and all superclasses.
  288. 704. def route!(base = settings, pass_block=nil)
  289. 705. if routes = base.routes[@request.request_method]
  290. 706. routes.each do |pattern, keys, conditions, block|
  291. 707. pass_block = process_route(pattern, keys, conditions) do
  292. 708. route_eval(&block)
  293. 709. end
  294. 710. end
  295. 711. end
  296. 712.
  297. 713. # Run routes defined in superclass.
  298. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in dispatch!
  299. 836. res
  300. 837. end
  301. 838.
  302. 839. # Dispatch a request with error handling.
  303. 840. def dispatch!
  304. 841. static! if settings.static? && (request.get? || request.head?)
  305. 842. filter! :before
  306. 843. route!
  307. 844. rescue NotFound => boom
  308. 845. handle_not_found!(boom)
  309. 846. rescue ::Exception => boom
  310. 847. handle_exception!(boom)
  311. 848. ensure
  312. 849. filter! :after unless env['sinatra.static_file']
  313. 850. end
  314. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call!
  315. 637. @response = Response.new
  316. 638. @params = indifferent_params(@request.params)
  317. 639. template_cache.clear if settings.reload_templates
  318. 640. force_encoding(@request.route)
  319. 641. force_encoding(@params)
  320. 642.
  321. 643. @response['Content-Type'] = nil
  322. 644. invoke { dispatch! }
  323. 645. invoke { error_block!(response.status) }
  324. 646. unless @response['Content-Type']
  325. 647. if body.respond_to?(:to_ary) and body.first.respond_to? :content_type
  326. 648. content_type body.first.content_type
  327. 649. else
  328. 650. content_type :html
  329. 651. end
  330. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in instance_eval
  331. 801. # Creates a Hash with indifferent access.
  332. 802. def indifferent_hash
  333. 803. Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
  334. 804. end
  335. 805.
  336. 806. # Run the block with 'throw :halt' support and apply result to the response.
  337. 807. def invoke(&block)
  338. 808. res = catch(:halt) { instance_eval(&block) }
  339. 809. return if res.nil?
  340. 810.
  341. 811. case
  342. 812. when res.respond_to?(:to_str)
  343. 813. @response.body = [res]
  344. 814. when res.respond_to?(:to_ary)
  345. 815. res = res.to_ary
  346. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in invoke
  347. 801. # Creates a Hash with indifferent access.
  348. 802. def indifferent_hash
  349. 803. Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
  350. 804. end
  351. 805.
  352. 806. # Run the block with 'throw :halt' support and apply result to the response.
  353. 807. def invoke(&block)
  354. 808. res = catch(:halt) { instance_eval(&block) }
  355. 809. return if res.nil?
  356. 810.
  357. 811. case
  358. 812. when res.respond_to?(:to_str)
  359. 813. @response.body = [res]
  360. 814. when res.respond_to?(:to_ary)
  361. 815. res = res.to_ary
  362. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in catch
  363. 801. # Creates a Hash with indifferent access.
  364. 802. def indifferent_hash
  365. 803. Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
  366. 804. end
  367. 805.
  368. 806. # Run the block with 'throw :halt' support and apply result to the response.
  369. 807. def invoke(&block)
  370. 808. res = catch(:halt) { instance_eval(&block) }
  371. 809. return if res.nil?
  372. 810.
  373. 811. case
  374. 812. when res.respond_to?(:to_str)
  375. 813. @response.body = [res]
  376. 814. when res.respond_to?(:to_ary)
  377. 815. res = res.to_ary
  378. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in invoke
  379. 801. # Creates a Hash with indifferent access.
  380. 802. def indifferent_hash
  381. 803. Hash.new {|hash,key| hash[key.to_s] if Symbol === key }
  382. 804. end
  383. 805.
  384. 806. # Run the block with 'throw :halt' support and apply result to the response.
  385. 807. def invoke(&block)
  386. 808. res = catch(:halt) { instance_eval(&block) }
  387. 809. return if res.nil?
  388. 810.
  389. 811. case
  390. 812. when res.respond_to?(:to_str)
  391. 813. @response.body = [res]
  392. 814. when res.respond_to?(:to_ary)
  393. 815. res = res.to_ary
  394. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call!
  395. 637. @response = Response.new
  396. 638. @params = indifferent_params(@request.params)
  397. 639. template_cache.clear if settings.reload_templates
  398. 640. force_encoding(@request.route)
  399. 641. force_encoding(@params)
  400. 642.
  401. 643. @response['Content-Type'] = nil
  402. 644. invoke { dispatch! }
  403. 645. invoke { error_block!(response.status) }
  404. 646. unless @response['Content-Type']
  405. 647. if body.respond_to?(:to_ary) and body.first.respond_to? :content_type
  406. 648. content_type body.first.content_type
  407. 649. else
  408. 650. content_type :html
  409. 651. end
  410. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call
  411. 622. @app = app
  412. 623. @template_cache = Tilt::Cache.new
  413. 624. yield self if block_given?
  414. 625. end
  415. 626.
  416. 627. # Rack call interface.
  417. 628. def call(env)
  418. 629. dup.call!(env)
  419. 630. end
  420. 631.
  421. 632. attr_accessor :env, :request, :response, :params
  422. 633.
  423. 634. def call!(env) # :nodoc:
  424. 635. @env = env
  425. 636. @request = Request.new(env)
  426. /usr/lib/ruby/vendor_ruby/rack/commonlogger.rb in call
  427. 13. def initialize(app, logger=nil)
  428. 14. @app = app
  429. 15. @logger = logger
  430. 16. end
  431. 17.
  432. 18. def call(env)
  433. 19. began_at = Time.now
  434. 20. status, header, body = @app.call(env)
  435. 21. header = Utils::HeaderHash.new(header)
  436. 22. body = BodyProxy.new(body) { log(env, status, header, began_at) }
  437. 23. [status, header, body]
  438. 24. end
  439. 25.
  440. 26. private
  441. 27.
  442. /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb in context
  443. 188.
  444. 189. def call(env)
  445. 190. context(env)
  446. 191. end
  447. 192.
  448. 193. def context(env, app=@app)
  449. 194. prepare_session(env)
  450. 195. status, headers, body = app.call(env)
  451. 196. commit_session(env, status, headers, body)
  452. 197. end
  453. 198.
  454. 199. private
  455. 200.
  456. 201. def initialize_sid
  457. 202. @sidbits = @default_options[:sidbits]
  458. /usr/lib/ruby/vendor_ruby/rack/session/abstract/id.rb in call
  459. 183. @default_options = self.class::DEFAULT_OPTIONS.merge(options)
  460. 184. @key = options[:key] || "rack.session"
  461. 185. @cookie_only = @default_options.delete(:cookie_only)
  462. 186. initialize_sid
  463. 187. end
  464. 188.
  465. 189. def call(env)
  466. 190. context(env)
  467. 191. end
  468. 192.
  469. 193. def context(env, app=@app)
  470. 194. prepare_session(env)
  471. 195. status, headers, body = app.call(env)
  472. 196. commit_session(env, status, headers, body)
  473. 197. end
  474. /usr/lib/ruby/vendor_ruby/rack/head.rb in call
  475. 2.
  476. 3. class Head
  477. 4. def initialize(app)
  478. 5. @app = app
  479. 6. end
  480. 7.
  481. 8. def call(env)
  482. 9. status, headers, body = @app.call(env)
  483. 10.
  484. 11. if env["REQUEST_METHOD"] == "HEAD"
  485. 12. [status, headers, []]
  486. 13. else
  487. 14. [status, headers, body]
  488. 15. end
  489. 16. end
  490. /usr/lib/ruby/vendor_ruby/sinatra/showexceptions.rb in call
  491. 14.
  492. 15. def initialize(app)
  493. 16. @app = app
  494. 17. @template = ERB.new(TEMPLATE)
  495. 18. end
  496. 19.
  497. 20. def call(env)
  498. 21. @app.call(env)
  499. 22. rescue Exception => e
  500. 23. errors, env["rack.errors"] = env["rack.errors"], @@eats_errors
  501. 24.
  502. 25. if respond_to?(:prefers_plain_text?) and prefers_plain_text?(env)
  503. 26. content_type = "text/plain"
  504. 27. body = [dump_exception(e)]
  505. 28. else
  506. /usr/lib/ruby/vendor_ruby/rack/methodoverride.rb in call
  507. 17. method = method.to_s.upcase
  508. 18. if HTTP_METHODS.include?(method)
  509. 19. env["rack.methodoverride.original_method"] = env["REQUEST_METHOD"]
  510. 20. env["REQUEST_METHOD"] = method
  511. 21. end
  512. 22. end
  513. 23.
  514. 24. @app.call(env)
  515. 25. end
  516. 26. end
  517. 27. end
  518. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call
  519. 1265. setup_sessions builder
  520. 1266. middleware.each { |c,a,b| builder.use(c, *a, &b) }
  521. 1267. builder.run new!(*args, &bk)
  522. 1268. builder
  523. 1269. end
  524. 1270.
  525. 1271. def call(env)
  526. 1272. synchronize { prototype.call(env) }
  527. 1273. end
  528. 1274.
  529. 1275. private
  530. 1276. def setup_sessions(builder)
  531. 1277. return unless sessions?
  532. 1278. builder.use Rack::Session::Cookie, :secret => session_secret
  533. 1279. end
  534. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in synchronize
  535. 1296. end
  536. 1297.
  537. 1298. @@mutex = Mutex.new
  538. 1299. def synchronize(&block)
  539. 1300. if lock?
  540. 1301. @@mutex.synchronize(&block)
  541. 1302. else
  542. 1303. yield
  543. 1304. end
  544. 1305. end
  545. 1306.
  546. 1307. def metadef(message, &block)
  547. 1308. (class << self; self; end).
  548. 1309. send :define_method, message, &block
  549. 1310. end
  550. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in call
  551. 1265. setup_sessions builder
  552. 1266. middleware.each { |c,a,b| builder.use(c, *a, &b) }
  553. 1267. builder.run new!(*args, &bk)
  554. 1268. builder
  555. 1269. end
  556. 1270.
  557. 1271. def call(env)
  558. 1272. synchronize { prototype.call(env) }
  559. 1273. end
  560. 1274.
  561. 1275. private
  562. 1276. def setup_sessions(builder)
  563. 1277. return unless sessions?
  564. 1278. builder.use Rack::Session::Cookie, :secret => session_secret
  565. 1279. end
  566. /usr/lib/ruby/vendor_ruby/thin/connection.rb in pre_process
  567. 73.
  568. 74. # When we're under a non-async framework like rails, we can still spawn
  569. 75. # off async responses using the callback info, so there's little point
  570. 76. # in removing this.
  571. 77. response = AsyncResponse
  572. 78. catch(:async) do
  573. 79. # Process the request calling the Rack adapter
  574. 80. response = @app.call(@request.env)
  575. 81. end
  576. 82. response
  577. 83. rescue Exception
  578. 84. handle_error
  579. 85. terminate_request
  580. 86. nil # Signal to post_process that the request could not be processed
  581. 87. end
  582. /usr/lib/ruby/vendor_ruby/thin/connection.rb in catch
  583. 71. end
  584. 72. end
  585. 73.
  586. 74. # When we're under a non-async framework like rails, we can still spawn
  587. 75. # off async responses using the callback info, so there's little point
  588. 76. # in removing this.
  589. 77. response = AsyncResponse
  590. 78. catch(:async) do
  591. 79. # Process the request calling the Rack adapter
  592. 80. response = @app.call(@request.env)
  593. 81. end
  594. 82. response
  595. 83. rescue Exception
  596. 84. handle_error
  597. 85. terminate_request
  598. /usr/lib/ruby/vendor_ruby/thin/connection.rb in pre_process
  599. 71. end
  600. 72. end
  601. 73.
  602. 74. # When we're under a non-async framework like rails, we can still spawn
  603. 75. # off async responses using the callback info, so there's little point
  604. 76. # in removing this.
  605. 77. response = AsyncResponse
  606. 78. catch(:async) do
  607. 79. # Process the request calling the Rack adapter
  608. 80. response = @app.call(@request.env)
  609. 81. end
  610. 82. response
  611. 83. rescue Exception
  612. 84. handle_error
  613. 85. terminate_request
  614. /usr/lib/ruby/vendor_ruby/thin/connection.rb in process
  615. 46. # is ready to be processed.
  616. 47. def process
  617. 48. if threaded?
  618. 49. @request.threaded = true
  619. 50. EventMachine.defer(method(:pre_process), method(:post_process))
  620. 51. else
  621. 52. @request.threaded = false
  622. 53. post_process(pre_process)
  623. 54. end
  624. 55. end
  625. 56.
  626. 57. def pre_process
  627. 58. # Add client info to the request env
  628. 59. @request.remote_address = remote_address
  629. 60.
  630. /usr/lib/ruby/vendor_ruby/thin/connection.rb in receive_data
  631. 31. @request = Request.new
  632. 32. @response = Response.new
  633. 33. end
  634. 34.
  635. 35. # Called when data is received from the client.
  636. 36. def receive_data(data)
  637. 37. trace { data }
  638. 38. process if @request.parse(data)
  639. 39. rescue InvalidRequest => e
  640. 40. log "!! Invalid request"
  641. 41. log_error e
  642. 42. close_connection
  643. 43. end
  644. 44.
  645. 45. # Called when all data was received and the request
  646. /usr/lib/ruby/vendor_ruby/eventmachine.rb in run_machine
  647. 250. @reactor_running = true
  648. 251. initialize_event_machine
  649. 252. (b = blk || block) and add_timer(0, b)
  650. 253. if @next_tick_queue && !@next_tick_queue.empty?
  651. 254. add_timer(0) { signal_loopbreak }
  652. 255. end
  653. 256. @reactor_thread = Thread.current
  654. 257. run_machine
  655. 258. ensure
  656. 259. until @tails.empty?
  657. 260. @tails.pop.call
  658. 261. end
  659. 262.
  660. 263. begin
  661. 264. release_machine
  662. /usr/lib/ruby/vendor_ruby/eventmachine.rb in run
  663. 250. @reactor_running = true
  664. 251. initialize_event_machine
  665. 252. (b = blk || block) and add_timer(0, b)
  666. 253. if @next_tick_queue && !@next_tick_queue.empty?
  667. 254. add_timer(0) { signal_loopbreak }
  668. 255. end
  669. 256. @reactor_thread = Thread.current
  670. 257. run_machine
  671. 258. ensure
  672. 259. until @tails.empty?
  673. 260. @tails.pop.call
  674. 261. end
  675. 262.
  676. 263. begin
  677. 264. release_machine
  678. /usr/lib/ruby/vendor_ruby/thin/backends/base.rb in start
  679. 54. @running = true
  680. 55. end
  681. 56.
  682. 57. # Allow for early run up of eventmachine.
  683. 58. if EventMachine.reactor_running?
  684. 59. starter.call
  685. 60. else
  686. 61. EventMachine.run(&starter)
  687. 62. end
  688. 63. end
  689. 64.
  690. 65. # Stop of the backend from accepting new connections.
  691. 66. def stop
  692. 67. @running = false
  693. 68. @stopping = true
  694. /usr/lib/ruby/vendor_ruby/thin/server.rb in start
  695. 152. log ">> Thin web server (v#{VERSION::STRING} codename #{VERSION::CODENAME})"
  696. 153. debug ">> Debugging ON"
  697. 154. trace ">> Tracing ON"
  698. 155.
  699. 156. log ">> Maximum connections set to #{@backend.maximum_connections}"
  700. 157. log ">> Listening on #{@backend}, CTRL+C to stop"
  701. 158.
  702. 159. @backend.start
  703. 160. end
  704. 161. alias :start! :start
  705. 162.
  706. 163. # == Gracefull shutdown
  707. 164. # Stops the server after processing all current connections.
  708. 165. # As soon as this method is called, the server stops accepting
  709. 166. # new requests and wait for all current connections to finish.
  710. /usr/lib/ruby/vendor_ruby/rack/handler/thin.rb in run
  711. 6. module Handler
  712. 7. class Thin
  713. 8. def self.run(app, options={})
  714. 9. server = ::Thin::Server.new(options[:Host] || '0.0.0.0',
  715. 10. options[:Port] || 8080,
  716. 11. app)
  717. 12. yield server if block_given?
  718. 13. server.start
  719. 14. end
  720. 15.
  721. 16. def self.valid_options
  722. 17. {
  723. 18. "Host=HOST" => "Hostname to listen on (default: localhost)",
  724. 19. "Port=PORT" => "Port to listen on (default: 8080)",
  725. 20. }
  726. /usr/lib/ruby/vendor_ruby/sinatra/base.rb in run!
  727. 1227. # Thin, Mongrel or WEBrick (in that order)
  728. 1228. def run!(options={})
  729. 1229. set options
  730. 1230. handler = detect_rack_handler
  731. 1231. handler_name = handler.name.gsub(/.*::/, '')
  732. 1232. puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
  733. 1233. "on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
  734. 1234. handler.run self, :Host => bind, :Port => port do |server|
  735. 1235. [:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
  736. 1236. set :running, true
  737. 1237. end
  738. 1238. rescue Errno::EADDRINUSE => e
  739. 1239. puts "== Someone is already performing on port #{port}!"
  740. 1240. end
  741. 1241.
  742. /usr/share/opennebula/sunstone/sunstone-server.rb in nil
  743. 430. ##############################################################################
  744. 431. post '/:resource/:id/action' do
  745. 432. @SunstoneServer.perform_action(params[:resource],
  746. 433. params[:id],
  747. 434. request.body.read)
  748. 435. end
  749. 436.
  750. 437. Sinatra::Application.run! if(!defined?(WITH_RACKUP))
  751. 438.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement