Skip to content

Instantly share code, notes, and snippets.

$ sudo ./run test-tool/libguestfs-test-tool
===== Test starts here =====
LIBGUESTFS_PATH=/home/steven/libguestfs-1.17.32/appliance
LIBGUESTFS_DEBUG=1
TMPDIR=/home/steven/libguestfs-1.17.32
libguestfs: new guestfs handle 0x221cf60
library version: 1.17.32
guestfs_get_append: (null)
guestfs_get_attach_method: appliance
guestfs_get_autosync: 1
@stevendanna
stevendanna / psearch.rb
Created July 9, 2012 17:16
Simple Partial Search Knife Plugin
# psearch.rb: A knife plugin for the Partial Search API
#
# Note that this is a Beta feature of Opscode Hosted Chef
# and that it's interface may changed based on user feedback.
#
# This plugin is net yet officially supported by Opscode
class Psearch < Chef::Knife
banner "knife psearch INDEX SEARCH NAME=DESIRED_KEY_PATH,[NAME=DESIRED_KEY_PATH]"
$ (cat <<'EOP'
{
"normal" : {
"chef_client": {
"server_url": "https://api.opscode.com/organizations/ORGNAME",
"validation_client_name": "ORGNAME-validator"
}
},
"run_list": [
"recipe[chef-client::config]",
@stevendanna
stevendanna / gist:3327498
Created August 11, 2012 21:50
Cool Story.
sdanna@gaius ~/src > rails new foobar
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
sdanna@gaius ~/src > gem list rails
*** LOCAL GEMS ***
@stevendanna
stevendanna / Kitchenfile.rb
Created August 20, 2012 03:00
Openstack Test-kitchen experiment
default_runner "openstack"
openstack do
auth_url "http://REDACTED:5000/v2.0/tokens"
username "steven"
password "REDACTED"
tenant "openstack"
end
cookbook "emacs" do
<% unless @chef_requires.empty? %>
<%= @chef_requires.inspect %>.each do |lib|
begin
require lib
rescue LoadError
Chef::Log.warn "Failed to load #{lib}. This should be resolved after a chef run."
end
end
<% end %>
runit_action = env["runit_enable"]["couchdb"] ? :enable : :disable
runit_service "couchdb" do
action runit_action
end
template "#{couch_etc}/local.ini" do
source "local.ini.erb"
group "root"
owner "root"
variables(:couchdb_listen_port => node[:couchdb][:listen_port],
@stevendanna
stevendanna / gist:4191403
Created December 2, 2012 22:48
Large, distracting error message produced by minitest-handler-cookbook
[ubuntu-10.04] [2012-11-27T21:16:49+00:00] INFO: Processing directory[/var/chef/minitest/test-kitchen] action create (minitest-handler::default line 50)
[ubuntu-10.04] [2012-11-27T21:16:49+00:00] INFO: directory[/var/chef/minitest/test-kitchen] created directory /var/chef/minitest/test-kitchen
[ubuntu-10.04] [2012-11-27T21:16:49+00:00] INFO: Processing cookbook_file[tests-test-kitchen-default] action create (minitest-handler::default line 53)
[ubuntu-10.04] [2012-11-27T21:16:49+00:00] ERROR: cookbook_file[tests-test-kitchen-default] (minitest-handler::default line 53) had an error: Cookbook 'test-kitchen' (1.0.0) does not contain a file at any of these locations:
[ubuntu-10.04] files/ubuntu-10.04/tests/minitest/default_test.rb
[ubuntu-10.04] files/ubuntu/tests/minitest/default_test.rb
[ubuntu-10.04] files/default/tests/minitest/default_test.rb; ignore_failure is set, continuing
[ubuntu-10.04]
[ubuntu-10.04] ================================================================================
bash -c '
<%= "export http_proxy=\"#{knife_config[:bootstrap_proxy]}\"" if knife_config[:bootstrap_proxy] -%>
exists() {
if command -v $1 &>/dev/null
then
return 0
else
return 1
fi

This is a test