Sudden error with package_mirror - 'can't convert nil into String'

87 views
Skip to first unread message

bruienne

unread,
Mar 24, 2013, 7:33:43 PM3/24/13
to munkise...@googlegroups.com
I realize that few people are probably using package_mirror to setup Munkiserver mirrors but we have been using it with a number of sites without trouble. Now, however, I am suddenly getting an error 500 with the following error logging:

TypeError in MirrorsController#download

can't convert nil into String

Rails.root: /var/www/html/package_mirror

I'm not an expert Rails debugger but it appears that there's an issue parsing the json that the package_mirror application requests from the master server. I can see that the request for the json is successful as it is sent across the wire, but after that one of the parameters the mirror uses to construct the local filename must somehow be coming up empty, triggering the nil-to-String conversion. I'm attaching the trace log and env dump in hopes that someone else may have a hunch as to where to look.

Env:

GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_CHARSET: "ISO-8859-1,utf-8;q=0.7,*;q=0.3"
HTTP_ACCEPT_ENCODING: "gzip,deflate,sdch"
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8"
HTTP_CACHE_CONTROL: "no-cache"
HTTP_CONNECTION: "keep-alive"
HTTP_DNT: "1"
HTTP_HOST: "munki01"
HTTP_PRAGMA: "no-cache"
HTTP_USER_AGENT: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22"
HTTP_VERSION: "HTTP/1.1"
PATH_INFO: "/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"
QUERY_STRING: ""
REMOTE_ADDR: "10.161.246.178"
REMOTE_HOST: "10.161.246.178"
REQUEST_METHOD: "GET"
REQUEST_PATH: "/"
SCRIPT_NAME: ""
SERVER_NAME: "munki01"
SERVER_PORT: "80"
SERVER_PROTOCOL: "HTTP/1.1"
SERVER_SOFTWARE: "WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)"
action_controller.instance: #<MirrorsController:0x7fdeeabe5520 @_response=#<ActionDispatch::Response:0x7fdeeabe5390 @cache_control={}, @cookie=[], @request=#<ActionDispatch::Request:0x7fdeeabe5458 @env={"rack.request.query_string"=>"", "action_controller.instance"=>#<MirrorsController:0x7fdeeabe5520 ...>, "action_dispatch.cookies"=>{}, "rack.errors"=>#<IO:0x7fdeef84aaa0>, "HTTP_DNT"=>"1", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22", "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.request_parameters"=>{}, "action_dispatch.secret_token"=>"dd0990a10144f35a8e064066b9ca96e878801d2926868ee02810e11c2b7eb5ca18b9c9560a33043b05935e477b3c2ff5c35d481689e3b31202cf7cd21f1766ad", "rack.url_scheme"=>"http", "HTTP_CONNECTION"=>"keep-alive", "HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.3", "HTTP_HOST"=>"munki01", "GATEWAY_INTERFACE"=>"CGI/1.1", "action_dispatch.remote_ip"=>#<ActionDispatch::RemoteIp::RemoteIpGetter:0x7fdeeb2ba8a0 @env={...}, @trusted_proxies=/(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)/i, @check_ip_spoofing=true>, "action_dispatch.show_exceptions"=>true, "rack.version"=>[1, 1], "SERVER_PROTOCOL"=>"HTTP/1.1", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"10.161.246.178", "rack.input"=>#<StringIO:0x7fdeeb39c1d8>, "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)", "SERVER_NAME"=>"munki01", "action_dispatch.request.parameters"=>{"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "action_dispatch.request.content_type"=>nil, "rack.session.options"=>{:httponly=>true, :expire_after=>nil, :domain=>nil, :secure=>false, :id=>nil, :path=>"/"}, "rack.session"=>{}, "rack.multithread"=>false, "rack.run_once"=>false, "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "SERVER_PORT"=>"80", "REQUEST_URI"=>"http://munki01/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "QUERY_STRING"=>"", "PATH_INFO"=>"/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "action_dispatch.request.unsigned_session_cookie"=>{}, "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/", "rack.multiprocess"=>false, "HTTP_PRAGMA"=>"no-cache", "rack.request.query_hash"=>{}, "action_dispatch.request.path_parameters"=>{:controller=>"mirrors", :action=>"download", :id=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "REMOTE_HOST"=>"10.161.246.178", "action_dispatch.request.formats"=>[#<Mime::Type:0x7fdeeb0311b0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">], "action_dispatch.parameter_filter"=>[:password], "HTTP_VERSION"=>"HTTP/1.1", "HTTP_CACHE_CONTROL"=>"no-cache", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, @method="GET", @filtered_parameters={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @request_method="GET", @fullpath="/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg">, @status=200, @length=0, @block=nil, @body=[], @header={}, @etag=nil, @writer=#<Proc:0x00007fdeeb22cb90@/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/http/response.rb:43>, @blank=false, @sending_file=false>, @mirror=#<Mirror shared=true, installer_item_size=461386, autoremove=false, raw_mode_id=1, unit_id=5, updated_at=Tue Jan 29 22:03:08 UTC 2013, icon_id=nil, raw_tags={"installer_item_hash"=>"1a48a34dc7a9bfa415da2acdfd727d4fd80a196587cfb7b6e8cdc47ebfe8ab38"}, environment_id=2, version_tracker_version=nil, package_path=nil, receipts=[{"packageid"=>"com.apple.pkg.HewlettPackardPrinterDrivers", "version"=>"10.6.0.1.1.1238328574"}], installer_choices_xml=nil, postuninstall_script="", uninstall_method="removepackages", display_name="Hewlett-Packard Printer Software", installs=[], package_branch_id=21, uninstaller_item_location="", supported_architectures=[""], unattended_uninstall=false, uninstall_script="", version="10.6.0.1.1.1238328574", use_installer_choices=false, description=nil, installer_item_checksum=nil, minimum_os_version="10.6.8", filename=nil, uninstallable=true, preinstall_script="", postinstall_script="", name="HewlettPackardPrinterDrivers", created_at=Fri Jan 25 04:48:44 UTC 2013, uninstaller_item_size=nil, id=21, force_install_after_date=nil, RestartAction="None", maximum_os_version="", installer_item_location="2013.01.24.2348405023_HewlettPackardPrint2.13.dmg", installer_type="", installed_size=542647, unattended_install=false, package_category_id=nil, preuninstall_script="">, @_params={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @_env={"rack.request.query_string"=>"", "action_controller.instance"=>#<MirrorsController:0x7fdeeabe5520 ...>, "action_dispatch.cookies"=>{}, "rack.errors"=>#<IO:0x7fdeef84aaa0>, "HTTP_DNT"=>"1", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22", "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.request_parameters"=>{}, "action_dispatch.secret_token"=>"dd0990a10144f35a8e064066b9ca96e878801d2926868ee02810e11c2b7eb5ca18b9c9560a33043b05935e477b3c2ff5c35d481689e3b31202cf7cd21f1766ad", "rack.url_scheme"=>"http", "HTTP_CONNECTION"=>"keep-alive", "HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.3", "HTTP_HOST"=>"munki01", "GATEWAY_INTERFACE"=>"CGI/1.1", "action_dispatch.remote_ip"=>#<ActionDispatch::RemoteIp::RemoteIpGetter:0x7fdeeb2ba8a0 @env={...}, @trusted_proxies=/(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)/i, @check_ip_spoofing=true>, "action_dispatch.show_exceptions"=>true, "rack.version"=>[1, 1], "SERVER_PROTOCOL"=>"HTTP/1.1", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"10.161.246.178", "rack.input"=>#<StringIO:0x7fdeeb39c1d8>, "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)", "SERVER_NAME"=>"munki01", "action_dispatch.request.parameters"=>{"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "action_dispatch.request.content_type"=>nil, "rack.session.options"=>{:httponly=>true, :expire_after=>nil, :domain=>nil, :secure=>false, :id=>nil, :path=>"/"}, "rack.session"=>{}, "rack.multithread"=>false, "rack.run_once"=>false, "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "SERVER_PORT"=>"80", "REQUEST_URI"=>"http://munki01/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "QUERY_STRING"=>"", "PATH_INFO"=>"/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "action_dispatch.request.unsigned_session_cookie"=>{}, "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/", "rack.multiprocess"=>false, "HTTP_PRAGMA"=>"no-cache", "rack.request.query_hash"=>{}, "action_dispatch.request.path_parameters"=>{:controller=>"mirrors", :action=>"download", :id=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "REMOTE_HOST"=>"10.161.246.178", "action_dispatch.request.formats"=>[#<Mime::Type:0x7fdeeb0311b0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">], "action_dispatch.parameter_filter"=>[:password], "HTTP_VERSION"=>"HTTP/1.1", "HTTP_CACHE_CONTROL"=>"no-cache", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, @_response_body=nil, @lookup_context=#<ActionView::LookupContext:0x7fdeeabc2818 @view_paths=[#<ActionView::FileSystemResolver:0x7fdeeb30aa08 @cached={}, @path="/var/www/html/package_mirror/app/views">], @details_key=nil, @skip_default_locale=false, @details={:handlers=>[:rhtml, :erb, :rjs, :builder, :rxml], :formats=>[:html], :locale=>[:en, :en]}, @frozen_formats=false>, @_status=200, @_request=#<ActionDispatch::Request:0x7fdeeabe5458 @env={"rack.request.query_string"=>"", "action_controller.instance"=>#<MirrorsController:0x7fdeeabe5520 ...>, "action_dispatch.cookies"=>{}, "rack.errors"=>#<IO:0x7fdeef84aaa0>, "HTTP_DNT"=>"1", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22", "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.request_parameters"=>{}, "action_dispatch.secret_token"=>"dd0990a10144f35a8e064066b9ca96e878801d2926868ee02810e11c2b7eb5ca18b9c9560a33043b05935e477b3c2ff5c35d481689e3b31202cf7cd21f1766ad", "rack.url_scheme"=>"http", "HTTP_CONNECTION"=>"keep-alive", "HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.3", "HTTP_HOST"=>"munki01", "GATEWAY_INTERFACE"=>"CGI/1.1", "action_dispatch.remote_ip"=>#<ActionDispatch::RemoteIp::RemoteIpGetter:0x7fdeeb2ba8a0 @env={...}, @trusted_proxies=/(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)/i, @check_ip_spoofing=true>, "action_dispatch.show_exceptions"=>true, "rack.version"=>[1, 1], "SERVER_PROTOCOL"=>"HTTP/1.1", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"10.161.246.178", "rack.input"=>#<StringIO:0x7fdeeb39c1d8>, "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)", "SERVER_NAME"=>"munki01", "action_dispatch.request.parameters"=>{"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "action_dispatch.request.content_type"=>nil, "rack.session.options"=>{:httponly=>true, :expire_after=>nil, :domain=>nil, :secure=>false, :id=>nil, :path=>"/"}, "rack.session"=>{}, "rack.multithread"=>false, "rack.run_once"=>false, "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "SERVER_PORT"=>"80", "REQUEST_URI"=>"http://munki01/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "QUERY_STRING"=>"", "PATH_INFO"=>"/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "action_dispatch.request.unsigned_session_cookie"=>{}, "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/", "rack.multiprocess"=>false, "HTTP_PRAGMA"=>"no-cache", "rack.request.query_hash"=>{}, "action_dispatch.request.path_parameters"=>{:controller=>"mirrors", :action=>"download", :id=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "REMOTE_HOST"=>"10.161.246.178", "action_dispatch.request.formats"=>[#<Mime::Type:0x7fdeeb0311b0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">], "action_dispatch.parameter_filter"=>[:password], "HTTP_VERSION"=>"HTTP/1.1", "HTTP_CACHE_CONTROL"=>"no-cache", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, @method="GET", @filtered_parameters={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @request_method="GET", @fullpath="/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg">, @view_context_class=nil, @_headers={"Content-Type"=>"text/html"}, @action_has_layout=true, @_action_name="download", @_config=#<OrderedHash {}>>
action_dispatch.cookies: {}
action_dispatch.parameter_filter: [:password]
action_dispatch.remote_ip: #<ActionDispatch::RemoteIp::RemoteIpGetter:0x7fdeeb2ba8a0 @env={"rack.request.query_string"=>"", "action_controller.instance"=>#<MirrorsController:0x7fdeeabe5520 @_response=#<ActionDispatch::Response:0x7fdeeabe5390 @cache_control={}, @cookie=[], @request=#<ActionDispatch::Request:0x7fdeeabe5458 @env={...}, @method="GET", @filtered_parameters={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @request_method="GET", @fullpath="/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg">, @status=200, @length=0, @block=nil, @body=[], @header={}, @etag=nil, @writer=#<Proc:0x00007fdeeb22cb90@/usr/lib/ruby/gems/1.8/gems/actionpack-3.0.10/lib/action_dispatch/http/response.rb:43>, @blank=false, @sending_file=false>, @mirror=#<Mirror shared=true, installer_item_size=461386, autoremove=false, raw_mode_id=1, unit_id=5, updated_at=Tue Jan 29 22:03:08 UTC 2013, icon_id=nil, raw_tags={"installer_item_hash"=>"1a48a34dc7a9bfa415da2acdfd727d4fd80a196587cfb7b6e8cdc47ebfe8ab38"}, environment_id=2, version_tracker_version=nil, package_path=nil, receipts=[{"packageid"=>"com.apple.pkg.HewlettPackardPrinterDrivers", "version"=>"10.6.0.1.1.1238328574"}], installer_choices_xml=nil, postuninstall_script="", uninstall_method="removepackages", display_name="Hewlett-Packard Printer Software", installs=[], package_branch_id=21, uninstaller_item_location="", supported_architectures=[""], unattended_uninstall=false, uninstall_script="", version="10.6.0.1.1.1238328574", use_installer_choices=false, description=nil, installer_item_checksum=nil, minimum_os_version="10.6.8", filename=nil, uninstallable=true, preinstall_script="", postinstall_script="", name="HewlettPackardPrinterDrivers", created_at=Fri Jan 25 04:48:44 UTC 2013, uninstaller_item_size=nil, id=21, force_install_after_date=nil, RestartAction="None", maximum_os_version="", installer_item_location="2013.01.24.2348405023_HewlettPackardPrint2.13.dmg", installer_type="", installed_size=542647, unattended_install=false, package_category_id=nil, preuninstall_script="">, @_params={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @_env={...}, @_response_body=nil, @lookup_context=#<ActionView::LookupContext:0x7fdeeabc2818 @view_paths=[#<ActionView::FileSystemResolver:0x7fdeeb30aa08 @cached={}, @path="/var/www/html/package_mirror/app/views">], @details_key=nil, @skip_default_locale=false, @details={:handlers=>[:rhtml, :erb, :rjs, :builder, :rxml], :formats=>[:html], :locale=>[:en, :en]}, @frozen_formats=false>, @_status=200, @_request=#<ActionDispatch::Request:0x7fdeeabe5458 @env={...}, @method="GET", @filtered_parameters={"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, @request_method="GET", @fullpath="/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg">, @view_context_class=nil, @_headers={"Content-Type"=>"text/html"}, @action_has_layout=true, @_action_name="download", @_config=#<OrderedHash {}>>, "action_dispatch.cookies"=>{}, "rack.errors"=>#<IO:0x7fdeef84aaa0>, "HTTP_DNT"=>"1", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22", "action_dispatch.request.query_parameters"=>{}, "action_dispatch.request.request_parameters"=>{}, "action_dispatch.secret_token"=>"dd0990a10144f35a8e064066b9ca96e878801d2926868ee02810e11c2b7eb5ca18b9c9560a33043b05935e477b3c2ff5c35d481689e3b31202cf7cd21f1766ad", "rack.url_scheme"=>"http", "HTTP_CONNECTION"=>"keep-alive", "HTTP_ACCEPT_CHARSET"=>"ISO-8859-1,utf-8;q=0.7,*;q=0.3", "HTTP_HOST"=>"munki01", "GATEWAY_INTERFACE"=>"CGI/1.1", "action_dispatch.remote_ip"=>#<ActionDispatch::RemoteIp::RemoteIpGetter:0x7fdeeb2ba8a0 ...>, "action_dispatch.show_exceptions"=>true, "rack.version"=>[1, 1], "SERVER_PROTOCOL"=>"HTTP/1.1", "SCRIPT_NAME"=>"", "REMOTE_ADDR"=>"10.161.246.178", "rack.input"=>#<StringIO:0x7fdeeb39c1d8>, "SERVER_SOFTWARE"=>"WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)", "SERVER_NAME"=>"munki01", "action_dispatch.request.parameters"=>{"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "action_dispatch.request.content_type"=>nil, "rack.session.options"=>{:httponly=>true, :expire_after=>nil, :domain=>nil, :secure=>false, :id=>nil, :path=>"/"}, "rack.session"=>{}, "rack.multithread"=>false, "rack.run_once"=>false, "HTTP_ACCEPT_ENCODING"=>"gzip,deflate,sdch", "SERVER_PORT"=>"80", "REQUEST_URI"=>"http://munki01/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "QUERY_STRING"=>"", "PATH_INFO"=>"/pkgs/21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg", "action_dispatch.request.unsigned_session_cookie"=>{}, "HTTP_ACCEPT_LANGUAGE"=>"en-US,en;q=0.8", "REQUEST_METHOD"=>"GET", "REQUEST_PATH"=>"/", "rack.multiprocess"=>false, "HTTP_PRAGMA"=>"no-cache", "rack.request.query_hash"=>{}, "action_dispatch.request.path_parameters"=>{:controller=>"mirrors", :action=>"download", :id=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}, "REMOTE_HOST"=>"10.161.246.178", "action_dispatch.request.formats"=>[#<Mime::Type:0x7fdeeb0311b0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">], "action_dispatch.parameter_filter"=>[:password], "HTTP_VERSION"=>"HTTP/1.1", "HTTP_CACHE_CONTROL"=>"no-cache", "HTTP_ACCEPT"=>"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}, @trusted_proxies=/(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)/i, @check_ip_spoofing=true>
action_dispatch.request.content_type: nil
action_dispatch.request.formats: [#<Mime::Type:0x7fdeeb0311b0 @synonyms=["application/xhtml+xml"], @symbol=:html, @string="text/html">]
action_dispatch.request.parameters: {"action"=>"download", "controller"=>"mirrors", "id"=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}
action_dispatch.request.path_parameters: {:controller=>"mirrors", :action=>"download", :id=>"21-HewlettPackardPrinterDrivers-10.6.0.1.1.1238328574.dmg"}
action_dispatch.request.query_parameters: {}
action_dispatch.request.request_parameters: {}
action_dispatch.request.unsigned_session_cookie: {}
action_dispatch.secret_token: "dd0990a10144f35a8e064066b9ca96e878801d2926868ee02810e11c2b7eb5ca18b9c9560a33043b05935e477b3c2ff5c35d481689e3b31202cf7cd21f1766ad"
action_dispatch.show_exceptions: true
rack.errors: #<IO:0x7fdeef84aaa0>
rack.input: #<StringIO:0x7fdeeb39c1d8>
rack.multiprocess: false
rack.multithread: false
rack.request.query_hash: {}
rack.request.query_string: ""
rack.run_once: false
rack.session: {}
rack.session.options: {:httponly=>true, :expire_after=>nil, :domain=>nil, :secure=>false, :id=>nil, :path=>"/"}
rack.url_scheme: "http"
rack.version: [1, 1]

Framework trace:
/usr/lib/ruby/1.8/pathname.rb:286:in `basename'
/usr/lib/ruby/1.8/pathname.rb:286:in `chop_basename'
/usr/lib/ruby/1.8/pathname.rb:623:in `plus'
/usr/lib/ruby/1.8/pathname.rb:604:in `+'
app/controllers/mirrors_controller.rb:5:in `download'
actionpack (3.0.10) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.10) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.10) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.10) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.10) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.0.10) lib/active_support/callbacks.rb:436:in `_run__1414200939__process_action__609463330__callbacks'
activesupport (3.0.10) lib/active_support/callbacks.rb:410:in `send'
activesupport (3.0.10) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.10) lib/active_support/callbacks.rb:94:in `send'
activesupport (3.0.10) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.10) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.10) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.10) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.0.10) lib/active_support/notifications.rb:52:in `instrument'
activesupport (3.0.10) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.10) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.10) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.0.10) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.10) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.10) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.10) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.10) lib/action_controller/metal.rb:178:in `action'
actionpack (3.0.10) lib/action_dispatch/routing/route_set.rb:62:in `call'
actionpack (3.0.10) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.10) lib/action_dispatch/routing/route_set.rb:27:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.10) lib/action_dispatch/routing/route_set.rb:493:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.5) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.10) lib/active_record/query_cache.rb:32:in `call'
activerecord (3.0.10) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.10) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.10) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.10) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
activesupport (3.0.10) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.10) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.5) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.10) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.5) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.10) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.5) lib/rack/lock.rb:13:in `call'
rack (1.2.5) lib/rack/lock.rb:13:in `synchronize'
rack (1.2.5) lib/rack/lock.rb:13:in `call'
actionpack (3.0.10) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.10) lib/rails/application.rb:168:in `call'
railties (3.0.10) lib/rails/application.rb:77:in `send'
railties (3.0.10) lib/rails/application.rb:77:in `method_missing'
railties (3.0.10) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.5) lib/rack/content_length.rb:13:in `call'
rack (1.2.5) lib/rack/handler/webrick.rb:52:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.2.5) lib/rack/handler/webrick.rb:13:in `run'
rack (1.2.5) lib/rack/server.rb:217:in `start'
railties (3.0.10) lib/rails/commands/server.rb:65:in `start'
railties (3.0.10) lib/rails/commands.rb:30
railties (3.0.10) lib/rails/commands.rb:27:in `tap'
railties (3.0.10) lib/rails/commands.rb:27
script/rails:6:in `require'
script/rails:6

Thanks all.
Pepijn.

bruienne

unread,
Mar 24, 2013, 7:36:03 PM3/24/13
to munkise...@googlegroups.com
I should add the following from the development log as well:

TypeError (can't convert nil into String):
  app/controllers/mirrors_controller.rb:5:in `download'

Thanks,
Pepijn.

Jordan Raine

unread,
Mar 25, 2013, 12:52:20 AM3/25/13
to munkise...@googlegroups.com
Hey Pepijn,
Pull the latest commit and the issue might become more clear. My guess is that you have a package with a nil installer_item_location attribute. Now, you'll see a 404 if that is the case and a message in the log.

Best of luck!

-- 
Jordan Raine

--
You received this message because you are subscribed to the Google Groups "munkiserver-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to munkiserver-d...@googlegroups.com.
To post to this group, send email to munkise...@googlegroups.com.
Visit this group at http://groups.google.com/group/munkiserver-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

bruienne

unread,
Mar 25, 2013, 1:54:40 AM3/25/13
to munkise...@googlegroups.com
Hey Jordan, thanks for that commit, I know the code is pretty bare and all but it's been serving us well. I spent entirely too much time this evening tracking down the issue and it now appears that for whatever reason "Mirror.packages_dir" in app/controllers/mirrors_controller.rb was coming up as nil. When I swapped out the variable that's supposed to come from my settings.yaml file with a hard-coded entry ("/var/www/html/package_mirror/packages/") life was good and the packages downloaded again. I will pull your update later today and also track down why it would suddenly be coming back with nil for the "packages_dir" variable. I'm thinking ownership changes could be at play; if Rails/ruby somehow can't read the file there'd be nothing for that setting it pulls, thus nil.

Thanks,
Pepijn.

Jordan Raine

unread,
Mar 25, 2013, 1:56:00 AM3/25/13
to munkise...@googlegroups.com
Ahh, good find. Should probably be a check at startup to ensure required values are found in the settings file. Maybe I'll add that later.

-- 
Jordan Raine

Steve Brito

unread,
Mar 25, 2013, 8:20:59 PM3/25/13
to munkise...@googlegroups.com
I had a similar issue where the package location would be set to nil, and the controller would spit out an error. What fixed it for me was going into app/controllers/mirrors_controller.rb and modifying this line

  • @mirror = nil#Mirror.get(params[:id])
I removed "nil#" to make it @mirror = Mirror.get(params[:id]) and everything started working.

I opened up the rails console and everytime I typed the original code with an ID I knew(IE - @mirror = nil#Mirror.get(29)) got nil, once I removed "nil#" I was able to pull in the json.

Hope this helps!

-Steve

bruienne

unread,
Mar 26, 2013, 9:59:47 AM3/26/13
to munkise...@googlegroups.com
Steve, thanks for the suggestion. That particular line was never like that in the code as I pulled it from github so I've been using it as you noted in your "after" case. The problem doesn't really seem to be that the JSON isn't being requested and received, it's the fact that the "packages_dir" is not being parsed from the settings.yaml file. To test, I changed "send_file Mirror.packages_dir ..." to "send_file Mirror.path ..." - both of these parameters are in the settings.yaml file. When using "path" everything is fine so my guess based on testing the parts of the code that read the yaml file and parse it is that packages_dir is a Pathname class but somehow is not getting initialized with the contents of the "path" parameter although I am unsure of the exact method with which it does that.

Sample erb output of reading the settings.yaml file:

irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "yaml"
=> true
irb(main):003:0> settings = YAML.load(File.read("package_mirror_dev/config/settings.yaml"))
=> {"master_hostname"=>"http://mymunkiserver:80", "packages_dir"=>#<YAML::Object:0x7fb10060ba68 @class="Pathname", @ivars="">, "path"=>"/var/www/html/package_mirror/packages"}
irb(main):004:0> puts settings["packages_dir"]
#<YAML::Object:0x7f940d065330>
=> nil

Contents of settings.yaml file:

master_hostname: http://mymunkiserver:80
packages_dir: !ruby/object:Pathname 
path: /var/www/html/package_mirror/packages <- verified

Being about as fluent in Ruby as I am in French (not very) I have to guess about the precise issue here, but I'm hoping that someone else can connect some more of the dots here.

Thanks,
Pepijn.

Steve Brito

unread,
Mar 26, 2013, 1:22:57 PM3/26/13
to munkise...@googlegroups.com
Hey Pepijn,

I'm rather new to rails myself as well, but could it be the spacing in your yaml file(assuming what you pasted is exactly whats in that file)?

There is spacing on that last line in the original - https://github.com/jnraine/package_mirror/blob/master/config/settings.yaml

if you are in the rails console within the package mirror root folder what is the output of "Mirror.settings" and "Mirror.package_dir"? That may help you figure out whats going on.

-Steve

bruienne

unread,
Mar 26, 2013, 1:43:53 PM3/26/13
to munkise...@googlegroups.com
>_< You are completely right, I had not noticed that trailing space in the YAML, which is obviously A Bad Thing. It wasn't until I opened it up in Textmate that I saw it, vi is not the greatest for that kind of thing.

TL;DR - Removed trailing space, now it's working. Reviewing my Puppet module to see if I fat-fingered the space there.

Thanks,
Pepijn.
Reply all
Reply to author
Forward
0 new messages