Skip to content

Instantly share code, notes, and snippets.

@hhoover
Last active December 25, 2015 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhoover/7010788 to your computer and use it in GitHub Desktop.
Save hhoover/7010788 to your computer and use it in GitHub Desktop.
Copy/paste for chef class
default['chefnovaclient']['username'] = "USERNAME"
default['chefnovaclient']['password'] = "APIKEY"
site :opscode
cookbook 'apt'
cookbook 'build-essential'
cookbook 'python'
metadata
include_recipe "apt"
include_recipe "python::pip"
%w{git python-dev build-essential}.each do |pkg|
package pkg do
action :install
end
end
python_pip "rackspace-novaclient" do
action :install
end
python_pip "git+git://github.com/major/supernova.git" do
action :install
end
template "/root/.supernova" do
source "supernova.erb"
mode 0600
owner "root"
group "root"
end
[myaccount]
OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
OS_VERSION=2.0
OS_AUTH_SYSTEM=rackspace
OS_REGION_NAME=DFW
OS_SERVICE_NAME=cloudserversOpenStack
OS_TENANT_NAME=<%= node['chefnovaclient']['username'] %>
OS_USERNAME=<%= node['chefnovaclient']['username'] %>
OS_PASSWORD=<%= node['chefnovaclient']['password'] %>
OS_NO_CACHE=1
NOVA_VOLUME_SERVICE_NAME=cloudBlockStorage
# Encoding: utf-8
require_relative 'spec_helper'
describe 'chefnovaclient::default' do
before do
stub_command("/usr/bin/python -c 'import setuptools'").and_return(true)
end
describe 'ubuntu' do
let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
it 'creates a .supernova file' do
expect(chef_run).to create_template('/root/.supernova')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment