retire unmaintained project

Change-Id: I750101fd295b7210dd7e5c490f375a3237fbc455
This commit is contained in:
Jan Klare 2016-12-14 16:02:11 +01:00
parent 7a597d4fc4
commit e68ef3ce8c
26 changed files with 5 additions and 2651 deletions

9
.gitignore vendored
View File

@ -1,9 +0,0 @@
.bundle/
berks-cookbooks/
.kitchen
.vagrant
.coverage/
*.swp
Berksfile.lock
Vagrantfile
Gemfile.lock

View File

@ -1,4 +0,0 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/cookbook-openstack-bare-metal.git

View File

@ -1,30 +0,0 @@
inherit_from: .rubocop_todo.yml
AllCops:
Include:
- metadata.rb
- Gemfile
- attributes/**
- libraries/**
- providers/**
- recipes/**
- resources/**
- spec/**
Exclude:
- .cookbooks/**/*
- berks-cookbooks/**/*
- .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

View File

@ -1,11 +0,0 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-05-28 13:09:57 -0500 using RuboCop version 0.29.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 4
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false

View File

@ -1,8 +0,0 @@
source "https://supermarket.chef.io"
metadata
cookbook "openstack-common",
github: "openstack/cookbook-openstack-common"
cookbook 'openstack-identity',
github: 'openstack/cookbook-openstack-identity'

View File

@ -1,37 +0,0 @@
Contributing
============
How To Get Started
------------------
If you would like to contribute to the development of OpenStack Chef Cookbooks,
you must follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
Gerrit Workflow
---------------
Once those steps have been completed, changes to OpenStack
should be submitted for review via the Gerrit tool, following
the workflow documented at:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs
----
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/openstack-chef
Contacts
--------
Mailing List URL: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
Mailing List Topic: [chef]
IRC: #openstack-chef is our channel on irc.freenode.net
Wiki: https://wiki.openstack.org/wiki/Chef
Twitter: @chefopenstack

14
Gemfile
View File

@ -1,14 +0,0 @@
## THIS GEMFILE IS DEPRECATED AND WILL BE REMOVED AFTER THE NEXT RELEASE
## THERE WON'T BE ANY UPDATES TO THIS FILE DURING THIS RELEASE CYCLE
## WE SWITCHED TO CHEFDK AS THE BUNDLE FOR THE NEEDED GEMS
source 'https://rubygems.org'
gem 'chef', '~> 11.18.6'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 3.2.1'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 4.0.0'
gem 'rspec', '~> 3.0.0'
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.29.1'

View File

@ -1,3 +0,0 @@
The chef core reviewer membership and contact information is centrally maintained [here](http://bit.ly/openstack-chef-maintainers).
Please don't hesitate to reach out of you have questions or concerns related to this project. We are here to help.

View File

@ -1,74 +1,6 @@
Team and repository tags
========================
This project is no longer maintained.
[![Team and repository tags](http://governance.openstack.org/badges/cookbook-openstack-bare-metal.svg)](http://governance.openstack.org/reference/tags/index.html)
<!-- Change things from this point on -->
# THIS COOKBOOK IS CURRENTLY NOT MAINTAINED AND THERE WILL BE NO REALEASE FOR
STABLE/MITAKA. IF YOU ARE INTERESTED IN HELPING MAINTAINING IT, PLEASE JOIN OUR
WEEKLY MEETING ON IRC OR PING US IN THE #openstack-chef CHANNEL ON freenode.
cookbook-openstack-bare-metal Cookbook
======================================
This cookbook installs the OpenStack Bare Metal service **Ironic** as part of
the OpenStack reference deployment Chef for OpenStack. Ironic is currently
installed from packages.
https://wiki.openstack.org/wiki/Ironic
Requirements
------------
Chef 12 or higher required (for Chef environment use).
Attributes
----------
Please see the extensive inline documentation in `attributes/*.rb` for descriptions
of all the settable attributes for this cookbook.
There are also many common attributes shared across the cookbooks that are found in
the cookbook-openstack-common cookbook attribute files.
Note that all attributes are in the `default["openstack"]` "namespace"
Usage
-----
#### cookbook-openstack-bare-metal::default
TODO: Write usage instructions for each cookbook.
Contributing
------------
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) for instructions for contributing.
Testing
-------
Please refer to the [TESTING.md](TESTING.md) for instructions for testing the cookbook.
License and Authors
-------------------
| | |
|:---------------------|:---------------------------------------------------|
| **Author** | Wen Cheng Ma(<wenchma@cn.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2014-2015, IBM, Corp. |
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The contents of this repository are still available in the Git
source code management system. To see the contents of this
repository before it reached its end of life, please check out the
previous commit with "git checkout HEAD^1".

View File

@ -1,40 +0,0 @@
task default: ["test"]
task :test #=> [:lint, :style, :unit]
desc "Vendor the cookbooks in the Berksfile"
task :berks_prep do
sh %{chef exec berks vendor}
end
desc "Run FoodCritic (lint) tests"
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
desc "Run RuboCop (style) tests"
task :style do
sh %{chef exec rubocop}
end
desc "Run RSpec (unit) tests"
task :unit => :berks_prep do
sh %{chef exec rspec --format documentation}
end
desc "Remove the berks-cookbooks directory and the Berksfile.lock"
task :clean do
rm_rf [
'berks-cookbooks',
'Berksfile.lock'
]
end
desc "All-in-One Neutron build Infra using Common task"
task :integration do
# Use the common integration task
sh %(wget -nv -t 3 -O Rakefile-Common https://raw.githubusercontent.com/openstack/cookbook-openstack-common/master/Rakefile)
load './Rakefile-Common'
Rake::Task["common_integration"].invoke
end

View File

@ -1,30 +0,0 @@
# Testing the Cookbook #
This cookbook uses [chefdk](https://downloads.chef.io/chef-dk/) and [berkshelf](http://berkshelf.com/) to isolate dependencies. Make sure you have chefdk and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead). For more detailed information on what needs to be installed, you can have a quick look into the bootstrap.sh file in this repository, which does install all the needed things to get going on ubuntu trusty. The tests defined in the Rakefile include lint, style and unit. For integration testing please refere to the [openstack-chef-repo](https://github.com/openstack/openstack-chef-repo).
We have three test suites which you can run either, individually (there are three rake tasks):
$ chef exec rake lint
$ chef exec rake style
$ chef exec rake unit
or altogether:
$ chef exec rake
The `rake` tasks will take care of installing the needed cookbooks with `berkshelf`.
## Rubocop ##
[Rubocop](https://github.com/bbatsov/rubocop) is a static Ruby code analyzer, based on the community [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits.
## Foodcritic ##
[Foodcritic](http://acrmp.github.io/foodcritic/) is a lint tool for Chef cookbooks. We ignore the following rules:
* [FC003](http://acrmp.github.io/foodcritic/#FC003) These cookbooks are not intended for Chef Solo.
* [FC023](http://acrmp.github.io/foodcritic/#FC023) Prefer conditional attributes.
## Chefspec
[ChefSpec](https://github.com/sethvargo/chefspec) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.

View File

@ -1,118 +0,0 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-bare-metal
# Attributes:: default
#
# Copyright 2015, IBM, Corp
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file
default['openstack']['bare-metal']['custom_template_banner'] = "
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
"
default['openstack']['bare-metal']['verbose'] = 'false'
default['openstack']['bare-metal']['debug'] = 'false'
# Maximum number of worker threads that can be started
# simultaneously by a periodic task. Should be less than RPC
# thread pool size. (integer value)
default['openstack']['bare-metal']['conductor']['periodic_max_workers'] = 8
# The size of the workers greenthread pool. (integer value)
default['openstack']['bare-metal']['conductor']['workers_pool_size'] = 100
# Common rpc definitions
default['openstack']['bare-metal']['rpc_thread_pool_size'] = 64
default['openstack']['bare-metal']['rpc_conn_pool_size'] = 30
default['openstack']['bare-metal']['rpc_response_timeout'] = 60
# The name of the Chef role that knows about the message queue server
# that Ironic uses
default['openstack']['bare-metal']['rabbit_server_chef_role'] = 'os-ops-messaging'
case node['openstack']['mq']['service_type']
when 'rabbitmq'
default['openstack']['bare-metal']['rpc_backend'] = 'rabbit'
when 'qpid'
default['openstack']['bare-metal']['rpc_backend'] = 'qpid'
end
# The AMQP exchange to connect to if using RabbitMQ or Qpid
default['openstack']['bare-metal']['control_exchange'] = node['openstack']['mq']['bare-metal']['control_exchange']
# Logging stuff
default['openstack']['bare-metal']['log_dir'] = '/var/log/ironic'
default['openstack']['bare-metal']['syslog']['use'] = false
default['openstack']['bare-metal']['syslog']['facility'] = 'LOG_LOCAL1'
default['openstack']['bare-metal']['syslog']['config_facility'] = 'local1'
default['openstack']['bare-metal']['region'] = node['openstack']['region']
# Keystone settings
default['openstack']['bare-metal']['api']['auth_strategy'] = 'keystone'
default['openstack']['bare-metal']['api']['auth']['version'] = node['openstack']['api']['auth']['version']
# Whether to allow the client to perform insecure SSL (https) requests
default['openstack']['bare-metal']['api']['auth']['insecure'] = false
# Keystone PKI signing directories
default['openstack']['bare-metal']['api']['auth']['cache_dir'] = '/var/cache/ironic/api'
default['openstack']['bare-metal']['service_tenant_name'] = 'service'
default['openstack']['bare-metal']['service_user'] = 'ironic'
default['openstack']['bare-metal']['service_role'] = 'admin'
default['openstack']['bare-metal']['user'] = 'ironic'
default['openstack']['bare-metal']['group'] = 'ironic'
# Setup the tftp variables
default['openstack']['bare-metal']['tftp']['enabled'] = false
# IP address of Ironic compute node's tftp server
default['openstack']['bare-metal']['tftp']['server'] = '127.0.0.1'
# Ironic compute node's tftp root path
default['openstack']['bare-metal']['tftp']['root_path'] = '/var/lib/tftpboot'
# Directory where master tftp images are stored on disk
default['openstack']['bare-metal']['tftp']['master_path'] = "#{node['openstack']['bare-metal']['tftp']['root_path']}/master_images"
# rootwrap.conf
default['openstack']['bare-metal']['rootwrap']['filters_path'] = '/etc/ironic/rootwrap.d,/usr/share/ironic/rootwrap'
default['openstack']['bare-metal']['rootwrap']['exec_dirs'] = '/sbin,/usr/sbin,/bin,/usr/bin'
default['openstack']['bare-metal']['rootwrap']['use_syslog'] = false
default['openstack']['bare-metal']['rootwrap']['syslog_log_facility'] = 'syslog'
default['openstack']['bare-metal']['rootwrap']['syslog_log_level'] = 'ERROR'
case platform_family
when 'fedora', 'rhel'
default['openstack']['bare-metal']['platform'] = {
'ironic_api_packages' => ['openstack-ironic-api'],
'ironic_api_service' => 'openstack-ironic-api',
'ironic_conductor_packages' => ['openstack-ironic-conductor', 'shellinabox', 'ipmitool'],
'ironic_conductor_service' => 'openstack-ironic-conductor',
'ironic_common_packages' => ['openstack-ironic-common', 'python-ironicclient']
}
when 'debian'
default['openstack']['bare-metal']['platform'] = {
'ironic_api_packages' => ['ironic-api'],
'ironic_api_service' => 'ironic-api',
'ironic_conductor_packages' => ['ironic-conductor', 'shellinabox', 'ipmitool'],
'ironic_conductor_service' => 'ironic-conductor',
'ironic_common_packages' => ['python-ironicclient', 'ironic-common']
}
end

View File

@ -1,9 +0,0 @@
#!/bin/bash -x
## This script is for installing all the needed packages on trusty to run the chef tests with 'chef exec rake'.
## It relies on the common bootstrap.sh from openstack/cookbook-openstack-common for installing common dependencies.
curl https://raw.githubusercontent.com/openstack/cookbook-openstack-common/master/bootstrap.sh \
--retry 3 \
--silent \
--show-error \
| /bin/bash -x

View File

@ -1,16 +0,0 @@
name 'openstack-bare-metal'
maintainer 'openstack-chef'
maintainer_email 'openstack-dev@lists.openstack.org'
license 'Apache 2.0'
description 'Installs/Configures OpenStack Bare Metal service Ironic'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '12.0.0'
recipe 'openstack-bare-metal::api', 'Installs the ironic-api, sets up the ironic database'
recipe 'openstack-bare-metal::conductor', 'Installs the ironic-conductor service'
recipe 'openstack-bare-metal::default', 'Temp workaround to create ironic db with user'
recipe 'openstack-bare-metal::identity_registration', 'Registers ironic service/user/endpoints in keystone'
recipe 'openstack-bare-metal::ironic-common', 'Defines the common pieces of repeated code from the other recipes'
depends 'openstack-common', '>= 12.0.0'
depends 'openstack-identity', '>= 12.0.0'

View File

@ -1,62 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Recipe:: api
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
include_recipe 'openstack-bare-metal::ironic-common'
platform_options = node['openstack']['bare-metal']['platform']
platform_options['ironic_api_packages'].each do |pkg|
package pkg do
action :upgrade
notifies :restart, 'service[ironic-api]', :delayed
end
end
directory '/var/cache/ironic' do
owner node['openstack']['bare-metal']['user']
group node['openstack']['bare-metal']['group']
mode 00700
action :create
end
service 'ironic-api' do
service_name platform_options['ironic_api_service']
supports status: true, restart: true
action [:enable]
subscribes :restart, 'template[/etc/ironic/ironic.conf]'
platform_options['ironic_common_packages'].each do |pkg|
subscribes :restart, "package[#{pkg}]", :delayed
end
end
execute 'ironic db sync' do
command 'ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade'
user 'root'
group 'root'
action :run
end

View File

@ -1,48 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Recipe:: conductor
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
include_recipe 'openstack-bare-metal::ironic-common'
platform_options = node['openstack']['bare-metal']['platform']
platform_options['ironic_conductor_packages'].each do |pkg|
package pkg do
action :upgrade
notifies :restart, 'service[ironic-conductor]', :delayed
end
end
service 'ironic-conductor' do
service_name platform_options['ironic_conductor_service']
supports status: true, restart: true
action [:enable]
subscribes :restart, 'template[/etc/ironic/ironic.conf]'
platform_options['ironic_common_packages'].each do |pkg|
subscribes :restart, "package[#{pkg}]", :delayed
end
end

View File

@ -1,19 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Recipe:: default
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

View File

@ -1,86 +0,0 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-bare-metal
# Recipe:: identity_registration
#
# Copyright 2015, IBM, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'uri'
class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
identity_admin_endpoint = endpoint 'identity-admin'
bootstrap_token = get_password 'token', 'openstack_identity_bootstrap_token'
auth_uri = ::URI.decode identity_admin_endpoint.to_s
ironic_api_endpoint = endpoint 'bare-metal-api'
service_pass = get_password 'service', 'openstack-bare-metal'
region = node['openstack']['bare-metal']['region']
service_tenant_name = node['openstack']['bare-metal']['service_tenant_name']
service_user = node['openstack']['bare-metal']['service_user']
service_role = node['openstack']['bare-metal']['service_role']
openstack_identity_register 'Register Service Tenant' do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name
tenant_description 'Service Tenant'
action :create_tenant
end
openstack_identity_register 'Register Ironic bare metal Service' do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name 'ironic'
service_type 'baremetal'
service_description 'Ironic bare metal provisioning service'
action :create_service
end
openstack_identity_register 'Register Ironic bare metal Endpoint' do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_type 'baremetal'
endpoint_region region
endpoint_adminurl ::URI.decode ironic_api_endpoint.to_s
endpoint_internalurl ::URI.decode ironic_api_endpoint.to_s
endpoint_publicurl ::URI.decode ironic_api_endpoint.to_s
action :create_endpoint
end
openstack_identity_register 'Register Ironic bare metal Service User' do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name
user_name service_user
user_pass service_pass
action :create_user
end
openstack_identity_register 'Grant admin Role to Ironic Service User for Ironic Service Tenant' do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name service_tenant_name
user_name service_user
role_name service_role
action :grant_role
end

View File

@ -1,104 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Recipe:: ironic-common
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
if node['openstack']['bare-metal']['syslog']['use']
include_recipe 'openstack-common::logging'
end
platform_options = node['openstack']['bare-metal']['platform']
platform_options['ironic_common_packages'].each do |pkg|
package pkg do
action :upgrade
end
end
db_type = node['openstack']['db']['bare-metal']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg|
package pkg do
action :upgrade
end
end
directory '/etc/ironic' do
owner node['openstack']['bare-metal']['user']
group node['openstack']['bare-metal']['group']
mode 00750
action :create
end
db_user = node['openstack']['db']['bare-metal']['username']
db_pass = get_password 'db', 'ironic'
db_connection = db_uri('bare-metal', db_user, db_pass)
mq_service_type = node['openstack']['mq']['bare-metal']['service_type']
if mq_service_type == 'rabbitmq'
node['openstack']['mq']['bare-metal']['rabbit']['ha'] && (rabbit_hosts = rabbit_servers)
mq_password = get_password 'user', node['openstack']['mq']['bare-metal']['rabbit']['userid']
elsif mq_service_type == 'qpid'
mq_password = get_password 'user', node['openstack']['mq']['bare-metal']['qpid']['username']
end
image_endpoint = endpoint 'image-api'
identity_endpoint = internal_endpoint 'identity-internal'
identity_admin_endpoint = admin_endpoint 'identity-admin'
service_pass = get_password 'service', 'openstack-bare-metal'
auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['bare-metal']['api']['auth']['version'])
identity_uri = identity_uri_transform(identity_admin_endpoint)
network_endpoint = internal_endpoint 'network-api' || {}
api_bind = internal_endpoint 'bare-metal-api-bind'
template '/etc/ironic/ironic.conf' do
source 'ironic.conf.erb'
owner node['openstack']['bare-metal']['user']
group node['openstack']['bare-metal']['group']
mode 00640
variables(
api_bind_address: api_bind.host,
api_bind_port: api_bind.port,
db_connection: db_connection,
mq_service_type: mq_service_type,
mq_password: mq_password,
rabbit_hosts: rabbit_hosts,
network_endpoint: network_endpoint,
glance_protocol: image_endpoint.scheme,
glance_host: image_endpoint.host,
glance_port: image_endpoint.port,
auth_uri: auth_uri,
identity_uri: identity_uri,
service_pass: service_pass
)
end
template '/etc/ironic/rootwrap.conf' do
source 'rootwrap.conf.erb'
# Must be root!
owner 'root'
group 'root'
mode 00644
end

View File

@ -1,75 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Spec:: api_spec
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'spec_helper'
describe 'openstack-bare-metal::api' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'bare-metal-stubs'
it 'includes ironic common recipe' do
expect(chef_run).to include_recipe('openstack-bare-metal::ironic-common')
end
it 'upgrades ironic api packages' do
expect(chef_run).to upgrade_package('ironic-api')
end
describe 'ironic-api packages' do
let(:package) { chef_run.package('ironic-api') }
it 'sends a notification to the service' do
expect(package).to notify('service[ironic-api]').to(:restart).delayed
end
end
it 'should create the directory /var/cache/ironic' do
expect(chef_run).to create_directory('/var/cache/ironic').with(
user: 'ironic',
group: 'ironic',
mode: 00700
)
end
it 'enables ironic api on boot' do
expect(chef_run).to enable_service('ironic-api')
end
describe 'ironic-api' do
let(:service) { chef_run.service('ironic-api') }
it 'subscribes to the template creation' do
expect(service).to subscribe_to('template[/etc/ironic/ironic.conf]')
end
it 'subscribes to the common packages' do
expect(service).to subscribe_to('package[python-ironicclient]').delayed
end
end
it 'runs db migrations' do
expect(chef_run).to run_execute('ironic db sync').with(user: 'root', group: 'root')
end
end
end

View File

@ -1,65 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Spec:: conductor_spec
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'spec_helper'
describe 'openstack-bare-metal::conductor' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'bare-metal-stubs'
it 'includes ironic common recipe' do
expect(chef_run).to include_recipe('openstack-bare-metal::ironic-common')
end
it 'upgrades ironic conductor packages' do
%w(ironic-conductor shellinabox ipmitool).each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
end
describe 'ironic-conductor packages' do
let(:package) { chef_run.package('ironic-conductor') }
it 'sends a notification to the service' do
expect(package).to notify('service[ironic-conductor]').to(:restart).delayed
end
end
it 'enables ironic conductor on boot' do
expect(chef_run).to enable_service('ironic-conductor')
end
describe 'ironic-conductor' do
let(:service) { chef_run.service('ironic-conductor') }
it 'subscribes to the template creation' do
expect(service).to subscribe_to('template[/etc/ironic/ironic.conf]')
end
it 'subscribes to the common packages' do
expect(service).to subscribe_to('package[python-ironicclient]').delayed
end
end
end
end

View File

@ -1,74 +0,0 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-bare-metal::identity_registration' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'bare-metal-stubs'
it 'registers service tenant' do
expect(chef_run).to create_tenant_openstack_identity_register(
'Register Service Tenant'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'service',
tenant_description: 'Service Tenant'
)
end
it 'registers bare metal service' do
expect(chef_run).to create_service_openstack_identity_register(
'Register Ironic bare metal Service'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_name: 'ironic',
service_type: 'baremetal',
service_description: 'Ironic bare metal provisioning service'
)
end
it 'registers bare metal endpoint' do
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Ironic bare metal Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'baremetal',
endpoint_region: 'RegionOne',
endpoint_adminurl: 'http://127.0.0.1:6385',
endpoint_internalurl: 'http://127.0.0.1:6385',
endpoint_publicurl: 'http://127.0.0.1:6385'
)
end
it 'registers bare metal service user' do
expect(chef_run).to create_user_openstack_identity_register(
'Register Ironic bare metal Service User'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'service',
user_name: 'ironic',
user_pass: 'service_pass'
)
end
it 'grants admin role to service user for service tenant' do
expect(chef_run).to grant_role_openstack_identity_register(
'Grant admin Role to Ironic Service User for Ironic Service Tenant'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'service',
role_name: 'admin',
user_name: 'ironic'
)
end
end
end

View File

@ -1,312 +0,0 @@
# Encoding: utf-8
#
# Cookbook Name:: openstack-bare-metal
# Spec:: ironic_common_spec
#
# Copyright 2015, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require_relative 'spec_helper'
describe 'openstack-bare-metal::ironic-common' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) { runner.converge(described_recipe) }
include_context 'bare-metal-stubs'
it 'upgrades ironic common packages' do
expect(chef_run).to upgrade_package('python-ironicclient')
expect(chef_run).to upgrade_package('ironic-common')
end
it 'upgrades mysql python package' do
expect(chef_run).to upgrade_package('python-mysqldb')
end
describe '/etc/ironic' do
let(:dir) { chef_run.directory('/etc/ironic') }
it 'should create the directory' do
expect(chef_run).to create_directory(dir.name).with(
user: 'ironic',
group: 'ironic',
mode: 0750
)
end
end
describe 'ironic.conf' do
let(:file) { chef_run.template('/etc/ironic/ironic.conf') }
it 'should create the ironic.conf template' do
expect(chef_run).to create_template(file.name).with(
user: 'ironic',
group: 'ironic',
mode: 0640
)
end
it 'has the default api attributes' do
[
/^host_ip=127.0.0.1$/,
/^port=6385$/
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('api', line)
end
end
it 'has the default glance attributes' do
[
/^glance_host=127.0.0.1$/,
/^glance_port=9292$/,
/^glance_protocol=http$/
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('glance', line)
end
end
it 'has the default conductor attributes' do
[
/^periodic_max_workers=8$/,
/^workers_pool_size=100$/
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('conductor', line)
end
end
context 'template contents' do
it 'has the default rpc_backend attribute' do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^rpc_backend=rabbit$/)
end
it 'overrides the default rpc_backend attribute' do
node.set['openstack']['bare-metal']['rpc_backend'] = 'qpid'
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^rpc_backend=qpid$/)
end
it 'sets the default auth attributes' do
[
/^insecure=false$/,
%r{^signing_dir=/var/cache/ironic/api$},
%r{^auth_uri=http://127.0.0.1:5000/v2.0$},
%r{^identity_uri=http://127.0.0.1:35357/$},
/^auth_version=v2.0$/,
/^admin_user=ironic$/,
/^admin_password=service_pass$/,
/^admin_tenant_name=service$/
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
end
end
end
it 'has default neutron attributes' do
expect(chef_run).to render_config_file(file.name).with_section_content('neutron', %r{^url=http://127.0.0.1:9696$})
end
context 'tftp' do
before do
node.set['openstack']['bare-metal']['tftp']['enabled'] = true
end
it 'sets tftp attributes' do
[
/^tftp_server=127.0.0.1$/,
%r{^tftp_root=/var/lib/tftpboot$},
%r{^tftp_master_path=/var/lib/tftpboot/master_images$}
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('pxe', line)
end
end
end
context 'qpid as mq service' do
before do
node.set['openstack']['mq']['bare-metal']['service_type'] = 'qpid'
end
it 'has default RPC/AMQP options set' do
[/^rpc_conn_pool_size=30$/,
/^amqp_durable_queues=false$/,
/^amqp_auto_delete=false$/].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_qpid', line)
end
end
%w(port username sasl_mechanisms reconnect reconnect_timeout reconnect_limit
reconnect_interval_min reconnect_interval_max reconnect_interval heartbeat protocol
tcp_nodelay).each do |attr|
it "has qpid_#{attr} attribute" do
node.set['openstack']['mq']['bare-metal']['qpid'][attr] = "qpid_#{attr}_value"
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_qpid', /^qpid_#{attr}=qpid_#{attr}_value$/)
end
end
it 'has qpid_hostname' do
node.set['openstack']['mq']['bare-metal']['qpid']['host'] = 'qpid_host_value'
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_qpid', /^qpid_hostname=qpid_host_value$/)
end
it 'has qpid_password' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_qpid', /^qpid_password=user_pass$/)
end
it 'has default qpid topology version' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_qpid', /^qpid_topology_version=1$/)
end
end
context 'rabbit mq backend' do
before do
node.set['openstack']['mq']['bare-metal']['service_type'] = 'rabbitmq'
end
it 'has default RPC/AMQP options set' do
[/^rpc_conn_pool_size=30$/,
/^amqp_durable_queues=false$/,
/^amqp_auto_delete=false$/,
/^heartbeat_timeout_threshold=0$/,
/^heartbeat_rate=2$/].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'does not have ssl config set' do
[/^rabbit_use_ssl=/,
/^kombu_ssl_version=/,
/^kombu_ssl_keyfile=/,
/^kombu_ssl_certfile=/,
/^kombu_ssl_ca_certs=/,
/^kombu_reconnect_delay=/,
/^kombu_reconnect_timeout=/].each do |line|
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'sets ssl config' do
node.set['openstack']['mq']['bare-metal']['rabbit']['use_ssl'] = true
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_ssl_version'] = 'TLSv1.2'
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_ssl_keyfile'] = 'keyfile'
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_ssl_certfile'] = 'certfile'
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_ssl_ca_certs'] = 'certsfile'
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_reconnect_delay'] = 123.123
node.set['openstack']['mq']['bare-metal']['rabbit']['kombu_reconnect_timeout'] = 123
[/^rabbit_use_ssl=true/,
/^kombu_ssl_version=TLSv1.2$/,
/^kombu_ssl_keyfile=keyfile$/,
/^kombu_ssl_certfile=certfile$/,
/^kombu_ssl_ca_certs=certsfile$/,
/^kombu_reconnect_delay=123.123$/,
/^kombu_reconnect_timeout=123$/].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
context 'ha attributes' do
before do
node.set['openstack']['mq']['bare-metal']['rabbit']['ha'] = true
end
it 'has a rabbit_hosts attribute' do
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
.and_return('rabbit_servers_value')
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_hosts=rabbit_servers_value$/)
end
%w(host port).each do |attr|
it "does not have rabbit_#{attr} attribute" do
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_#{attr}=/)
end
end
end
context 'non ha attributes' do
before do
node.set['openstack']['mq']['bare-metal']['rabbit']['ha'] = false
end
%w(host port).each do |attr|
it "has rabbit_#{attr} attribute" do
node.set['openstack']['mq']['bare-metal']['rabbit'][attr] = "rabbit_#{attr}_value"
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_#{attr}=rabbit_#{attr}_value$/)
end
end
it 'does not have a rabbit_hosts attribute' do
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_hosts=/)
end
end
it 'has rabbit_userid' do
node.set['openstack']['mq']['bare-metal']['rabbit']['userid'] = 'rabbit_userid_value'
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_userid=rabbit_userid_value$/)
end
it 'has rabbit_password' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_password=user_pass$/)
end
it 'has rabbit_virtual_host' do
node.set['openstack']['mq']['bare-metal']['rabbit']['vhost'] = 'vhost_value'
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_virtual_host=vhost_value$/)
end
it 'has the default rabbit_retry_interval set' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_retry_interval=1$/)
end
it 'has the default rabbit_max_retries set' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_max_retries=0$/)
end
end
end
describe 'rootwrap.conf' do
let(:file) { chef_run.template('/etc/ironic/rootwrap.conf') }
it 'should create the /etc/ironic/rootwrap.conf file' do
expect(chef_run).to create_template(file.name).with(
user: 'root',
group: 'root',
mode: 0644
)
end
context 'template contents' do
it 'shows the custom banner' do
node.set['openstack']['bare-metal']['custom_template_banner'] = 'banner'
expect(chef_run).to render_file(file.name).with_content(/^banner$/)
end
it 'sets the default attributes' do
[
%r{^filters_path=/etc/ironic/rootwrap.d,/usr/share/ironic/rootwrap$},
%r{^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$},
/^use_syslog=false$/,
/^syslog_log_facility=syslog$/,
/^syslog_log_level=ERROR$/
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
end
end
end
end
end

View File

@ -1,41 +0,0 @@
# encoding: UTF-8
require 'chefspec'
require 'chefspec/berkshelf'
require 'chef/application'
LOG_LEVEL = :fatal
SUSE_OPTS = {
platform: 'suse',
version: '11.3',
log_level: ::LOG_LEVEL
}
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: ::LOG_LEVEL
}
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '14.04',
log_level: ::LOG_LEVEL
}
shared_context 'bare-metal-stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', anything)
.and_return('service_pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('db', anything)
.and_return('db_pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', anything)
.and_return('user_pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_identity_bootstrap_token')
.and_return('bootstrap-token')
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
.and_return('1.1.1.1:5672,2.2.2.2:5672')
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
<%= node['openstack']['bare-metal']['custom_template_banner'] %>
# Configuration for ironic-rootwrap
# This file should be owned by (and only-writeable by) the root user
[DEFAULT]
# List of directories to load filter definitions from (separated by ',').
# These directories MUST all be only writeable by root !
filters_path=<%= node['openstack']['bare-metal']['rootwrap']['filters_path'] %>
# List of directories to search executables in, in case filters do not
# explicitely specify a full path (separated by ',')
# If not specified, defaults to system PATH environment variable.
# These directories MUST all be only writeable by root !
exec_dirs=<%= node['openstack']['bare-metal']['rootwrap']['exec_dirs'] %>
# Enable logging to syslog
# Default value is False
use_syslog=<%= node['openstack']['bare-metal']['rootwrap']['use_syslog'] %>
# Which syslog facility to use.
# Valid values include auth, authpriv, syslog, local0, local1...
# Default value is 'syslog'
syslog_log_facility=<%= node['openstack']['bare-metal']['rootwrap']['syslog_log_facility'] %>
# Which messages to log.
# INFO means log all usage
# ERROR means only log unsuccessful attempts
syslog_log_level=<%= node['openstack']['bare-metal']['rootwrap']['syslog_log_level'] %>