Initial kilo updates

MetaData changes
- bump metadata versions to 11

Gemfile changes
- bump robocop to 0.29.1
- bump chef to 11.18.6  close to 12 but not quite (need infra changes for 12)
- bump berks to 3.2.1 to get fix for running twice (destination already exists)

Rubocop changes
- add .robucop_todo.yml for future cleanup
    - rubocop --auto-gen-config and add an inherit_from: .rubocop_todo.yml in your .rubocop.yml
- add .bundle/**/* to .rubocop.yml
- add .cookbooks/**/* to robocop.yml
- fixup berks-cookbooks/** with /**/*

Changelog changes
- delete Changelog.rb

Other codes changes
- change juno to kilo where appropriate
- cleanup any obvious old deprecated code

Change-Id: I146aa7f7ba4024115c1297103e176a72336fbe5d
Partial-Bug: #1426424
This commit is contained in:
Mark Vanderwiel 2015-02-27 12:35:29 -06:00
parent 6e9beb4a1c
commit ea8dfaa401
14 changed files with 123 additions and 376 deletions

View File

@ -1,3 +1,5 @@
inherit_from: .rubocop_todo.yml
AllCops:
Include:
- metadata.rb
@ -9,7 +11,9 @@ AllCops:
- resources/**
- spec/**
Exclude:
- berks-cookbooks/**
- .cookbooks/**/*
- berks-cookbooks/**/*
- .bundle/**/*
Encoding:
Exclude:

92
.rubocop_todo.yml Normal file
View File

@ -0,0 +1,92 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-02-27 11:18:27 -0600 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: 3
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false
# Offense count: 9
Metrics/AbcSize:
Max: 56
# Offense count: 1
Metrics/PerceivedComplexity:
Max: 15
# Offense count: 11
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 10
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundBlockBody:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/FirstParameterIndentation:
Enabled: false
# Offense count: 3
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/FormatString:
Enabled: false
# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Enabled: false
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: false
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MultilineOperationIndentation:
Enabled: false
# Offense count: 2
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
Style/Next:
Enabled: false
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false
# Offense count: 13
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleInsidePipes, SupportedStyles.
Style/SpaceAroundBlockParameters:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/StringLiterals:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: IgnoredMethods.
Style/SymbolProc:
Enabled: false

View File

@ -1,240 +0,0 @@
# CHANGELOG for cookbook-openstack-common
This file is used to list changes made in each version of cookbook-openstack-common.
## 10.4.0
* Add nova metadata api endpoint
## 10.3.0
* Updates for mysql cookbook ver 6.x
## 10.2.0
* Separate endpoints for vncserver_listen and vncserver_proxyclient_address
* Bump Chef gem to 11.16
* Fix openstack_command with correct arguments order
* Fix openstack_command with single argument type
* Make default using cinder v2 api
* Add OS_VOLUME_API_VERSION for openrc
* Removed the hardcoded PPA reference to "Precise"
* Added an optional automatic apt-get update for Debian based repos
* Add a new custom matcher render_config_file to test ini file content
* Add global rabbit ha flag
* Removed all ceph logic
* Allow different URLs for internal, public, admin endpoints (bug 1412919)
* Cleanup CHEF-3694 warnings
* Allow disabling GnuPG signature check for RDO repo
* Add global bind_interface attribute like the existing bind-host one
* Add bootstrap.sh for installing the packages needed to run tests on trusty with 'chef exec rake'
## 10.1.0
* Adding identity admin bind host endpoint to allow flexibility and consistency
* Fix logging.conf No section error
* Raise error for nil address returned from address_for
## 10.0.3
* Adding identity internal endpoint variables to support new endpoint usage in identity cookbook
* Add sensitive flag to openrc template resource
## 10.0.2
* Add database charset during create
## 10.0.1
* Add an option to allow configuring rabbitmq use_ssl
## 10.0.0
* Upgrading to Juno
* Upgrading berkshelf from 2.0.18 to 3.1.5
## 9.7.0
* Add new network_uuid cli library method for obtaining ID from various neutron resources
* fix fauxhai version for suse
* Allow custom logging attributes for loggers, formatters and handlers
## 9.6.1
* Add python_packages attribute for sqlite
## 9.6.0
* Add an option to store passwords in attributes instead of data bags. Deprecates the get_secret method and the development_mode.
## 9.5.2
* Adds new python_packages attributes for database client packages
## 9.5.1
* Add Trove endpoints, database and mq attributes
## 9.5.0
* Add new image_id cli library method for obtaining glance ID from image name
## 9.4.1
* Fix to allow database connection options for telemetry nosql
## 9.4.0
* Add durable_queues, auto_delete, and qpid topology version attributes
## 9.3.0
* Provide an option to specify the password when dev mode equals true
## 9.2.2
* Fixed openrc failure on role search
## 9.2.1
* Fix package action to allow updates
## 9.2.0
* Add recipe for openrc file (moved from compute cookbook)
## 9.1.2
* Make PKI tokens the new default
## 9.1.1
* Add new library method for making cli calls and one for getting uuids
## 9.1.0
* Added python-openstackclient support
## 9.0.2
* Allow address_for family default to be overridden
## 9.0.1
### Bug
* Fix the depends cookbook version issue in metadata.rb
## 9.0.0
* Upgrading to Icehouse
## 8.5.0
* Add get_secret library method which allows one to specify a secrets_data_bag in attributes.
## 8.4.2
* Adjust image service endpoint path from /v2 to /
## 8.4.1
* Fix a renaming openstack-metering issue, change `metering` to `telemetry` in db_uri function.
## 8.4.0
* Rename openstack-metering to openstack-telemetry
## 8.3.0
### Blueprint
* use-data-bag-for-qpid-password: have qpid use get_password method rather than
using a password attribute
## 8.2.1
### Bug
* Add notification_topics attribute to network attributes
## 8.2.0
* Update and add new attributes for openstack-network cookbook
## 8.1.1
### Bug
* Adjust metering service endpoint path from /v1 to /
## 8.1.0
### Blueprint:
* yum-cookbook-v3-support: Update this cookbook to be compatible with version 3 of the yum cookbook.
## 8.0.1:
### Bug
* Add sleep to search_for function, so that node can be searched
* Add CentOS/RHEL support
## 8.0.0:
* Upgrading to Havana
* Upgrading gems
* ChefSpec -> 3.0.2
* Foodcritic -> 3.0.3
* Berkshelf -> 2.0.10
## 0.4.7:
### Bug
* Change `#db_uri` to hand out UTF8 MySQL URIs; i.e. append '?charset=utf8' to mysql URIs
## 0.4.6:
### Bug
* Ensuring `#db_uri` returns a valid sqlite connection string
* relative path example: 'path' = 'path/to/foo.db' -- will return sqlite:///foo.db
* absolute path example: 'path' = '/path/to/foo.db' -- will return sqlite:////foo.db
## 0.4.5:
* Added `openstack-common::set_endpoints_by_interface` to enable using
`bind_interface` with endpoints rather than hard-code the IP addresses in an
Environment.
## 0.4.4:
* Add support for openstack-common::sysctl and managing sysctl settings via the
node['openstack']['sysctl'] hash, written out to /etc/sysctl.d/60-openstack.conf
## 0.4.3:
* Corrected `#search_for` role and recipe queries.
## 0.4.2:
* Remove hardcoded localhost for mysql host specification.
## 0.4.1:
* Changed endpoint attributes to use http for default scheme. this is inline with
default settings in keystone. fine for dev, but should be ssl for prod.
## 0.4.0:
* Remove `#config_by_role` as it is no longer used and no longer suits our needs.
## 0.3.5:
* Reverted change made in 8311869e5b99fecefd567ce3f1ad1cbdf8d5c5c6.
## 0.3.4:
* Allow `#search_for` to always returns an array.
## 0.3.3:
* Incorrectly mocked search results, as a result `#search_for` was performing unnecessary
actions to an array.
## 0.3.2:
* Fix network-api endpoint path
## 0.3.1:
* Corrected a faulty Chef search query with `#config_by_role`. The search returns a
Hash, not an array.
## 0.3.0:
* Added `#rabbit_servers` method, which returns a comma-delimited string of rabbit
servers in the format of host:port.
* The `#memcached_servers` method no longer accepts an environment.
* Re-factored methods which search to a generic `#search_for`.
* Added `#address_for` method, which returns the IPv4 (default) address of the given
interface.
* Added global mysql setting of port and db type, for use with wrapper cookbooks.
* Add default messaging attributes, for use with wrapper cookbooks.
## 0.2.6:
* Update Chef dependency to Chef 11.
## 0.2.5:
* Moved the default library to database, to better represent its duties.
## 0.2.4:
* Break out #memcached_servers into separate library.
## 0.2.3:
* Sort the results returned by #memcached_servers.
## 0.2.2:
* Provides a mechanism to override memcache_servers search logic through node attributes.
## 0.2.1:
* Adds a prettytable_to_array function for parsing OpenStack CLI output.
## 0.2.0:
* First release of cookbook-openstack-common that aligns with the Grizzly packaging.
* Adds OpenStack Network endpoints.
## 0.1.x:
* Folsom-based packaging.
## 0.0.1:
* Initial release of cookbook-openstack-common.
- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.

View File

@ -1,11 +1,11 @@
source 'https://rubygems.org'
gem 'chef', '~> 11.16.0'
gem 'chef', '~> 11.18.6'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 3.1.5'
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.18.1'
gem 'rubocop', '~> 0.29.1'
gem 'chef-vault', '~> 2.3'

View File

@ -35,9 +35,6 @@ default['openstack']['common']['custom_template_banner'] = '
#
# The value of pass will be "nova"
#
# This attribute is now DEPRECATED and will be removed. Use the default
# attributes below instead.
default['openstack']['developer_mode'] = false
# Use data bags for storing passwords
# Set this to false in order to get the passwords from attributes like:
@ -101,7 +98,7 @@ default['openstack']['secret']['user_passwords_data_bag'] = 'user_passwords'
# needs.
# The coordinated release of OpenStack codename
default['openstack']['release'] = 'juno'
default['openstack']['release'] = 'kilo'
# The Ubuntu Cloud Archive has packages for multiple Ubuntu releases. For
# more information, see: https://wiki.ubuntu.com/ServerTeam/CloudArchive.
@ -122,8 +119,8 @@ default['openstack']['zypp']['repo-key'] = 'd85f9316' # 32 bit key ID
default['openstack']['zypp']['uri'] = 'http://download.opensuse.org/repositories/Cloud:/OpenStack:/%release%/%suse-release%/'
default['openstack']['yum']['rdo_enabled'] = true
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-7'
default['openstack']['yum']['repo-key'] = 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/master/RPM-GPG-KEY-RDO-Juno'
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-kilo/epel-7'
default['openstack']['yum']['repo-key'] = 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/master/RPM-GPG-KEY-RDO-Kilo'
# Enforcing GnuPG signature check for RDO repo. Set this to false if you want to disable the check.
default['openstack']['yum']['gpgcheck'] = true
# ======================== OpenStack Endpoints ================================
@ -476,14 +473,6 @@ default['openstack']['region'] = 'RegionOne'
# Allowed auth API versions: v2.0 or v3.0. By default, it is set to v2.0.
default['openstack']['api']['auth']['version'] = 'v2.0'
# logging.conf list keypairs module_name => log level to write
# DEPRECATED, use new loggers attributes below.
# TODO(MRV) remove in Juno
# The old defaults have been incorporated below:
# { 'nova.api.openstack.wsgi' => 'WARNING',
# 'nova.osapi_compute.wsgi.server' => 'WARNING' }
default['openstack']['logging']['ignore'] = {}
# Allow configured loggers in logging.conf
default['openstack']['logging']['loggers'] = {
'root' => {

View File

@ -75,6 +75,11 @@ if defined?(ChefSpec)
return false if @actual_content.nil?
if @expected_content.is_a?(Regexp)
# MRV Hack to allow windows env to work with rspec
# when regex end with $
@actual_content = @actual_content.gsub(/\r/, '')
@actual_content =~ @expected_content
elsif RSpec::Matchers.is_a_matcher?(@expected_content)
@expected_content.matches?(@actual_content)

View File

@ -26,42 +26,16 @@ module ::Openstack # rubocop:disable Documentation
# encrypted value should be located at
# node['openstack']['secret']['key_path'].
#
# Note that if node['openstack']['developer_mode'] is true,
# then the value of the index parameter is just returned as-is. This
# means that in developer mode, if a cookbook does this:
#
# class Chef
# class Recipe
# include ::Openstack
# end
# end
#
# nova_password = secret 'passwords', 'nova'
#
# That means nova_password will == 'nova'.
#
# You also can provide a default password value in developer mode,
# like following:
#
# node.set['openstack']['secret']['nova'] = 'nova_password'
# nova_password = secret 'passwords', 'nova'
#
# The nova_password will == 'nova_password'
def secret(bag_name, index)
if node['openstack']['developer_mode']
dev_secret(index)
case node['openstack']['databag_type']
when 'encrypted'
encrypted_secret(bag_name, index)
when 'standard'
standard_secret(bag_name, index)
when 'vault' # chef-vault, by convention use "vault_<bag_name>" as bag_name
vault_secret('vault_' + bag_name, index)
else
case node['openstack']['databag_type']
when 'encrypted'
encrypted_secret(bag_name, index)
when 'standard'
standard_secret(bag_name, index)
when 'vault' # chef-vault, by convention use "vault_<bag_name>" as bag_name
vault_secret('vault_' + bag_name, index)
else
::Chef::Log.error("Unsupported value for node['openstack']['databag_type']")
end
::Chef::Log.error("Unsupported value for node['openstack']['databag_type']")
end
end
@ -124,14 +98,4 @@ module ::Openstack # rubocop:disable Documentation
node['openstack']['secret'][key][type]
end
end
private
def dev_secret(index)
::Chef::Log.warn(
'Developer mode for reading passwords is DEPRECATED and will '\
'be removed. Please use attributes (and the get_password method) '\
'instead.')
(node['openstack']['secret'][index] || index)
end
end

View File

@ -4,7 +4,7 @@ maintainer_email 'opscode-chef-openstack@googlegroups.com'
license 'Apache 2.0'
description 'Common OpenStack attributes, libraries and recipes.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '10.4.0'
version '11.0.0'
recipe 'openstack-common', 'Installs/Configures common recipes'
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'

0
spec/database_spec.rb Executable file → Normal file
View File

View File

@ -15,7 +15,7 @@ describe 'openstack-common::default' do
allow(Mixlib::ShellOut).to receive_message_chain(
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
new: 'zypper repos --export -').and_return(
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Juno/SLE_11_SP3/')
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Kilo/SLE_11_SP3/')
expect(chef_run).to run_bash('add repository key')
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
@ -30,7 +30,7 @@ describe 'openstack-common::default' do
expect(chef_run).to run_execute('add repository').with(
command: 'zypper addrepo --check '\
"http://download.opensuse.org/repositories/Cloud:/OpenStack:/#{node['openstack']['release'].capitalize}/SLE_11_SP3/ "\
'Cloud:OpenStack:Juno')
'Cloud:OpenStack:Kilo')
end
it 'does not add the repository nor the key' do
@ -38,7 +38,7 @@ describe 'openstack-common::default' do
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
new: 'zypper repos --export -').and_return(
'd85f9316',
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Juno/SLE_11_SP3/')
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Kilo/SLE_11_SP3/')
expect(chef_run).not_to run_bash('add repository key')
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
end

View File

@ -28,14 +28,14 @@ describe 'openstack-common::default' do
node.set['openstack']['apt']['live_updates_enabled'] = true
expect(chef_run).to add_apt_repository('openstack-ppa').with(
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
components: ['trusty-updates/juno', 'main'])
components: ['trusty-updates/kilo', 'main'])
end
it 'disables openstack live updates' do
node.set['openstack']['apt']['live_updates_enabled'] = false
expect(chef_run).to_not add_apt_repository('openstack-ppa').with(
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
components: ['trusty-updates/juno', 'main'])
components: ['trusty-updates/kilo', 'main'])
end
it 'does not install the gem chef-vault by default' do

View File

@ -40,31 +40,6 @@ describe 'openstack-common::logging' do
expect(sprintf('%o', file.mode)).to eq '644'
end
context 'logging ignore' do
it 'adds loggers keys ignore' do
node.set['openstack']['logging']['ignore'] = {
'ignore.key.1' => 'ignore.value.1',
'ignore.key.2' => 'ignore.value.2'
}
expect(chef_run).to render_config_file(file.name)
.with_section_content('loggers', /^keys=.*ignore_key_1,ignore_key_2$/)
end
it 'adds specific logger ignore block' do
node.set['openstack']['logging']['ignore'] = {
'test.nova.api.openstack.wsgi' => 'WARNING'
}
[
'level = WARNING',
'handlers = prod,debug',
'qualname = test.nova.api.openstack.wsgi'
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('logger_test_nova_api_openstack_wsgi', line)
end
end
end
context 'loggers' do
it 'adds default loggers' do
{

View File

@ -133,39 +133,5 @@ describe 'openstack-common::default' do
end
end
end
describe 'developer_mode' do
before { node.set['openstack']['developer_mode'] = true }
describe '#secret' do
it 'returns index param' do
expect(subject.secret('passwords', 'nova')).to eq('nova')
end
it 'returns the specified password' do
node.override['openstack']['secret']['nova'] = '12345'
expect(subject.secret('passwords', 'nova')).to eq('12345')
end
end
describe '#get_secret' do
it 'returns index param' do
expect(subject.get_secret('nova')).to eq('nova')
end
it 'returns the specified password' do
node.override['openstack']['secret']['nova'] = '67890'
expect(subject.get_secret('nova')).to eq('67890')
end
end
describe '#get_password' do
['service', 'db', 'user'].each do |type|
it "returns index param for #{type}" do
expect(subject.get_password(type, 'nova')).to eq('nova')
end
end
end
end
end
end

View File

@ -1,5 +1,5 @@
[loggers]
keys=<%= (node["openstack"]["logging"]['loggers'].keys + node["openstack"]["logging"]["ignore"].map{|k,v| k.gsub(/\W/, '_')}).join(',') %>
keys=<%= (node["openstack"]["logging"]['loggers'].keys).join(',') %>
[formatters]
keys=<%= node["openstack"]["logging"]['formatters'].keys.join(',') %>
@ -27,14 +27,6 @@ keys=<%= node["openstack"]["logging"]['handlers'].keys.join(',') %>
<% end %>
<% node["openstack"]["logging"]["ignore"].each do |k,v| %>
[logger_<%= k.gsub(/\W/, '_') %>]
level = <%= v %>
handlers = prod,debug
qualname = <%= k %>
<% end %>
## HANDLERS ##
<% node["openstack"]["logging"]['handlers'].each do |section, options| %>