Skip to content

Instantly share code, notes, and snippets.

@xamebax
Last active December 23, 2015 08:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xamebax/6609623 to your computer and use it in GitHub Desktop.
Save xamebax/6609623 to your computer and use it in GitHub Desktop.
require 'json'
def pretty_json(vv, prefix='$')
if vv.is_a?(Array)
vv.each_with_index do |i, v|
pretty_json(v, "#{prefix}[#{i}]")
end
elsif vv.is_a?(Hash)
vv.each do |k, v|
pretty_json(v, "#{prefix}.#{k}")
end
else
p "#{prefix} = #{vv}"
end
end
require 'ridley'
@chef_server = Ridley.new(
server_url: "http://127.0.0.1:4000",
client_name: "marta",
client_key: ::File.join(::File.dirname(__FILE__), 'features/fixtures/stub.pem'))
@cc = @chef_server.node.find('1234')._attributes_.to_hash
pretty_json(@cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment