Remove openrc
openrc has been moved to Common. include openrc recipe where needed. Change-Id: I088fa1064d0125ea983af7ab144fa87c299d18a6 Implements: blueprint moveopenrc
This commit is contained in:
parent
e2aa9492dd
commit
3b65e68d77
|
@ -1,6 +1,9 @@
|
|||
# CHANGELOG for cookbook-openstack-compute
|
||||
|
||||
This file is used to list changes made in each version of cookbook-openstack-compute.
|
||||
## 9.1.0
|
||||
* Remove openrc, it's been moved to Common
|
||||
|
||||
## 9.0.1
|
||||
### Bug
|
||||
* Add network_allocate_retries option to nova.conf template
|
||||
|
|
|
@ -72,7 +72,6 @@ nova-common
|
|||
----
|
||||
- May include recipe `selinux` (Fedora)
|
||||
- Builds the basic nova.conf config file with details of the rabbitmq, mysql, glance and keystone servers
|
||||
- Builds a openrc file for root with appropriate environment variables to interact with the nova client CLI
|
||||
|
||||
nova-setup
|
||||
----
|
||||
|
|
|
@ -393,7 +393,6 @@ end
|
|||
default['openstack']['compute']['plugins'] = nil
|
||||
default['openstack']['compute']['misc_nova'] = nil
|
||||
default['openstack']['compute']['misc_paste'] = nil
|
||||
default['openstack']['compute']['misc_openrc'] = nil
|
||||
|
||||
# To disable the EC2 API endpoint, simply remove 'ec2,' from the list
|
||||
# of enabled API services.
|
||||
|
|
|
@ -4,7 +4,7 @@ maintainer_email 'matt@opscode.com'
|
|||
license 'Apache 2.0'
|
||||
description 'The OpenStack Compute service Nova.'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '9.0.1'
|
||||
version '9.1.0'
|
||||
|
||||
recipe 'openstack-compute::api-ec2', 'Installs AWS EC2 compatible API'
|
||||
recipe 'openstack-compute::api-metadata', 'Installs the nova metadata package'
|
||||
|
|
|
@ -70,21 +70,6 @@ elsif mq_service_type == 'qpid'
|
|||
mq_password = get_password 'user', node['openstack']['mq']['compute']['qpid']['username']
|
||||
end
|
||||
|
||||
# check attributes before search
|
||||
if node['openstack']['identity']['admin_tenant_name'] && node['openstack']['identity']['admin_user']
|
||||
ksadmin_tenant_name = node['openstack']['identity']['admin_tenant_name']
|
||||
ksadmin_user = node['openstack']['identity']['admin_user']
|
||||
else
|
||||
identity_service_role = node['openstack']['compute']['identity_service_chef_role']
|
||||
keystone = search_for(identity_service_role).first
|
||||
|
||||
ksadmin_tenant_name = keystone['openstack']['identity']['admin_tenant_name']
|
||||
ksadmin_user = keystone['openstack']['identity']['admin_user']
|
||||
Chef::Log.debug("openstack-compute::nova-common:keystone|#{keystone}")
|
||||
end
|
||||
|
||||
ksadmin_pass = get_password 'user', ksadmin_user
|
||||
|
||||
memcache_servers = memcached_servers.join ','
|
||||
|
||||
# find the node attribute endpoint settings for the server holding a given role
|
||||
|
@ -101,8 +86,6 @@ ec2_public_endpoint = endpoint 'compute-ec2-api' || {}
|
|||
network_endpoint = endpoint 'network-api' || {}
|
||||
image_endpoint = endpoint 'image-api'
|
||||
|
||||
Chef::Log.debug("openstack-compute::nova-common:ksadmin_user|#{ksadmin_user}")
|
||||
Chef::Log.debug("openstack-compute::nova-common:ksadmin_tenant_name|#{ksadmin_tenant_name}")
|
||||
Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint.to_s}")
|
||||
Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint.to_s}")
|
||||
Chef::Log.debug("openstack-compute::nova-common:novnc_endpoint|#{novnc_endpoint.to_s}")
|
||||
|
@ -171,25 +154,6 @@ template '/etc/nova/rootwrap.conf' do
|
|||
mode 00644
|
||||
end
|
||||
|
||||
# TODO: need to re-evaluate this for accuracy
|
||||
# TODO(jaypipes): This should be moved into openstack-common
|
||||
# and evaluated only on nodes with admin privs.
|
||||
template '/root/openrc' do
|
||||
source 'openrc.erb'
|
||||
# Must be root!
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00600
|
||||
variables(
|
||||
user: ksadmin_user,
|
||||
tenant: ksadmin_tenant_name,
|
||||
password: ksadmin_pass,
|
||||
identity_endpoint: identity_endpoint,
|
||||
auth_strategy: 'keystone',
|
||||
ec2_url: ec2_public_endpoint.to_s
|
||||
)
|
||||
end
|
||||
|
||||
execute 'enable nova login' do
|
||||
command "usermod -s /bin/sh #{node['openstack']['compute']['user']}"
|
||||
end
|
||||
|
|
|
@ -95,6 +95,8 @@ when 'nova'
|
|||
|
||||
when 'neutron'
|
||||
|
||||
include_recipe 'openstack-common::openrc'
|
||||
|
||||
platform_options = node['openstack']['compute']['platform']
|
||||
|
||||
platform_options['neutron_python_packages'].each do |pkg|
|
||||
|
|
|
@ -476,81 +476,6 @@ describe 'openstack-compute::nova-common' do
|
|||
end
|
||||
end
|
||||
|
||||
describe '/root/openrc' do
|
||||
let(:file) { chef_run.template('/root/openrc') }
|
||||
|
||||
it 'creates the /root/openrc file' do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: 0600
|
||||
)
|
||||
end
|
||||
|
||||
it 'contains auth environment variables' do
|
||||
[
|
||||
/^export OS_USERNAME=admin/,
|
||||
/^export OS_TENANT_NAME=admin$/,
|
||||
/^export OS_PASSWORD=admin$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'templates misc_openrc array correctly' do
|
||||
node.set['openstack']['compute']['misc_openrc'] = ['MISC_OPTION', 'FOO']
|
||||
expect(chef_run).to render_file(file.name).with_content(
|
||||
'MISC_OPTION')
|
||||
end
|
||||
|
||||
context 'rest of template contents' do
|
||||
it 'contains additional auth environment variables' do
|
||||
endpoint = double(to_s: 'endpoint', host: 'endpoint', port: 'port')
|
||||
Chef::Recipe.any_instance.should_receive(:endpoint)
|
||||
.at_least(1).times.and_return(endpoint)
|
||||
node.set['openstack']['compute']['region'] = 'os_region_name'
|
||||
[
|
||||
/^export OS_AUTH_URL=endpoint$/,
|
||||
/^export OS_AUTH_STRATEGY=keystone$/,
|
||||
/^export OS_REGION_NAME=os_region_name$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'contains legacy nova envs' do
|
||||
node.set['openstack']['compute']['region'] = 'os_region_name'
|
||||
[
|
||||
/^export NOVA_USERNAME=\${OS_USERNAME}$/,
|
||||
/^export NOVA_PROJECT_ID=\${OS_TENANT_NAME}$/,
|
||||
/^export NOVA_PASSWORD=\${OS_PASSWORD}$/,
|
||||
/^export NOVA_API_KEY=\${OS_PASSWORD}$/,
|
||||
/^export NOVA_URL=\${OS_AUTH_URL}$/,
|
||||
/^export NOVA_VERSION=$/,
|
||||
/^export NOVA_REGION_NAME=os_region_name$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
|
||||
it 'contains euca2ools env variables' do
|
||||
node.set['credentials']['EC2']['admin']['access'] = 'ec2_admin_access'
|
||||
node.set['credentials']['EC2']['admin']['secret'] = 'ec2_admin_secret'
|
||||
endpoint = double(to_s: 'endpoint', host: 'endpoint', port: 'port')
|
||||
Chef::Recipe.any_instance.should_receive(:endpoint)
|
||||
.at_least(1).times.and_return(endpoint)
|
||||
|
||||
[
|
||||
/^export EC2_ACCESS_KEY=ec2_admin_access$/,
|
||||
/^export EC2_SECRET_KEY=ec2_admin_secret$/,
|
||||
/^export EC2_URL=endpoint$/
|
||||
].each do |line|
|
||||
expect(chef_run).to render_file(file.name).with_content(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'enables nova login' do
|
||||
expect(chef_run).to run_execute('usermod -s /bin/sh nova')
|
||||
end
|
||||
|
|
|
@ -62,6 +62,10 @@ describe 'openstack-compute::nova-setup' do
|
|||
expect(chef_run).to upgrade_package('python-pyparsing')
|
||||
end
|
||||
|
||||
it 'include common openrc recipe' do
|
||||
expect(chef_run).to include_recipe('openstack-common::openrc')
|
||||
end
|
||||
|
||||
it 'adds cidr range of floating ipv4 addresses to neutron' do
|
||||
resource = chef_run.find_resource('execute', 'neutron floating create').to_hash
|
||||
expect(resource).to include(action: [:run], command: '. /root/openrc && /usr/local/bin/add_floaters.py neutron --cidr=10.10.10.0/24 --pool=public')
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<%= node["openstack"]["compute"]["custom_template_banner"] %>
|
||||
|
||||
# COMMON OPENSTACK ENVS
|
||||
export OS_USERNAME=<%= @user %>
|
||||
export OS_PASSWORD=<%= @password %>
|
||||
export OS_TENANT_NAME=<%= @tenant %>
|
||||
export OS_AUTH_URL=<%= @identity_endpoint.to_s %>
|
||||
export OS_AUTH_STRATEGY=<%= @auth_strategy %>
|
||||
export OS_REGION_NAME=<%= node["openstack"]["compute"]["region"] %>
|
||||
|
||||
# LEGACY NOVA ENVS
|
||||
export NOVA_USERNAME=${OS_USERNAME}
|
||||
export NOVA_PROJECT_ID=${OS_TENANT_NAME}
|
||||
export NOVA_PASSWORD=${OS_PASSWORD}
|
||||
export NOVA_API_KEY=${OS_PASSWORD}
|
||||
export NOVA_URL=${OS_AUTH_URL}
|
||||
export NOVA_VERSION=<%= @nova_api_version %>
|
||||
export NOVA_REGION_NAME=<%= node["openstack"]["compute"]["region"] %>
|
||||
|
||||
# EUCA2OOLs ENV VARIABLES
|
||||
export EC2_ACCESS_KEY=<%= node["credentials"]["EC2"]["admin"]["access"] %>
|
||||
export EC2_SECRET_KEY=<%= node["credentials"]["EC2"]["admin"]["secret"] %>
|
||||
export EC2_URL=<%= @ec2_url %>
|
||||
|
||||
<% if node["openstack"]["compute"]["misc_openrc"] %>
|
||||
# Misc options
|
||||
<% node["openstack"]["compute"]["misc_openrc"].each do |m| %>
|
||||
<%= m %>
|
||||
<% end %>
|
||||
<% end %>
|
Loading…
Reference in New Issue