Stein fixes

- Cookstyle fixes
- Refactor Berksfile to use groups so we can exclude integration testing
  cookbooks
- Update documentation
- Cleanup line wraps
- Enable sensitive resources for the template[/etc/aodh/aodh.conf],
  template[/etc/gnocchi/gnocchi.conf] and
  template[/etc/ceilometer/ceilometer.conf] to resources improve
  security.
- Update delivery configuration to exclude integration cookbooks
- Fix ChefSpec output.
- Add missing ChefSpec tests
- Switch package installations to send packages as arrays instead of individual
  package resources. This generally speeds up chef runs.
- Cleanup array syntax using %w() instead of []

Depends-On: https://review.opendev.org/701027
Depends-On: https://review.opendev.org/706101
Depends-On: https://review.opendev.org/706151
Change-Id: I73e3c3dce64798a4d6ba5c94cc45dfabc4d2d0ff
This commit is contained in:
Lance Albertson 2020-03-18 13:22:42 -07:00
parent 111d3621a9
commit dbb2758ddd
24 changed files with 183 additions and 194 deletions

View File

@ -1 +1,9 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml"
[local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -14,17 +14,3 @@ AllCops:
- .cookbooks/**/*
- berks-cookbooks/**/*
- .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

View File

@ -2,22 +2,22 @@ source 'https://supermarket.chef.io'
solver :ruby, :required
%w(
client
-common
-compute
-dns
-identity
-image
-integration-test
-network
-ops-database
-ops-messaging
).each do |cookbook|
[
%w(client dep),
%w(-common dep),
%w(-compute integration),
%w(-dns integration),
%w(-identity dep),
%w(-image integration),
%w(-integration-test integration),
%w(-network integration),
%w(-ops-database integration),
%w(-ops-messaging integration),
].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}"
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}"
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end
end

View File

@ -22,9 +22,9 @@ https://gnocchi.xyz/
Requirements
============
- Chef 14 or higher
- ChefDK 3.2.30 for testing (also includes Berkshelf for cookbook
dependency resolution)
- Chef 15 or higher
- Chef Workstation 0.15.18 for testing (also includes Berkshelf for
cookbook dependency resolution)
Platform
========
@ -38,9 +38,9 @@ Cookbooks
The following cookbooks are dependencies:
- 'openstackclient', '>= 0.1.0'
- 'openstack-common', '>= 18.0.0'
- 'openstack-identity', '>= 18.0.0'
- 'openstackclient'
- 'openstack-common', '>= 19.0.0'
- 'openstack-identity', '>= 19.0.0'
Attributes
==========
@ -131,19 +131,19 @@ License and Author
| **Author** | Lance Albertson (lance@osuosl.org |
+-----------------+--------------------------------------------+
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. |
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2013, Rackspace US, Inc. |
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, IBM, Corp. |
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, SUSE Linux GmbH |
+-----------------+---------------------------------------------+
| **Copyright** | Copyright (c) 2019, Oregon State University |
+-----------------+---------------------------------------------+
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, Rackspace US, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, IBM, Corp. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, SUSE Linux GmbH |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2019-2020, Oregon State University |
+-----------------+--------------------------------------------------+
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

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: default
#
# Copyright 2013, AT&T Services, Inc.
# Copyright 2013-2014, SUSE Linux GmbH
# Copyright:: 2013, AT&T Services, Inc.
# Copyright:: 2013-2014, SUSE Linux GmbH
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -199,6 +200,6 @@ when 'debian'
aodh-notifier
aodh-listener
),
'aodh-api_wsgi_file' => '/usr/share/aodh/app.wsgi' # this file come with aodh-common which aodh-api depends on
'aodh-api_wsgi_file' => '/usr/share/aodh/app.wsgi', # this file come with aodh-common which aodh-api depends on
}
end

View File

@ -3,17 +3,7 @@ maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0'
description 'The OpenStack Metering service Ceilometer.'
version '18.0.0'
recipe 'openstack-telemetry::agent-central', 'Installs agent central service.'
recipe 'openstack-telemetry::agent-compute', 'Installs agent compute service.'
recipe 'openstack-telemetry::agent-notification', 'Installs the agent notification service.'
recipe 'openstack-telemetry::aodh', 'Installs aodh service'
recipe 'openstack-telemetry::api', 'Installs API service.'
recipe 'openstack-telemetry::common', 'Common metering configuration.'
recipe 'openstack-telemetry::gnocchi_configure', 'Configure Gnocchi'
recipe 'openstack-telemetry::gnocchi_install', 'Installs and starts the Gnocchi service'
recipe 'openstack-telemetry::identity_registration', 'Registers the endpoints, tenant and user for metering service with Keystone'
version '19.0.0'
%w(ubuntu redhat centos).each do |os|
supports os
@ -21,9 +11,9 @@ end
depends 'apache2', '~> 8.0'
depends 'openstackclient'
depends 'openstack-common', '>= 18.0.0'
depends 'openstack-identity', '>= 18.0.0'
depends 'openstack-common', '>= 19.0.0'
depends 'openstack-identity', '>= 19.0.0'
issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-telemetry'
chef_version '>= 14.0'
chef_version '>= 15.0'

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: agent-central
#
# Copyright 2013, AT&T Services, Inc.
# Copyright 2013, SUSE Linux GmbH
# Copyright:: 2013, AT&T Services, Inc.
# Copyright:: 2013, SUSE Linux GmbH
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -22,11 +23,9 @@
include_recipe 'openstack-telemetry::common'
platform = node['openstack']['telemetry']['platform']
platform['agent_central_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['agent_central_packages'] do
options platform['package_overrides']
action :upgrade
end
service 'ceilometer-agent-central' do

View File

@ -1,10 +1,11 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: agent-compute
#
# Copyright 2013, AT&T Services, Inc.
# Copyright 2013, SUSE Linux GmbH
# Copyright:: 2013, AT&T Services, Inc.
# Copyright:: 2013, SUSE Linux GmbH
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -22,11 +23,9 @@
include_recipe 'openstack-telemetry::common'
platform = node['openstack']['telemetry']['platform']
platform['agent_compute_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['agent_compute_packages'] do
options platform['package_overrides']
action :upgrade
end
service 'ceilometer-agent-compute' do

View File

@ -1,9 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: agent-notification
#
# Copyright 2014, IBM Corp.
# Copyright:: 2014, IBM Corp.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -21,11 +22,9 @@
include_recipe 'openstack-telemetry::common'
platform = node['openstack']['telemetry']['platform']
platform['agent_notification_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['agent_notification_packages'] do
options platform['package_overrides']
action :upgrade
end
service 'ceilometer-agent-notification' do

View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: aodh
#
# Copyright:: 2019-2020, Oregon State University
#
# 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
@ -25,11 +27,9 @@ end
include_recipe 'openstack-telemetry::common'
platform = node['openstack']['aodh']['platform']
platform['aodh_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['aodh_packages'] do
options platform['package_overrides']
action :upgrade
end
if node['openstack']['mq']['service_type'] == 'rabbit'
@ -64,8 +64,7 @@ end
directory node['openstack']['aodh']['conf_dir'] do
owner node['openstack']['aodh']['user']
group node['openstack']['aodh']['group']
mode 0o0750
action :create
mode '750'
end
# merge all config options and secrets to be used in the aodh.conf
@ -76,7 +75,8 @@ template node['openstack']['aodh']['conf_file'] do
cookbook 'openstack-common'
owner node['openstack']['aodh']['user']
group node['openstack']['aodh']['group']
mode 0o0640
mode '640'
sensitive true
variables(
service_config: aodh_conf_options
)
@ -111,7 +111,7 @@ aodh_apache_dir = "#{default_docroot_dir}/aodh"
directory aodh_apache_dir do
owner 'root'
group 'root'
mode 0o0755
mode '755'
end
aodh_server_entry = "#{aodh_apache_dir}/app"
@ -121,7 +121,7 @@ file aodh_server_entry do
content lazy { IO.read(platform['aodh-api_wsgi_file']) }
owner 'root'
group 'root'
mode 0o0755
mode '755'
end
template "#{apache_dir}/sites-available/aodh-api.conf" do

View File

@ -1,11 +1,12 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: common
#
# Copyright 2013, AT&T Services, Inc.
# Copyright 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright 2013-2014, SUSE Linux GmbH
# Copyright:: 2013, AT&T Services, Inc.
# Copyright:: 2013, Craig Tracey <craigtracey@gmail.com>
# Copyright:: 2013-2014, SUSE Linux GmbH
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -32,21 +33,18 @@ end
platform = node['openstack']['telemetry']['platform']
db_type = node['openstack']['db']['telemetry']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg|
package pkg do
action :upgrade
end
package node['openstack']['db']['python_packages'][db_type] do
action :upgrade
end
platform['common_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['common_packages'] do
options platform['package_overrides']
action :upgrade
end
if node['openstack']['mq']['service_type'] == 'rabbit'
node.default['openstack']['telemetry']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'telemetry'
node.default['openstack']['telemetry']['conf_secrets']['DEFAULT']['transport_url'] =
rabbit_transport_url 'telemetry'
end
db_user = node['openstack']['db']['telemetry']['username']
@ -75,16 +73,14 @@ end
directory node['openstack']['telemetry']['conf_dir'] do
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0750
action :create
mode '750'
end
directory "#{lock_dir}/ceilometer" do
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0750
mode '750'
recursive true
action :create
end
# merge all config options and secrets to be used in the ceilometer.conf
@ -105,7 +101,8 @@ template node['openstack']['telemetry']['conf_file'] do
cookbook 'openstack-common'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
mode '640'
sensitive true
variables(
service_config: ceilometer_conf_options
)
@ -115,7 +112,7 @@ template ::File.join(node['openstack']['telemetry']['conf_dir'], 'pipeline.yaml'
source 'pipeline.yaml.erb'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
mode '640'
variables(
publishers: node['openstack']['telemetry']['pipeline']['publishers']
)
@ -125,7 +122,7 @@ template ::File.join(node['openstack']['telemetry']['conf_dir'], 'polling.yaml')
source 'polling.yaml.erb'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
mode '640'
variables(
interval: node['openstack']['telemetry']['polling']['interval'],
meters: node['openstack']['telemetry']['polling']['meters']

View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: gnocchi_configure
#
# Copyright:: 2019-2020, Oregon State University
#
# 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
@ -54,7 +56,8 @@ template node['openstack']['telemetry_metric']['conf_file'] do
cookbook 'openstack-common'
owner node['openstack']['telemetry_metric']['user']
group node['openstack']['telemetry_metric']['group']
mode 0o0640
mode '640'
sensitive true
variables(
service_config: gnocchi_conf_options
)
@ -67,8 +70,8 @@ cookbook_file File.join(node['openstack']['telemetry']['conf_dir'], 'gnocchi_res
source 'gnocchi_resources.yaml'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
only_if { node['platform'] == 'ubuntu' }
mode '640'
only_if { platform?('ubuntu') }
end
# drop api-paste.ini to gnocchi folder (default ini will not use keystone auth)
@ -76,7 +79,7 @@ cookbook_file File.join(node['openstack']['telemetry_metric']['conf_dir'], 'api-
source 'api-paste.ini'
owner node['openstack']['telemetry_metric']['user']
group node['openstack']['telemetry_metric']['group']
mode 0o0640
mode '640'
end
# drop event_pipeline.yaml to ceilometer folder (gnocchi does not use events and
@ -86,7 +89,7 @@ cookbook_file File.join(node['openstack']['telemetry']['conf_dir'], 'event_pipel
source 'event_pipeline.yaml'
owner node['openstack']['telemetry']['user']
group node['openstack']['telemetry']['group']
mode 0o0640
mode '640'
end
if node['openstack']['telemetry_metric']['conf']['storage']['driver'] == 'file'
@ -99,7 +102,7 @@ if node['openstack']['telemetry_metric']['conf']['storage']['driver'] == 'file'
owner node['openstack']['telemetry_metric']['user']
group node['openstack']['telemetry_metric']['group']
recursive true
mode 0o0750
mode '750'
end
end
end
@ -133,7 +136,7 @@ gnocchi_apache_dir = "#{default_docroot_dir}/gnocchi"
directory gnocchi_apache_dir do
owner 'root'
group 'root'
mode 0o0755
mode '755'
end
gnocchi_server_entry = "#{gnocchi_apache_dir}/app"
@ -143,7 +146,7 @@ file gnocchi_server_entry do
content lazy { IO.read(platform['gnocchi-api_wsgi_file']) }
owner 'root'
group 'root'
mode 0o0755
mode '755'
end
template "#{apache_dir}/sites-available/gnocchi-api.conf" do

View File

@ -1,8 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: gnocchi_install
#
# Copyright:: 2020, Oregon State University
#
# 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
@ -19,12 +21,11 @@
include_recipe 'openstack-telemetry::common'
platform = node['openstack']['telemetry']['platform']
platform['gnocchi_packages'].each do |pkg|
package pkg do
options platform['package_overrides']
action :upgrade
end
package platform['gnocchi_packages'] do
options platform['package_overrides']
action :upgrade
end
# stop and disable the service gnocchi-api_service itself, since it should be run inside
# of apache
service platform['gnocchi-api_service'] do

View File

@ -1,9 +1,10 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: identity_registration
#
# Copyright 2013, AT&T Services, Inc.
# Copyright:: 2013, AT&T Services, Inc.
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -35,11 +36,11 @@ admin_domain = node['openstack']['identity']['admin_domain_name']
service_domain_name = node['openstack']['telemetry']['conf']['keystone_authtoken']['user_domain_name']
endpoint_type = node['openstack']['identity']['endpoint_type']
connection_params = {
openstack_auth_url: auth_url,
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_auth_url: auth_url,
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
openstack_domain_name: admin_domain,
openstack_endpoint_type: endpoint_type,
}

View File

@ -1,9 +1,9 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-telemetry
# Cookbook:: openstack-telemetry
# Recipe:: common
#
# Copyright 2019, Oregon State University
# Copyright:: 2019-2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@ -11,8 +11,8 @@ describe 'openstack-telemetry::agent-notification' do
include_context 'telemetry-stubs'
include_examples 'expect-runs-common-recipe'
it 'installs the agent-notification package' do
expect(chef_run).to upgrade_package 'openstack-ceilometer-collector'
it do
expect(chef_run).to upgrade_package %w(openstack-ceilometer-collector openstack-ceilometer-notification)
end
it 'starts the agent-notification service' do

View File

@ -11,12 +11,7 @@ describe 'openstack-telemetry::aodh' do
include_context 'telemetry-stubs'
it 'installs the aodh packages' do
expect(chef_run).to upgrade_package('openstack-aodh-api')
expect(chef_run).to upgrade_package('openstack-aodh-evaluator')
expect(chef_run).to upgrade_package('openstack-aodh-expirer')
expect(chef_run).to upgrade_package('openstack-aodh-listener')
expect(chef_run).to upgrade_package('openstack-aodh-notifier')
expect(chef_run).to upgrade_package('python-aodhclient')
expect(chef_run).to upgrade_package %w(openstack-aodh-api openstack-aodh-evaluator openstack-aodh-expirer openstack-aodh-listener openstack-aodh-notifier python-aodhclient)
end
it 'starts aodh services' do

View File

@ -9,12 +9,7 @@ describe 'openstack-telemetry::aodh' do
include_context 'telemetry-stubs'
it 'installs aodh packages' do
expect(chef_run).to upgrade_package('aodh-api')
expect(chef_run).to upgrade_package('aodh-evaluator')
expect(chef_run).to upgrade_package('aodh-expirer')
expect(chef_run).to upgrade_package('aodh-listener')
expect(chef_run).to upgrade_package('aodh-notifier')
expect(chef_run).to upgrade_package('python3-ceilometerclient')
expect(chef_run).to upgrade_package %w(aodh-api aodh-evaluator aodh-expirer aodh-listener aodh-notifier python3-ceilometerclient)
end
it do
@ -42,7 +37,8 @@ describe 'openstack-telemetry::aodh' do
cookbook: 'openstack-common',
user: 'aodh',
group: 'aodh',
mode: 0o640,
mode: '640',
sensitive: true,
variables: {
service_config: {
'DEFAULT' => {
@ -127,7 +123,7 @@ describe 'openstack-telemetry::aodh' do
expect(chef_run).to create_directory('/var/www/html/aodh').with(
user: 'root',
group: 'root',
mode: 0o0755
mode: '755'
)
end
@ -135,7 +131,7 @@ describe 'openstack-telemetry::aodh' do
expect(chef_run).to create_file('/var/www/html/aodh/app').with(
user: 'root',
group: 'root',
mode: 0o0755
mode: '755'
)
end

View File

@ -14,9 +14,8 @@ describe 'openstack-telemetry::common' do
expect(chef_run).to upgrade_package 'MySQL-python'
end
it 'installs the common package' do
expect(chef_run).to upgrade_package 'openstack-ceilometer-common'
expect(chef_run).to upgrade_package 'mod_wsgi'
it 'installs the common packages' do
expect(chef_run).to upgrade_package %w(openstack-ceilometer-common mod_wsgi)
end
end
end

View File

@ -25,9 +25,8 @@ describe 'openstack-telemetry::common' do
expect(chef_run).to upgrade_package 'python3-mysqldb'
end
it 'installs the common package' do
expect(chef_run).to upgrade_package 'ceilometer-common'
expect(chef_run).to upgrade_package 'python3-ceilometer'
it 'installs the common packages' do
expect(chef_run).to upgrade_package %w(ceilometer-common python3-ceilometer)
end
describe '/etc/ceilometer/pipeline.yaml' do
@ -43,7 +42,7 @@ EOL
source: 'pipeline.yaml.erb',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
mode: '640'
)
end
@ -92,7 +91,7 @@ EOL
source: 'polling.yaml.erb',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
mode: '640'
)
end
@ -108,7 +107,7 @@ EOL
expect(chef_run).to create_directory(dir.name).with(
user: 'ceilometer',
group: 'ceilometer',
mode: 0o750
mode: '750'
)
end
end
@ -118,9 +117,12 @@ EOL
it 'creates the file' do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'ceilometer',
group: 'ceilometer',
mode: 0o640
mode: '640',
sensitive: true
)
end

View File

@ -16,7 +16,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
source: 'gnocchi_resources.yaml',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
mode: '640'
)
end
end

View File

@ -25,9 +25,12 @@ describe 'openstack-telemetry::gnocchi_configure' do
it do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'gnocchi',
group: 'gnocchi',
mode: 0o640
mode: '640',
sensitive: true
)
end
@ -80,7 +83,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
source: 'gnocchi_resources.yaml',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
mode: '640'
)
end
@ -90,7 +93,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
source: 'api-paste.ini',
owner: 'gnocchi',
group: 'gnocchi',
mode: 0o0640
mode: '640'
)
end
@ -100,7 +103,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
source: 'event_pipeline.yaml',
owner: 'ceilometer',
group: 'ceilometer',
mode: 0o0640
mode: '640'
)
end
@ -111,7 +114,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
.with(
user: 'gnocchi',
group: 'gnocchi',
mode: 0o750
mode: '750'
)
end
context 'other storage backend' do
@ -124,7 +127,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
.with(
user: 'gnocchi',
group: 'gnocchi',
mode: 0o750
mode: '750'
)
end
end
@ -151,7 +154,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
expect(chef_run).to create_directory('/var/www/html/gnocchi').with(
user: 'root',
group: 'root',
mode: 0o0755
mode: '755'
)
end
@ -159,7 +162,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
expect(chef_run).to create_file('/var/www/html/gnocchi/app').with(
user: 'root',
group: 'root',
mode: 0o0755
mode: '755'
)
end

View File

@ -0,0 +1,22 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-telemetry::gnocchi_install' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
cached(:chef_run) { runner.converge(described_recipe) }
include_context 'telemetry-stubs'
it do
expect(chef_run).to upgrade_package %w(openstack-gnocchi-api openstack-gnocchi-metricd)
end
it do
expect(chef_run).to stop_service('openstack-gnocchi-api')
expect(chef_run).to disable_service('openstack-gnocchi-api')
end
end
end

View File

@ -10,25 +10,13 @@ describe 'openstack-telemetry::gnocchi_install' do
include_context 'telemetry-stubs'
%w(
gnocchi-api
gnocchi-common
gnocchi-metricd
python3-gnocchi
python3-gnocchiclient
).each do |p|
it do
expect(chef_run).to upgrade_package p
end
it do
expect(chef_run).to upgrade_package %w(gnocchi-api gnocchi-common gnocchi-metricd python3-gnocchi python3-gnocchiclient)
end
it do
expect(chef_run).to stop_service('gnocchi-api')
expect(chef_run).to disable_service('gnocchi-api')
end
it do
expect(chef_run).to upgrade_package 'gnocchi-metricd'
end
end
end