{"action":"created","issue":{"url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/322","repository_url":"https://api.github.com/repos/martinisoft/chef-rvm","labels_url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/322/labels{/name}","comments_url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/322/comments","events_url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/322/events","html_url":"https://github.com/martinisoft/chef-rvm/issues/322","id":60595832,"number":322,"title":"NoMethodError: undefined method `chomp' for nil:NilClass","user":{"login":"jakubmal","id":645127,"avatar_url":"https://avatars.githubusercontent.com/u/645127?v=3","gravatar_id":"","url":"https://api.github.com/users/jakubmal","html_url":"https://github.com/jakubmal","followers_url":"https://api.github.com/users/jakubmal/followers","following_url":"https://api.github.com/users/jakubmal/following{/other_user}","gists_url":"https://api.github.com/users/jakubmal/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubmal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubmal/subscriptions","organizations_url":"https://api.github.com/users/jakubmal/orgs","repos_url":"https://api.github.com/users/jakubmal/repos","events_url":"https://api.github.com/users/jakubmal/events{/privacy}","received_events_url":"https://api.github.com/users/jakubmal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2015-03-11T01:16:26Z","updated_at":"2016-09-07T07:21:52Z","closed_at":null,"body":"Hi,\r\nFirst of all - thanks for all the hard work you put into this.\r\nI'm running chef-rvm (master) with Chef-Solo, with this node config (irrelevant parts omitted):\r\n```\r\n{\r\n  \"run_list\": [\r\n    \"recipe[apt]\",\r\n    \"recipe[git]\",\r\n    \"recipe[rvm::user]\",\r\n  ],\r\n  \"rvm\": {\r\n    \"version\": \"1.26.10\",\r\n    \"gpg\": {},\r\n    \"user_installs\": [{\r\n      \"user\": \"app\",\r\n      \"install_rubies\": true,\r\n      \"default_ruby\": \"ruby-2.1.5\",\r\n      \"rubies\": [\"ruby-2.1.5\"]\r\n    }]\r\n  },\r\n```\r\n\r\nStacktrace:\r\n```\r\n    /root/chef-solo/cookbooks-2/rvm/libraries/chef_rvm_string_cache.rb:80:in `canonical_ruby_string'\r\n    /root/chef-solo/cookbooks-2/rvm/libraries/chef_rvm_string_cache.rb:50:in `fetch'\r\n    /root/chef-solo/cookbooks-2/rvm/libraries/chef_rvm_string_helpers.rb:55:in `normalize_ruby_string'\r\n    /root/chef-solo/cookbooks-2/rvm/providers/ruby.rb:26:in `load_current_resource'\r\n```\r\n\r\nIn this line:\r\n```result = stdout.read.split('\\n').first.chomp```\r\n`stdout.read` returns empty string and hance we get the error\r\n\r\nThe shell command which returns this empty string is:\r\n```source /home/app/.rvm/scripts/rvm && rvm_ruby_string='ruby-2.1.5' && __rvm_ruby_string && echo $rvm_ruby_string```\r\n\r\nThere is no directory ```/home/app/.rvm``` at this point.\r\n\r\nIn one of issues you guys suggested that user might not be created at this point, but lack of the user is not the problem here, because I checked and the user is there.\r\n\r\nDunno if it's related but at first I misconfigured chef-rvm, and node['rvm']['user_installs'] was an empty array or nil - I can't quite remember right now - but there were no errors at the time."},"comment":{"url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/comments/245196821","html_url":"https://github.com/martinisoft/chef-rvm/issues/322#issuecomment-245196821","issue_url":"https://api.github.com/repos/martinisoft/chef-rvm/issues/322","id":245196821,"user":{"login":"zl4bv","id":2031949,"avatar_url":"https://avatars.githubusercontent.com/u/2031949?v=3","gravatar_id":"","url":"https://api.github.com/users/zl4bv","html_url":"https://github.com/zl4bv","followers_url":"https://api.github.com/users/zl4bv/followers","following_url":"https://api.github.com/users/zl4bv/following{/other_user}","gists_url":"https://api.github.com/users/zl4bv/gists{/gist_id}","starred_url":"https://api.github.com/users/zl4bv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zl4bv/subscriptions","organizations_url":"https://api.github.com/users/zl4bv/orgs","repos_url":"https://api.github.com/users/zl4bv/repos","events_url":"https://api.github.com/users/zl4bv/events{/privacy}","received_events_url":"https://api.github.com/users/zl4bv/received_events","type":"User","site_admin":false},"created_at":"2016-09-07T07:21:52Z","updated_at":"2016-09-07T07:21:52Z","body":"I can replicate this issue right now, even though I've successfully used this cookbook with the same configuration in the past. The key difference between then and now is that https://get.rvm.io is currently refusing connections.\r\n\r\nThe `install_command` defined [here](https://github.com/martinisoft/chef-rvm/blob/v0.9.4/libraries/chef_rvm_recipe_helpers.rb#L73) exits with status code 0 even though the command didn't finish as expected - so the `execute` resource reports success.\r\n\r\n```\r\n         * execute[install system-wide RVM] action run[2016-09-07T06:50:53+00:00] INFO: Processing execute[install system-wide RVM] action run (rvm::system_install line 76)\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Resources for generic execute resource enabled on node include: [Chef::Resource::Execute]\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Resource for execute is Chef::Resource::Execute\r\n       [2016-09-07T06:50:53+00:00] INFO: Processing execute[Guard resource] action run (dynamically defined)\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Providers for generic execute resource enabled on node include: [Chef::Provider::Execute]\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Provider for action run on resource execute[Guard resource] is Chef::Provider::Execute\r\n       bash: /etc/profile.d/rvm.sh: No such file or directory\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Providers for generic execute resource enabled on node include: [Chef::Provider::Execute]\r\n       [2016-09-07T06:50:53+00:00] DEBUG: Provider for action run on resource execute[install system-wide RVM] is Chef::Provider::Execute\r\n\r\n           [execute]   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n                                               Dload  Upload   Total   Spent    Left  Speed\r\n  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0curl: (7) Failed to connect to get.rvm.io port 443: Connection refused\r\n       [2016-09-07T06:50:55+00:00] INFO: execute[install system-wide RVM] ran successfully\r\n           - execute curl -L https://get.rvm.io | bash  -s -- --branch stable --version head\r\n         * execute[upgrade system-wide RVM to none] action run[2016-09-07T06:50:55+00:00] INFO: Processing execute[upgrade system-wide RVM to none] action run (rvm::system_install line 115)\r\n        (skipped due to not_if)\r\n       [2016-09-07T06:50:55+00:00] DEBUG: Skipping execute[upgrade system-wide RVM to none] due to not_if ruby block\r\n       Recipe: rvm::system\r\n         * rvm_ruby[ruby-2.3] action install[2016-09-07T06:50:55+00:00] INFO: Processing rvm_ruby[ruby-2.3] action install (rvm::system line 177)\r\n       [2016-09-07T06:50:55+00:00] DEBUG: Providers for generic rvm_ruby resource enabled on node include: [LWRP provider rvm_ruby from cookbook rvm]\r\n       [2016-09-07T06:50:55+00:00] DEBUG: Provider for action install on resource rvm_ruby[ruby-2.3] is LWRP provider rvm_ruby from cookbook rvm\r\n       [2016-09-07T06:50:55+00:00] DEBUG: Fetching canonical RVM string for: ruby-2.3 (system)\r\n\r\n\r\n           ================================================================================\r\n           Error executing action `install` on resource 'rvm_ruby[ruby-2.3]'\r\n           ================================================================================\r\n\r\n           NoMethodError\r\n           -------------\r\n           undefined method `chomp' for nil:NilClass\r\n\r\n           Cookbook Trace:\r\n           ---------------\r\n           /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:77:in `canonical_ruby_string'\r\n           /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:50:in `fetch'\r\n           /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb:55:in `normalize_ruby_string'\r\n           /tmp/kitchen/cache/cookbooks/rvm/providers/ruby.rb:26:in `load_current_resource'\r\n           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'\r\n\r\n           Resource Declaration:\r\n           ---------------------\r\n           # In /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb\r\n\r\n           177:           rvm_ruby ruby do\r\n           178:             patch            ruby_patch\r\n           179:             user             opts[:user]\r\n           180:             rubygems_version ruby_rubygems_version\r\n           181:           end\r\n           182:         end\r\n\r\n           Compiled Resource:\r\n           ------------------\r\n           # Declared in /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb:177:in `block in install_rubies'\r\n\r\n           rvm_ruby(\"ruby-2.3\") do\r\n             action :install\r\n             retries 0\r\n             retry_delay 2\r\n             default_guard_interpreter :default\r\n             declared_type :rvm_ruby\r\n             cookbook_name \"rvm\"\r\n             recipe_name \"system\"\r\n             ruby_string \"ruby-2.3\"\r\n           end\r\n\r\n           Platform:\r\n           ---------\r\n           x86_64-linux\r\n```\r\n\r\nA potential solution is:\r\n\r\n```ruby\r\ninstall_command = \"set -o pipefail; curl -L #{opts[:installer_url]} | bash #{opts[:script_flags]}\"\r\n```"}}
{"actor":{"display_login":"zl4bv"}}