Using machine_file resource for upload

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 ubuntu@54.200.143.38
    [2015-01-27T21:05:17-06:00] INFO: Completed ls -d /twi/pkg/INT/ypo.tar.gz
    on ubuntu@54.200.143.38: exit status 0
    [2015-01-27T21:05:17-06:00] INFO: Executing sudo md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38
    [2015-01-27T21:05:18-06:00] INFO: Completed md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38: 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

"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 <
christine_draper@thirdwaveinsights.com> 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 ubuntu@54.200.143.38
    [2015-01-27T21:05:17-06:00] INFO: Completed ls -d /twi/pkg/INT/ypo.tar.gz
    on ubuntu@54.200.143.38: exit status 0
    [2015-01-27T21:05:17-06:00] INFO: Executing sudo md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38
    [2015-01-27T21:05:18-06:00] INFO: Completed md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38: 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

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
https://github.com/opscode/chef-provisioning/issues/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 '

On Tue, Jan 27, 2015 at 10:36 PM, John Keiser jkeiser@chef.io 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 <
christine_draper@thirdwaveinsights.com> 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 ubuntu@54.200.143.38
    [2015-01-27T21:05:17-06:00] INFO: Completed ls -d /twi/pkg/INT/ypo.tar.gz
    on ubuntu@54.200.143.38: exit status 0
    [2015-01-27T21:05:17-06:00] INFO: Executing sudo md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38
    [2015-01-27T21:05:18-06:00] INFO: Completed md5sum -b
    /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38: 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

I am having this exact same issue in Mac OS X 10.10.1.

After installing ChefDK 0.3.6 onto a clean system I get the same error when running “chef verify”.

Here’s my chef gem list:

*** LOCAL GEMS ***

activesupport (4.2.0, 3.2.21)
addressable (2.3.6)
akami (1.2.2)
app_conf (0.4.2)
appbundler (0.4.0)
archive (0.0.6)
archive-tar-minitar (0.5.2)
aruba (0.6.2)
ast (2.0.0)
astrolabe (1.3.0)
aws-sdk-v1 (1.61.0)
axiom-types (0.1.1)
azure (0.6.4)
berkshelf (3.2.3)
berkshelf-api-client (1.2.1)
bigdecimal (1.2.4)
buff-config (1.0.1)
buff-extensions (1.0.0)
buff-ignore (1.1.1)
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
builder (3.2.2)
bundler (1.7.5)
cane (2.6.2)
celluloid (0.16.0)
celluloid-io (0.16.1)
CFPropertyList (2.3.0)
chef (12.0.3, 11.18.0)
chef-dk (0.3.6)
chef-provisioning (0.17)
chef-provisioning-aws (0.1.3)
chef-provisioning-azure (0.1)
chef-provisioning-fog (0.11)
chef-provisioning-vagrant (0.8.1)
chef-vault (2.2.4)
chef-zero (3.2.1, 2.2.1, 1.5.6)
cheffish (0.9.1)
chefspec (4.2.0.beta.1)
childprocess (0.5.5)
cleanroom (1.0.0)
codeclimate-test-reporter (0.4.5)
coderay (1.1.0)
coercible (1.0.0)
columnize (0.8.9)
commander (4.2.1)
cookbook-omnifetch (0.2.0)
countloc (0.4.0)
crack (0.4.2)
cucumber (1.3.18)
dep-selector-libgecode (1.0.2)
dep_selector (1.0.3)
descendants_tracker (0.0.4)
diff-lcs (1.2.5)
diffy (3.0.7)
docile (1.1.5)
equalizer (0.0.9)
erubis (2.7.0)
excon (0.43.0)
fakefs (0.6.4)
faraday (0.9.1)
fauxhai (2.2.0)
ffi (1.9.6)
ffi-yajl (1.3.1)
finstyle (1.4.0)
fission (0.5.0)
fog (1.27.0)
fog-atmos (0.1.0)
fog-aws (0.0.6)
fog-brightbox (0.7.1)
fog-core (1.27.3)
fog-ecloud (0.0.2)
fog-json (1.0.0)
fog-profitbricks (0.0.1)
fog-radosgw (0.0.3)
fog-sakuracloud (0.1.2)
fog-serverlove (0.1.1)
fog-softlayer (0.3.30)
fog-storm_on_demand (0.1.0)
fog-terremark (0.0.3)
fog-vmfusion (0.0.1)
fog-voxel (0.0.2)
fog-xml (0.1.1)
foodcritic (4.0.0)
form_data (0.1.0)
formatador (0.2.5)
fuubar (1.3.3)
gherkin (2.12.2)
git (1.2.9.1)
grape (0.10.1)
grape-msgpack (0.1.2)
gssapi (1.0.3)
guard (2.11.1)
guard-compat (1.2.1)
guard-rspec (4.5.0)
gyoku (1.2.2)
hashie (2.1.2)
highline (1.6.21)
hitimes (1.2.2)
http (0.7.1)
http_parser.rb (0.6.0)
httpclient (2.6.0.1, 2.5.3.3)
httpi (0.9.7)
i18n (0.7.0)
ice_nine (0.11.1)
inflecto (0.0.2)
inifile (2.0.2)
io-console (0.4.2)
ipaddress (0.8.0)
json (1.8.2, 1.8.1)
kitchen-vagrant (0.15.0)
knife-container (0.2.4)
knife-spork (1.4.2)
libyajl2 (1.2.0)
listen (2.8.5)
little-plugger (1.1.3)
logging (1.8.2)
lumberjack (1.0.9)
macaddr (1.7.1)
maruku (0.7.2)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.6.2, 0.6.0)
minitar (0.5.4)
minitest (5.5.1, 4.7.5)
mixlib-authentication (1.3.0)
mixlib-cli (1.5.0)
mixlib-config (2.1.0)
mixlib-log (1.6.0)
mixlib-shellout (2.0.1, 1.6.1)
mocha (1.1.0)
moneta (0.6.0)
msgpack (0.5.10)
multi_json (1.10.1)
multi_test (0.1.1)
multi_xml (0.5.5)
multipart-post (2.0.0)
nenv (0.2.0)
net-dhcp (1.3.2)
net-http-persistent (2.9.4)
net-scp (1.2.1)
net-ssh (2.9.2)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0)
nio4r (1.1.0)
nokogiri (1.6.5, 1.6.3.1)
nori (1.1.5)
notiffany (0.0.3)
octokit (3.7.0)
ohai (8.0.1, 8.0.0, 7.4.1)
open4 (1.3.4)
parallel (1.3.3)
parser (2.2.0.2, 2.1.9)
plist (3.1.0)
polyglot (0.3.5)
powerpack (0.0.9)
pry (0.10.1)
psych (2.0.5)
puma (1.6.3)
rack (1.6.0, 1.5.2)
rack-accept (0.4.5)
rack-mount (0.8.3)
rainbow (2.0.0)
rake (10.4.2, 10.1.1, 10.1.0, 0.9.6)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rbx-require-relative (0.0.9)
rdoc (4.1.0)
reel (0.5.0)
rest-client (1.6.7)
retryable (2.0.0)
rhc (1.32.2)
ridley (4.1.2)
rspec (3.1.0, 3.0.0, 2.14.1)
rspec-core (3.1.7, 3.0.4, 2.14.8)
rspec-expectations (3.1.2, 3.0.4, 2.14.5)
rspec-mocks (3.1.3, 3.0.4, 2.14.6)
rspec-support (3.1.2, 3.0.4)
rspec_junit_formatter (0.1.6)
rubocop (0.28.0, 0.18.1)
ruby-progressbar (1.7.1)
ruby-shadow (2.4.1)
ruby_gntp (0.3.4)
rubyntlm (0.1.1)
rufus-lru (1.0.5)
safe_yaml (1.0.4)
savon (0.9.5)
sawyer (0.6.0)
semverse (1.2.1)
shellany (0.0.1)
simplecov (0.9.1)
simplecov-html (0.8.0)
slop (3.6.0)
solve (1.2.1)
spork (0.9.2)
systemu (2.6.4)
test-kitchen (1.3.1)
test-unit (2.1.4.0)
thor (0.19.1)
thread_safe (0.3.4)
timers (4.0.1)
treetop (1.4.15)
tzinfo (1.2.2)
uuid (2.3.7)
uuidtools (2.1.5)
varia_model (0.4.0)
virtus (1.0.4)
wasabi (1.0.0)
webmock (1.20.4)
websocket_parser (0.1.6)
winrm (1.2.0)
wmi-lite (1.0.0)
yajl-ruby (1.2.1)
yard (0.8.7.6)

From: John Keiser <jkeiser@chef.iomailto:jkeiser@chef.io>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, January 27, 2015 at 11:36 PM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Re: Using machine_file resource for upload

“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 <christine_draper@thirdwaveinsights.commailto:christine_draper@thirdwaveinsights.com> 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 ubuntu@54.200.143.38mailto:ubuntu@54.200.143.38
    [2015-01-27T21:05:17-06:00] INFO: Completed ls -d /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38mailto:ubuntu@54.200.143.38: exit status 0
    [2015-01-27T21:05:17-06:00] INFO: Executing sudo md5sum -b /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38mailto:ubuntu@54.200.143.38
    [2015-01-27T21:05:18-06:00] INFO: Completed md5sum -b /twi/pkg/INT/ypo.tar.gz on ubuntu@54.200.143.38mailto:ubuntu@54.200.143.38: 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