Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote_file sftp incorrect documentation #8632

Open
mlnsharma opened this issue Jun 4, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@mlnsharma
Copy link

commented Jun 4, 2019

Description

'remote_file' resource documentation suggested usage is as below:

By using SFTP:
source 'sftp://username:password@remote_host:22/path/to/img/sketch.png'

When using a similar URL with #{hostname}:#{port}, chef-client throws below error:

SocketError
    -----------
    getaddrinfo: Name or service not known

... SocketError: getaddrinfo: Name or service not known
/opt/chef/embedded/lib/ruby/2.5.0/socket.rb:228:in `getaddrinfo'
/opt/chef/embedded/lib/ruby/2.5.0/socket.rb:228:in `foreach'
/opt/chef/embedded/lib/ruby/2.5.0/socket.rb:632:in `tcp'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/session.rb:70:in `initialize'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in `new'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in `start'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-sftp-2.1.2/lib/net/sftp.rb:31:in `start'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/sftp.rb:61:in `sftp'

However, when the port 22 is removed from the sftp url, remote_file performs sftp successfully.

Chef Version

Chef Client 14.10.9

Platform Version

Red Hat 7.4 x86_64

Replication Case

Eg.

sftp_url = "sftp://#{sftp_user}:#{sftp_password}@#{admin_host}#{temp_loc}/#{file_name}"

remote_file temp_loc+'/'+file_name do
	  source  sftp_url
	  owner   user
	  group   group
	  mode 	mode
	  show_progress true
end

Client Output

Refer to ##Description section

Stacktrace

When run through '-l debug' and adding some puts statements,

[2019-06-04T04:35:03-07:00] DEBUG: SocketError: remote_file[xxxxxx] (xxxxx::xxxxx line 33) had an error: SocketError: getaddrinfo: Name or service not known
/opt/chef/embedded/lib/ruby/2.5.0/socket.rb:228:in getaddrinfo' /opt/chef/embedded/lib/ruby/2.5.0/socket.rb:228:in foreach'
/opt/chef/embedded/lib/ruby/2.5.0/socket.rb:632:in tcp' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh/transport/session.rb:70:in initialize'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in new' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-ssh-4.2.0/lib/net/ssh.rb:237:in start'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/net-sftp-2.1.2/lib/net/sftp.rb:31:in start' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/sftp.rb:61:in sftp'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/sftp.rb:98:in get' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/sftp.rb:54:in fetch'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/content.rb:71:in grab_file_from_uri' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/content.rb:56:in try_multiple_sources'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/remote_file/content.rb:41:in file_for_provider' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/file_content_management/content_base.rb:42:in tempfile'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/file.rb:450:in tempfile' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/file.rb:327:in do_generate_content'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider/file.rb:140:in action_create' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/provider.rb:182:in run_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource.rb:578:in run_action' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/runner.rb:70:in run_action'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/runner.rb:98:in block (2 levels) in converge' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/runner.rb:98:in each'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/runner.rb:98:in block in converge' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/resource_list.rb:94:in block in execute_each_resource'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/stepable_iterator.rb:114:in call_iterator_block' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/stepable_iterator.rb:85:in step'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/stepable_iterator.rb:103:in iterate' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/resource_collection/resource_list.rb:92:in execute_each_resource' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/runner.rb:97:in converge'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/client.rb:720:in block in converge' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/client.rb:715:in catch'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/client.rb:715:in converge' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/client.rb:754:in converge_and_save'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/client.rb:286:in run' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/application.rb:303:in run_with_graceful_exit_option'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/application.rb:279:in block in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/local_mode.rb:44:in with_server_connectivity'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/application.rb:261:in run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/application/client.rb:444:in run_application'
/opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/lib/chef/application.rb:66:in run' /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-14.10.9/bin/chef-client:25:in <top (required)>'
/bin/chef-client:74:in load' /bin/chef-client:74:in

'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.