lib/cucumber/chef/handy.rb in cucumber-chef-0.4.2 vs lib/cucumber/chef/handy.rb in cucumber-chef-0.4.4

- old
+ new

@@ -41,11 +41,16 @@ def run_chef(name) container_path = "/var/lib/lxc/#{name}/rootfs" %x[chroot #{container_path} /bin/bash -c 'chef-client > /dev/null 2>&1'] end + def databag_from_file(file) + ::Chef::JSONCompat.from_json(File.read(file)) + end + def upload_databag_item(databag, item) + ::Chef::Config.from_file("/etc/chef/client.rb") databag_item = ::Chef::DataBagItem.new databag_item.data_bag(databag) databag_item.raw_data = item databag_item.save end @@ -75,13 +80,11 @@ %x[lxc-destroy -d -n #{name}] sleep 5 end end - def run_remote_command(remote_server, command) - %x[ssh workstation.testlab 'ssh #{remote_server} #{command}'] - end - - + def run_remote_command(remote_server, command) + %x[ssh workstation.testlab 'ssh #{remote_server} #{command}'] + end end end end