Changed cookbook name to openstack-dashboard

Changed the cookbook to opentack-dashboard.  Also, corrected
tests to use the new cookbook name and attributes.

All tests are passing.

Change-Id: I3fe76d7c2533cd377e29e312f9b3536d3e7614dc
This commit is contained in:
John Dewey 2013-05-14 20:36:33 -07:00
parent b013b562d9
commit c0e49a4737
14 changed files with 84 additions and 84 deletions

View File

@ -1,4 +1,4 @@
metadata
cookbook "openstack-common",
git: "git@github.com:att-cloud/cookbook-openstack-common.git"
git: "git://github.com/stackforge/cookbook-openstack-common.git"

View File

@ -30,7 +30,7 @@ Configures database for use with Horizon
```json
"run_list": [
"recipe[horizon::db]"
"recipe[openstack-dashboard::db]"
]
```
@ -42,23 +42,23 @@ Sets up the Horizon dashboard within an Apache `mod_wsgi` container.
```json
"run_list": [
"recipe[horizon::server]"
"recipe[openstack-dashboard::server]"
]
```
Attributes
==========
* `horizon["db"]["username"]` - username for horizon database access
* `horizon["server_hostname"]` - sets the ServerName in the Apache config.
* `horizon["use_ssl"]` - toggle for using ssl with dashboard (default true)
* `horizon["ssl"]["dir"]` - directory where ssl certs are stored on this system
* `horizon["ssl"]["cert"]` - name to use when creating the ssl certificate
* `horizon["ssl"]["key"]` - name to use when creating the ssl key
* `horizon["dash_path"]` - base path for dashboard files (document root)
* `horizon["wsgi_path"]` - path for wsgi dir
* `horizon["ssl_offload"]` - Set SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') flag for offloading SSL
* `horizon["plugins"]` - Array of plugins to include via INSTALED\_APPS
* `openstack-dashboard["db"]["username"]` - username for horizon database access
* `openstack-dashboard["server_hostname"]` - sets the ServerName in the Apache config.
* `openstack-dashboard["use_ssl"]` - toggle for using ssl with dashboard (default true)
* `openstack-dashboard["ssl"]["dir"]` - directory where ssl certs are stored on this system
* `openstack-dashboard["ssl"]["cert"]` - name to use when creating the ssl certificate
* `openstack-dashboard["ssl"]["key"]` - name to use when creating the ssl key
* `openstack-dashboard["dash_path"]` - base path for dashboard files (document root)
* `openstack-dashboard["wsgi_path"]` - path for wsgi dir
* `openstack-dashboard["ssl_offload"]` - Set SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https') flag for offloading SSL
* `openstack-dashboard["plugins"]` - Array of plugins to include via INSTALED\_APPS
Testing
=====

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: horizon
# Cookbook Name:: openstack-dashboard
# Attributes:: default
#
# Copyright 2012, AT&T, Inc.
@ -19,55 +19,55 @@
# Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file
default["horizon"]["custom_template_banner"] = "
default["openstack-dashboard"]["custom_template_banner"] = "
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
"
default["horizon"]["debug"] = false
default["openstack-dashboard"]["debug"] = false
# This user's password is stored in an encrypted databag
# and accessed with openstack-common cookbook library's
# db_password routine.
default["horizon"]["db"]["username"] = "dash"
default["openstack-dashboard"]["db"]["username"] = "dash"
# The Keystone role used by default for users logging into the dashboard
default["horizon"]["keystone_default_role"] = "Member"
default["openstack-dashboard"]["keystone_default_role"] = "Member"
# This is the name of the Chef role that will install the Keystone Service API
default["horizon"]["keystone_service_chef_role"] = "keystone"
default["openstack-dashboard"]["keystone_service_chef_role"] = "keystone"
default["horizon"]["server_hostname"] = nil
default["horizon"]["use_ssl"] = true
default["horizon"]["ssl"]["cert"] = "horizon.pem"
default["horizon"]["ssl"]["key"] = "horizon.key"
default["openstack-dashboard"]["server_hostname"] = nil
default["openstack-dashboard"]["use_ssl"] = true
default["openstack-dashboard"]["ssl"]["cert"] = "horizon.pem"
default["openstack-dashboard"]["ssl"]["key"] = "horizon.key"
default["horizon"]["swift"]["enabled"] = "False"
default["openstack-dashboard"]["swift"]["enabled"] = "False"
default["horizon"]["theme"] = "default"
default["openstack-dashboard"]["theme"] = "default"
case node["platform"]
when "fedora", "centos", "redhat"
default["horizon"]["ssl"]["dir"] = "/etc/pki/tls"
default["horizon"]["local_settings_path"] = "/etc/openstack-dashboard/local_settings"
default["openstack-dashboard"]["ssl"]["dir"] = "/etc/pki/tls"
default["openstack-dashboard"]["local_settings_path"] = "/etc/openstack-dashboard/local_settings"
# TODO(shep) - Fedora does not generate self signed certs by default
default["horizon"]["platform"] = {
default["openstack-dashboard"]["platform"] = {
"horizon_packages" => ["openstack-dashboard", "MySQL-python"],
"package_overrides" => ""
}
when "ubuntu"
default["horizon"]["ssl"]["dir"] = "/etc/ssl"
default["horizon"]["local_settings_path"] = "/etc/openstack-dashboard/local_settings.py"
default["horizon"]["platform"] = {
default["openstack-dashboard"]["ssl"]["dir"] = "/etc/ssl"
default["openstack-dashboard"]["local_settings_path"] = "/etc/openstack-dashboard/local_settings.py"
default["openstack-dashboard"]["platform"] = {
"horizon_packages" => ["lessc","openstack-dashboard", "python-mysqldb"],
"package_overrides" => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
}
end
default["horizon"]["dash_path"] = "/usr/share/openstack-dashboard/openstack_dashboard"
default["horizon"]["stylesheet_path"] = "/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html"
default["horizon"]["wsgi_path"] = node["horizon"]["dash_path"] + "/wsgi/django.wsgi"
default["horizon"]["session_backend"] = "memcached"
default["openstack-dashboard"]["dash_path"] = "/usr/share/openstack-dashboard/openstack_dashboard"
default["openstack-dashboard"]["stylesheet_path"] = "/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html"
default["openstack-dashboard"]["wsgi_path"] = node["openstack-dashboard"]["dash_path"] + "/wsgi/django.wsgi"
default["openstack-dashboard"]["session_backend"] = "memcached"
default["horizon"]["ssl_offload"] = "false"
default["horizon"]["plugins"] = nil
default["openstack-dashboard"]["ssl_offload"] = "false"
default["openstack-dashboard"]["plugins"] = nil

View File

@ -1,4 +1,4 @@
name "horizon"
name "openstack-dashboard"
maintainer "AT&T Services, Inc."
maintainer_email "cookbooks@lists.tfoundry.com"
license "Apache 2.0"
@ -6,8 +6,8 @@ description "Installs/Configures the OpenStack Dasboard (Horizon)"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2012.2.0"
recipe "horizon::db", "Configures database for use with Horizon"
recipe "horizon::server", "Sets up the Horizon dashboard within an Apache `mod_wsgi` container."
recipe "openstack-dashboard::db", "Configures database for use with Horizon"
recipe "openstack-dashboard::server", "Sets up the Horizon dashboard within an Apache `mod_wsgi` container."
%w{ ubuntu fedora redhat centos }.each do |os|
supports os

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: horizon
# Cookbook Name:: openstack-dashboard
# Recipe:: db
#
# Copyright 2012-2013, AT&T Services, Inc.
@ -32,6 +32,6 @@ include_recipe "mysql::ruby"
db_pass = db_password "horizon"
db_create_with_user("dashboard",
node["horizon"]["db"]["username"],
node["openstack-dashboard"]["db"]["username"],
db_pass
)

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: horizon
# Cookbook Name:: openstack-dashboard
# Recipe:: default
#
# Copyright 2012, Rackspace US, Inc.

View File

@ -1,5 +1,5 @@
#
# Cookbook Name:: horizon
# Cookbook Name:: openstack-dashboard
# Recipe:: server
#
# Copyright 2012, Rackspace US, Inc.
@ -37,7 +37,7 @@ execute "set-selinux-permissive" do
only_if "[ ! -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*enforcing') -eq 1 ]"
end
platform_options = node["horizon"]["platform"]
platform_options = node["openstack-dashboard"]["platform"]
include_recipe "apache2"
include_recipe "apache2::mod_wsgi"
@ -73,7 +73,7 @@ end
memcached = memcached_servers
template node["horizon"]["local_settings_path"] do
template node["openstack-dashboard"]["local_settings_path"] do
source "local_settings.py.erb"
owner "root"
group "root"
@ -99,7 +99,7 @@ execute "openstack-dashboard syncdb" do
# not_if "/usr/bin/mysql -u root -e 'describe #{node["dash"]["db"]}.django_content_type'"
end
cookbook_file "#{node["horizon"]["ssl"]["dir"]}/certs/#{node["horizon"]["ssl"]["cert"]}" do
cookbook_file "#{node["openstack-dashboard"]["ssl"]["dir"]}/certs/#{node["openstack-dashboard"]["ssl"]["cert"]}" do
source "horizon.pem"
mode 00644
owner "root"
@ -115,7 +115,7 @@ else
grp = "root"
end
cookbook_file "#{node["horizon"]["ssl"]["dir"]}/private/#{node["horizon"]["ssl"]["key"]}" do
cookbook_file "#{node["openstack-dashboard"]["ssl"]["dir"]}/private/#{node["openstack-dashboard"]["ssl"]["key"]}" do
source "horizon.key"
mode 00640
owner "root"
@ -125,7 +125,7 @@ cookbook_file "#{node["horizon"]["ssl"]["dir"]}/private/#{node["horizon"]["ssl"]
end
# stop apache bitching
directory "#{node["horizon"]["dash_path"]}/.blackhole" do
directory "#{node["openstack-dashboard"]["dash_path"]}/.blackhole" do
owner "root"
action :create
end
@ -137,8 +137,8 @@ template "#{node["apache"]["dir"]}/sites-available/openstack-dashboard" do
mode 00644
variables(
:ssl_cert_file => "#{node["horizon"]["ssl"]["dir"]}/certs/#{node["horizon"]["ssl"]["cert"]}",
:ssl_key_file => "#{node["horizon"]["ssl"]["dir"]}/private/#{node["horizon"]["ssl"]["key"]}"
:ssl_cert_file => "#{node["openstack-dashboard"]["ssl"]["dir"]}/certs/#{node["openstack-dashboard"]["ssl"]["cert"]}",
:ssl_key_file => "#{node["openstack-dashboard"]["ssl"]["dir"]}/private/#{node["openstack-dashboard"]["ssl"]["key"]}"
)
notifies :run, "execute[restore-selinux-context]", :immediately

View File

@ -1,6 +1,6 @@
require "spec_helper"
describe "horizon::db" do
describe "openstack-dashboard::db" do
it "installs mysql packages" do
@chef_run = converge
@ -19,6 +19,6 @@ describe "horizon::db" do
::Chef::Recipe.any_instance.stub(:db_password).with("horizon").
and_return "test-pass"
::ChefSpec::ChefRunner.new(::UBUNTU_OPTS).converge "horizon::db"
::ChefSpec::ChefRunner.new(::UBUNTU_OPTS).converge "openstack-dashboard::db"
end
end

View File

@ -1,4 +1,4 @@
require "spec_helper"
describe "horizon::default" do
describe "openstack-dashboard::default" do
end

View File

@ -1,6 +1,6 @@
require "spec_helper"
describe "horizon::server" do
describe "openstack-dashboard::server" do
before do
::Chef::Recipe.any_instance.stub(:memcached_servers).
and_return "hostA:port,hostB:port"
@ -13,7 +13,7 @@ describe "horizon::server" do
#describe "fedora" do
# before do
# @chef_run = ::ChefSpec::ChefRunner.new ::FEDORA_OPTS
# @chef_run.converge "horizon::server"
# @chef_run.converge "openstack-dashboard::server"
# end
# it "executes restore-selinux-context" do

View File

@ -1,6 +1,6 @@
require "spec_helper"
describe "horizon::server" do
describe "openstack-dashboard::server" do
before do
::Chef::Recipe.any_instance.stub(:memcached_servers).
and_return "hostA:port,hostB:port"
@ -11,7 +11,7 @@ describe "horizon::server" do
describe "redhat" do
before do
@chef_run = ::ChefSpec::ChefRunner.new ::REDHAT_OPTS
@chef_run.converge "horizon::server"
@chef_run.converge "openstack-dashboard::server"
end
it "executes set-selinux-permissive" do

View File

@ -1,6 +1,6 @@
require "spec_helper"
describe "horizon::server" do
describe "openstack-dashboard::server" do
before do
::Chef::Recipe.any_instance.stub(:memcached_servers).
and_return "hostA:port,hostB:port"
@ -11,7 +11,7 @@ describe "horizon::server" do
describe "ubuntu" do
before do
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@chef_run.converge "horizon::server"
@chef_run.converge "openstack-dashboard::server"
end
it "doesn't execute set-selinux-permissive" do
@ -133,7 +133,7 @@ describe "horizon::server" do
:version => "12.04",
:step_into => ["apache_site"],
:log_level => :fatal
).converge "horizon::server"
).converge "openstack-dashboard::server"
cmd = "/usr/sbin/a2dissite 000-default"
expect(chef_run).to execute_command cmd
@ -145,7 +145,7 @@ describe "horizon::server" do
:version => "12.04",
:step_into => ["apache_site"],
:log_level => :fatal
).converge "horizon::server"
).converge "openstack-dashboard::server"
cmd = "/usr/sbin/a2ensite openstack-dashboard"
expect(chef_run).to execute_command cmd

View File

@ -1,40 +1,40 @@
<%= node["horizon"]["custom_template_banner"] %>
<%= node["openstack-dashboard"]["custom_template_banner"] %>
<VirtualHost *:80>
<% if node["horizon"]["server_hostname"] -%>
ServerName <%= node["horizon"]["server_hostname"] %>
<% if node["openstack-dashboard"]["server_hostname"] -%>
ServerName <%= node["openstack-dashboard"]["server_hostname"] %>
<% end -%>
<% if node["horizon"]["use_ssl"] %>
<% if node["openstack-dashboard"]["use_ssl"] %>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
</VirtualHost>
<VirtualHost *:443>
<% if node["horizon"]["server_hostname"] -%>
ServerName <%= node["horizon"]["server_hostname"] %>
<% if node["openstack-dashboard"]["server_hostname"] -%>
ServerName <%= node["openstack-dashboard"]["server_hostname"] %>
<% end -%>
<% end %>
ServerAdmin <%= node["apache"]["contact"] %>
WSGIScriptAlias / <%= node["horizon"]["wsgi_path"] %>
WSGIDaemonProcess dashboard user=<%= node["apache"]["user"] %> group=<%= node["apache"]["group"] %> processes=3 threads=10 python-path=<%= node["horizon"]["dash_path"] %>
WSGIScriptAlias / <%= node["openstack-dashboard"]["wsgi_path"] %>
WSGIDaemonProcess dashboard user=<%= node["apache"]["user"] %> group=<%= node["apache"]["group"] %> processes=3 threads=10 python-path=<%= node["openstack-dashboard"]["dash_path"] %>
WSGIProcessGroup dashboard
DocumentRoot <%= node["horizon"]["dash_path"] %>/.blackhole/
Alias /media <%= node["horizon"]["dash_path"] %>/media
DocumentRoot <%= node["openstack-dashboard"]["dash_path"] %>/.blackhole/
Alias /media <%= node["openstack-dashboard"]["dash_path"] %>/media
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory <%= node["horizon"]["dash_path"] %>>
<Directory <%= node["openstack-dashboard"]["dash_path"] %>>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<% if node["horizon"]["use_ssl"] %>
<% if node["openstack-dashboard"]["use_ssl"] %>
SSLEngine on
SSLCertificateFile <%= @ssl_cert_file %>
SSLCertificateKeyFile <%= @ssl_key_file %>

View File

@ -1,10 +1,10 @@
<%= node["horizon"]["custom_template_banner"] %>
<%= node["openstack-dashboard"]["custom_template_banner"] %>
import os
from django.utils.translation import ugettext_lazy as _
DEBUG = <%= node["horizon"]["debug"] ? "True" : "False" %>
DEBUG = <%= node["openstack-dashboard"]["debug"] ? "True" : "False" %>
TEMPLATE_DEBUG = DEBUG
<% if %w(fedora redhat centos scientific).include? node.platform -%>
@ -14,7 +14,7 @@ LOGOUT_URL = WEBROOT+'/auth/logout/'
LOGIN_REDIRECT_URL = WEBROOT+'/syspanel'
<% end %>
<% if node["horizon"]["ssl_offload"] %>
<% if node["openstack-dashboard"]["ssl_offload"] %>
# Set SSL proxy settings:
# For Django 1.4+ pass this header from the proxy after terminating the SSL,
# and don't forget to strip it from the client's request.
@ -53,7 +53,7 @@ LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
# We recommend you use memcached for development; otherwise after every reload
# of the django development server, you will have to login again. To use
# memcached set CACHE_BACKED to something like 'memcached://127.0.0.1:11211/'
<% case node["horizon"]["session_backend"]
<% case node["openstack-dashboard"]["session_backend"]
when "file" %>
SESSION_ENGINE = 'django.contrib.sessions.backends.file'
<% when "memcached" %>
@ -91,7 +91,7 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
OPENSTACK_KEYSTONE_URL = "<%= @auth_uri %>"
OPENSTACK_KEYSTONE_ADMIN_URL = "<%= @auth_admin_uri %>"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "<%= node["horizon"]["keystone_default_role"] %>"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "<%= node["openstack-dashboard"]["keystone_default_role"] %>"
# Disable SSL certificate checks (useful for self-signed certificates):
# OPENSTACK_SSL_NO_VERIFY = True
@ -140,7 +140,7 @@ LOGGING = {
},
'console': {
# Set the level to "DEBUG" for verbose output logging.
'level': '<%= node["horizon"]["debug"] ? "DEBUG" : "INFO" %>',
'level': '<%= node["openstack-dashboard"]["debug"] ? "DEBUG" : "INFO" %>',
'class': 'logging.StreamHandler',
},
},
@ -182,14 +182,14 @@ DATABASES = {
'default': {
'ENGINE': 'django.db.backends.<%= @db_info["db_type"] %>',
'NAME': '<%= @db_info["db_name"] %>',
'USER': '<%= node["horizon"]["db"]["username"] %>',
'USER': '<%= node["openstack-dashboard"]["db"]["username"] %>',
'PASSWORD': '<%= @db_pass %>',
'HOST': '<%= @db_info["host"] %>',
'default-character-set': 'utf8'
},
}
SWIFT_ENABLED = <%= node["horizon"]["swift"]["enabled"] %>
SWIFT_ENABLED = <%= node["openstack-dashboard"]["swift"]["enabled"] %>
SWIFT_PAGINATE_LIMIT = 100
# Configure quantum connection details for networking
@ -205,10 +205,10 @@ COMPRESS_OFFLINE = True
# ['Nagios','http://foo.com'],
# ['Ganglia','http://bar.com'],
# ]
<% if node["horizon"]["plugins"] %>
<% if node["openstack-dashboard"]["plugins"] %>
import sys
mod = sys.modules['openstack_dashboard.settings']
<% node["horizon"]["plugins"].each do |p| %>
<% node["openstack-dashboard"]["plugins"].each do |p| %>
mod.INSTALLED_APPS += ('<%= p %>', )
<% end %>
<% end %>