[chef] Re: Re: Using machine_file resource for upload


Chronological Thread 
  • From: Christine Draper < >
  • To:
  • Subject: [chef] Re: Re: Using machine_file resource for upload
  • Date: Wed, 28 Jan 2015 07:23:36 -0600

Here's the info. BTW, I just got started with chef-provisioning a day ago and have managed to provision into Vagrant and AWS. Awesome, even with a few bugs to workaround!

Drivers:
chef-provisioning (0.17)
chef-provisioning-aws (0.1.3)
chef-provisioning-fog (0.11)
chef-provisioning-vagrant (0.8.1)
Note: had to pin net-ssh to 2.9.1 due to issue #263

Resource:
machine_file '/twi/pkg/INT/ypo.tar.gz' do
  machine 'appserver'
  path '/twi/pkg/INT/ypo.tar.gz'
  action :upload
end

Stack trace:
Generated at 2015-01-28 07:14:28 -0600
TypeError: machine_file[/twi/pkg/INT/ypo.tar.gz] (@recipe_files::/home/christine/test/provision/deploy2.rb line 3) had an error: TypeError: no implicit conversion of nil into String
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `stat'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:117:in `set_current'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-scp-1.2.1/lib/net/scp/upload.rb:24:in `upload_start_state'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-scp-1.2.1/lib/net/scp.rb:369:in `block (3 levels) in start_command'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `process'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `block in preprocess'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `each'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `preprocess'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:269:in `wait'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/net-scp-1.2.1/lib/net/scp.rb:284:in `upload!'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.17/lib/chef/provisioning/transport/ssh.rb:123:in `upload_file'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.17/lib/chef/provisioning/machine/basic_machine.rb:69:in `block in upload_file'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/mixin/why_run.rb:52:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/mixin/why_run.rb:52:in `add_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/provider.rb:180:in `converge_by'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.17/lib/chef/provisioning/chef_provider_action_handler.rb:54:in `perform_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.17/lib/chef/provisioning/machine/basic_machine.rb:68:in `upload_file'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-provisioning-0.17/lib/chef/provider/machine_file.rb:33:in `block in <class:MachineFile>'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/provider/lwrp_base.rb:60:in `instance_eval'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/provider/lwrp_base.rb:60:in `recipe_eval_with_update_check'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/provider/lwrp_base.rb:45:in `block in action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/provider.rb:145:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource.rb:582:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/runner.rb:49:in `run_action'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/runner.rb:81:in `block (2 levels) in converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/runner.rb:81:in `each'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/runner.rb:81:in `block in converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/resource_list.rb:83:in `block in execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/resource_collection/resource_list.rb:81:in `execute_each_resource'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/runner.rb:80:in `converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/client.rb:315:in `converge'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/client.rb:400:in `block in run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/client.rb:399:in `catch'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/client.rb:399:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:261:in `block in fork_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:249:in `fork'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:249:in `fork_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:215:in `block in run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/local_mode.rb:38:in `with_server_connectivity'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:201:in `run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/client.rb:355:in `block in interval_run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/client.rb:345:in `loop'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/client.rb:345:in `interval_run_chef_client'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application/client.rb:335:in `run_application'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/lib/chef/application.rb:58:in `run'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.0.3/bin/chef-client:26:in `<top (required)>'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/bin/chef-client:23:in `load'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/bin/chef-client:23:in `<main>'

On Tue, Jan 27, 2015 at 10:36 PM, John Keiser < " target="_blank"> > wrote:
"no implicit conversion of nil into String" is a bug any which way you slice it (even if it's just "bad error message").  Can you post the stacktrace (there should be a line near the end of the error output where it tells you the file the stack trace got written to) and the resource declaration?  The fact that machine succeeds (nice job getting an alternative btw) means machine_file *should* be able to succeed.

The stack trace will probably reveal what version of chef-provisioning (and what driver) you are using, but just in case--what driver are you using and what version of chef-provisioning?  (Obtainable via gem list chef-provisioning.)

Thanks!


On Tue, Jan 27, 2015 at 7:09 PM, Christine Draper < " target="_blank"> > wrote:
Hi,

I am trying to upload a file using chef provisioning machine_file. I am getting the error below. Am I doing something wrong or is there a bug?


The following works OK so I'm not desperate, just curious/keen to learn.

machine 'appserver' do
  files(
        '/twi/pkg/INT/ypo.tar.gz' => '/twi/pkg/INT/ypo.tar.gz',
       )
end

--------------------------------------------------------------------------------

 * machine_file[/twi/pkg/INT/ypo.tar.gz] action upload[2015-01-27T21:05:12-06:00] INFO: Processing machine_file[/twi/pkg/INT/ypo.tar.gz] action upload (@recipe_files::/home/christine/test/provision/deploy.rb line 3)
[2015-01-27T21:05:14-06:00] INFO: Executing sudo ls -d /twi/pkg/INT/ypo.tar.gz on " target="_blank">
[2015-01-27T21:05:17-06:00] INFO: Completed ls -d /twi/pkg/INT/ypo.tar.gz on " target="_blank"> : exit status 0
[2015-01-27T21:05:17-06:00] INFO: Executing sudo md5sum -b /twi/pkg/INT/ypo.tar.gz on " target="_blank">
[2015-01-27T21:05:18-06:00] INFO: Completed md5sum -b /twi/pkg/INT/ypo.tar.gz on " target="_blank"> : exit status 0
       ================================================================================
    Error executing action `upload` on resource 'machine_file[/twi/pkg/INT/ypo.tar.gz]'
    ================================================================================
   
    TypeError
    ---------
    no implicit conversion of nil into String
   
    Resource Declaration:
    ---------------------
    # In /home/christine/test/provision/deploy.rb
   
      3: machine_file '/twi/pkg/INT/ypo.tar.gz' do
      4:  machine 'appserver'
      5:   path '/twi/pkg/INT/ypo.tar.gz'
      6:   action :upload
      7: end
      8:
----------------------------------------------------------------

Regards,
Christine





Archive powered by MHonArc 2.6.16.

§