starting rocky development patch

Change-Id: I75d827d383f701da8650cd0e9d1f2501e22cf6a2
This commit is contained in:
Samuel Cassiba 2018-08-03 06:20:45 -07:00
parent cac64d6281
commit dc38c475e2
12 changed files with 66 additions and 47 deletions

View File

@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-11-26 11:38:53 -0800 using RuboCop version 0.49.1.
# on 2018-08-03 05:25:49 -0700 using RuboCop version 0.55.0.
# 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
@ -11,9 +11,22 @@ Lint/NestedMethodDefinition:
Exclude:
- 'libraries/matchers.rb'
# Offense count: 2
# Cop supports --auto-correct.
Lint/UnneededCopEnableDirective:
Exclude:
- 'libraries/matchers.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'Rakefile'
- 'libraries/matchers.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
# Configuration parameters: AutoCorrect, EnforcedStyle.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
@ -25,3 +38,9 @@ Style/NumericPredicate:
Style/ZeroLengthPredicate:
Exclude:
- 'libraries/provider_database_mysql_user.rb'
# Offense count: 178
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 168

View File

@ -4,7 +4,7 @@ maintainer_email 'openstack-dev@lists.openstack.org'
license 'Apache-2.0'
description 'Common OpenStack attributes, libraries and recipes.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '17.0.0'
version '18.0.0'
recipe 'openstack-common', 'Installs/Configures common recipes'
recipe 'openstack-common::logging', 'Installs/Configures common logging'

View File

@ -15,7 +15,7 @@ describe 'openstack-common::default' do
describe 'openstack_command_env' do
before do
node.set['openstack']['endpoints']['public']['identity'] = {
node.override['openstack']['endpoints']['public']['identity'] = {
host: '127.0.0.1',
scheme: 'http',
path: '/v3',

View File

@ -12,7 +12,7 @@ describe 'openstack-common::default' do
let(:subject) { Object.new.extend(Openstack) }
include_context 'library-stubs'
before do
node.set['openstack']['anyservice']['conf'] =
node.override['openstack']['anyservice']['conf'] =
{
'Default' => { 'logfile' => 'file_to_log' },
'secret_section' => {},
@ -22,7 +22,7 @@ describe 'openstack-common::default' do
'baz' => 'yay',
},
}
node.set['openstack']['anyservice']['conf_secrets'] =
node.override['openstack']['anyservice']['conf_secrets'] =
{
'Default' => { 'secret_log' => 'secret_file_to_log' },
'secret_section' => { 'password' => '1234' },

View File

@ -11,9 +11,9 @@ describe 'test-openstack-common-database::default' do
end
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['use_databags'] = false
node.set['openstack']['secret']['mysqlroot']['db'] = 'root_pass'
node.set['openstack']['db']['service'] = { service_type: 'mysql', port: 3306, db_name: 'service_db' }
node.override['openstack']['use_databags'] = false
node.override['openstack']['secret']['mysqlroot']['db'] = 'root_pass'
node.override['openstack']['db']['service'] = { service_type: 'mysql', port: 3306, db_name: 'service_db' }
runner.converge(described_recipe)
end
@ -24,7 +24,7 @@ describe 'test-openstack-common-database::default' do
context 'specific root user db endpoint' do
before do
node.set['openstack']['endpoints']['db']['host_for_db_root_user'] = 'localhost123'
node.override['openstack']['endpoints']['db']['host_for_db_root_user'] = 'localhost123'
end
it 'connects to the database via a specific endpoint for the root user' do
expect(chef_run).to create_database('create database service_db')

View File

@ -6,7 +6,7 @@ describe 'openstack-common::default' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['release'] = 'testrelease'
node.override['openstack']['release'] = 'testrelease'
runner.converge(described_recipe)
end
@ -17,8 +17,8 @@ describe 'openstack-common::default' do
context 'enabling RDO with gpgcheck enabled' do
before do
node.set['openstack']['yum']['rdo_enabled'] = true
node.set['openstack']['yum']['gpgcheck'] = true
node.override['openstack']['yum']['rdo_enabled'] = true
node.override['openstack']['yum']['gpgcheck'] = true
end
it 'adds RDO yum repository' do
@ -39,8 +39,8 @@ describe 'openstack-common::default' do
context 'enabling RDO with gpgcheck disabled' do
before do
node.set['openstack']['yum']['rdo_enabled'] = true
node.set['openstack']['yum']['gpgcheck'] = false
node.override['openstack']['yum']['rdo_enabled'] = true
node.override['openstack']['yum']['gpgcheck'] = false
end
it 'adds RDO yum repository' do
@ -55,7 +55,7 @@ describe 'openstack-common::default' do
context 'disabling RDO deps repo with is_release true' do
before do
node.set['openstack']['is_release'] = true
node.override['openstack']['is_release'] = true
end
it 'does not add the RDO deps yum repository' do
@ -65,7 +65,7 @@ describe 'openstack-common::default' do
context 'disabling RDO' do
before do
node.set['openstack']['yum']['rdo_enabled'] = false
node.override['openstack']['yum']['rdo_enabled'] = false
end
it 'removes RDO yum repository' do

View File

@ -26,7 +26,7 @@ describe 'openstack-common::default' do
it 'configures openstack repository' do
# Using cookbook(apt) LWRP custom matcher
# https://github.com/sethvargo/chefspec#packaging-custom-matchers
node.set['openstack']['apt']['live_updates_enabled'] = true
node.override['openstack']['apt']['live_updates_enabled'] = true
expect(chef_run).to add_apt_repository('openstack-ppa').with(
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
distribution: 'xenial-updates/queens',
@ -36,7 +36,7 @@ describe 'openstack-common::default' do
end
it 'disables openstack live updates' do
node.set['openstack']['apt']['live_updates_enabled'] = false
node.override['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',
distribution: 'xenial-updates/queens',
@ -67,7 +67,7 @@ describe 'openstack-common::default' do
end
it 'installs the gem chef-vault if databag_type is vault' do
node.set['openstack']['databag_type'] = 'vault'
node.override['openstack']['databag_type'] = 'vault'
expect(chef_run).to install_chef_gem('chef-vault')
.with(version: '~> 3.2')
end
@ -90,7 +90,7 @@ describe 'openstack-common::default' do
}
rabbit_opts.each do |key, value|
it "configures rabbit mq #{key}" do
node.set['openstack']['mq']['rabbitmq'][key] = value
node.override['openstack']['mq']['rabbitmq'][key] = value
mq_services.each do |service|
expect(chef_run.node['openstack']['mq'][service]['rabbit'][key]).to eq(value)
end

View File

@ -110,12 +110,12 @@ describe 'openstack-common::default' do
end
it do
node.set['openstack']['mq']['service_type'] = 'rabbit'
node.set['openstack']['mq']['cluster'] = true
node.set['openstack']['mq']['compute']['rabbit']['userid'] = 'rabbit2'
node.set['openstack']['endpoints']['mq']['port'] = 1234
node.set['openstack']['mq']['servers'] = %w(10.0.0.1 10.0.0.2 10.0.0.3)
node.set['openstack']['mq']['vhost'] = '/anyhost'
node.override['openstack']['mq']['service_type'] = 'rabbit'
node.override['openstack']['mq']['cluster'] = true
node.override['openstack']['mq']['compute']['rabbit']['userid'] = 'rabbit2'
node.override['openstack']['endpoints']['mq']['port'] = 1234
node.override['openstack']['mq']['servers'] = %w(10.0.0.1 10.0.0.2 10.0.0.3)
node.override['openstack']['mq']['vhost'] = '/anyhost'
allow(subject).to receive(:node).and_return(chef_run.node)
allow(subject).to receive(:get_password)
.with('user', 'rabbit2')
@ -165,9 +165,9 @@ describe 'openstack-common::default' do
end
it 'returns network db info hash when service found for sqlite with options' do
node.set['openstack']['db']['service_type'] = 'sqlite'
node.set['openstack']['db']['options'] = { 'sqlite' => '?options' }
node.set['openstack']['db']['network']['path'] = 'path'
node.override['openstack']['db']['service_type'] = 'sqlite'
node.override['openstack']['db']['options'] = { 'sqlite' => '?options' }
node.override['openstack']['db']['network']['path'] = 'path'
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'sqlite:///path?options'
expect(
@ -176,7 +176,7 @@ describe 'openstack-common::default' do
end
it 'returns compute db info hash when service found for mariadb' do
node.set['openstack']['db']['service_type'] = 'mariadb'
node.override['openstack']['db']['service_type'] = 'mariadb'
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'mysql+pymysql://user:pass@127.0.0.1:3306/nova?charset=utf8'
expect(
@ -186,7 +186,7 @@ describe 'openstack-common::default' do
%w(galera percona-cluster).each do |db|
it "returns compute db info hash when service found for #{db}" do
node.set['openstack']['db']['service_type'] = db
node.override['openstack']['db']['service_type'] = db
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'mysql+pymysql://user:pass@127.0.0.1:3306/nova?charset=utf8'
expect(
@ -196,7 +196,7 @@ describe 'openstack-common::default' do
end
it 'returns compute slave db info hash when service found for default mysql' do
node.set['openstack']['endpoints']['db']['enabled_slave'] = true
node.override['openstack']['endpoints']['db']['enabled_slave'] = true
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'mysql+pymysql://user:pass@127.0.0.1:3316/nova?charset=utf8'
expect(
@ -205,8 +205,8 @@ describe 'openstack-common::default' do
end
it 'returns image slave db info hash when service found for mariadb' do
node.set['openstack']['db']['service_type'] = 'mariadb'
node.set['openstack']['endpoints']['db']['enabled_slave'] = true
node.override['openstack']['db']['service_type'] = 'mariadb'
node.override['openstack']['endpoints']['db']['enabled_slave'] = true
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'mysql+pymysql://user:pass@127.0.0.1:3316/glance?charset=utf8'
expect(
@ -216,8 +216,8 @@ describe 'openstack-common::default' do
%w(galera percona-cluster).each do |db|
it "returns network slave db info hash when service found for #{db}" do
node.set['openstack']['db']['service_type'] = db
node.set['openstack']['endpoints']['db']['enabled_slave'] = true
node.override['openstack']['db']['service_type'] = db
node.override['openstack']['endpoints']['db']['enabled_slave'] = true
allow(subject).to receive(:node).and_return(chef_run.node)
expected = 'mysql+pymysql://user:pass@127.0.0.1:3316/neutron?charset=utf8'
expect(

View File

@ -50,7 +50,7 @@ describe 'openstack-common::default' do
describe '#address_for ipv6' do
it 'returns ipv6 address' do
node.set['openstack']['endpoints']['family'] = 'inet6'
node.override['openstack']['endpoints']['family'] = 'inet6'
expect(
subject.address_for('lo')
).to eq('2001:db8::1')
@ -83,7 +83,7 @@ describe 'openstack-common::default' do
end
describe 'mq interface set' do
before do
node.set['openstack']['bind_service']['mq']['interface'] = 'eth0'
node.override['openstack']['bind_service']['mq']['interface'] = 'eth0'
end
it 'returns the interface address' do
expect(
@ -100,7 +100,7 @@ describe 'openstack-common::default' do
end
describe 'interface set' do
before do
node.set['openstack']['bind_service']['db']['interface'] = 'eth0'
node.override['openstack']['bind_service']['db']['interface'] = 'eth0'
end
it 'returns the interface address' do
expect(

View File

@ -26,7 +26,7 @@ describe 'openstack-common::default' do
context 'using chef-vault' do
before do
node.set['openstack']['databag_type'] = 'vault'
node.override['openstack']['databag_type'] = 'vault'
end
it 'returns the data from a chef vault item' do
allow(ChefVault::Item).to receive(:load)
@ -66,7 +66,7 @@ describe 'openstack-common::default' do
end
context 'stored in standard data bags' do
before { node.set['openstack']['databag_type'] = 'standard' }
before { node.override['openstack']['databag_type'] = 'standard' }
describe '#secret' do
it 'returns databag' do
value = { 'nova' => 'this' }
@ -101,7 +101,7 @@ describe 'openstack-common::default' do
end
context 'stored in attributes as an alternative' do
before { node.set['openstack']['use_databags'] = false }
before { node.override['openstack']['use_databags'] = false }
describe '#get_password' do
%w(service db user token).each do |type|

View File

@ -7,8 +7,8 @@ describe 'openstack-common::default' do
let(:runner) { ChefSpec::SoloRunner.new(CHEFSPEC_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['mq']['server_role'] = 'openstack-ops-mq'
node.set['openstack']['endpoints']['mq']['port'] = 5672
node.override['openstack']['mq']['server_role'] = 'openstack-ops-mq'
node.override['openstack']['endpoints']['mq']['port'] = 5672
runner.converge(described_recipe)
end
@ -129,7 +129,7 @@ describe 'openstack-common::default' do
end
it 'returns rabbit servers when not searching' do
chef_run.node.set['openstack']['mq']['servers'] = ['1.1.1.1', '2.2.2.2']
chef_run.node.override['openstack']['mq']['servers'] = ['1.1.1.1', '2.2.2.2']
allow(subject).to receive(:node).and_return(chef_run.node)
expect(
subject.rabbit_servers

View File

@ -27,7 +27,7 @@ describe 'openstack-common::sysctl' do
it 'sets the sysctl attributes' do
sysctl_kv = { 'systcl_key1' => 'sysctl_value1',
'sysctl_key2' => 'sysctl_value2' }
node.set['openstack']['sysctl'] = sysctl_kv
node.override['openstack']['sysctl'] = sysctl_kv
sysctl_kv.each do |k, v|
expect(chef_run).to render_file(file.name).with_content(/^#{k} = #{v}$/)
end