Retire openstack-chef: remove repo content

OpenStack-chef project is retiring
- https://review.opendev.org/c/openstack/governance/+/905279

this commit remove the content of this project repo

Depends-On: https://review.opendev.org/c/openstack/project-config/+/909134
Change-Id: I028dee11bce572e0ceaa8b2f1dab22a1abe00779
This commit is contained in:
Ghanshyam Mann 2024-02-15 14:16:10 -08:00
parent 6d907dedf3
commit 48c2e02d00
16 changed files with 8 additions and 823 deletions

View File

@ -1,9 +0,0 @@
[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"

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 @@
Chef/Modernize/FoodcriticComments:
Enabled: true
Chef/Style/CopyrightCommentFormat:
Enabled: true

View File

@ -1,3 +0,0 @@
- project:
templates:
- openstack-chef-jobs

View File

@ -1,13 +0,0 @@
source 'https://supermarket.chef.io'
solver :ruby, :required
%w(-common).each do |cookbook|
if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}"
else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}"
end
end
metadata

View File

@ -1,36 +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: groups.google.com/group/opscode-chef-openstack
IRC: #openstack-chef is our channel on irc.oftc.net
Wiki: https://wiki.openstack.org/wiki/Chef/GettingStarted and https://docs.getchef.com/openstack.html
Twitter: @chefopenstack

176
LICENSE
View File

@ -1,176 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

View File

@ -1,155 +1,10 @@
OpenStack Chef Cookbook - ops-messaging
=======================================
This project is no longer maintained.
.. image:: https://governance.openstack.org/badges/cookbook-openstack-ops-messaging.svg
:target: https://governance.openstack.org/reference/tags/index.html
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".
Description
===========
This cookbook provides shared message queue configuration for the
OpenStack deployment provided by Chef for OpenStack. The `OpenStack
chef-repo`_ contains documentation for using this cookbook in the
context of a full OpenStack deployment. It currently supports RabbitMQ
and will soon other queues.
.. _OpenStack chef-repo: https://opendev.org/openstack/openstack-chef
Requirements
============
- Chef 16 or higher
- Chef Workstation 21.10.640 for testing (also includes berkshelf for
cookbook dependency resolution)
Platforms
=========
- ubuntu
- redhat
- centos
Cookbooks
=========
The following cookbooks are dependencies:
- 'openstack-common', '>= 20.0.0'
- 'rabbitmq', '=> 5.8.5'
Usage
=====
The usage of this cookbook is optional, you may choose to set up your
own messaging service without using this cookbook. If you choose to do
so, you will need to provide all of the attributes listed under the
`Attributes <#attributes>`__.
Resources/Providers
===================
None
Templates
=========
None
Recipes
=======
rabbitmq-server
---------------
- Installs and configures RabbitMQ and is called via the server recipe
Attributes
==========
- ``openstack["mq"]["cluster"]`` - whether or not to cluster rabbit,
defaults to ``false``
The following attributes are defined in ``attributes/messaging.rb`` of
the common cookbook, but are documented here due to their relevance:
- ``openstack["endpoints"]["mq"]["host"]`` - The IP address to bind the
rabbit service to
- ``openstack["endpoints"]["mq"]["port"]`` - The port to bind the
rabbit service to
- ``openstack["endpoints"]["mq"]["bind_interface"]`` - The interface
name to bind the rabbit service to
- ``openstack["mq"]["rabbitmq"]["use_ssl"]`` - Enables/disables SSL for
RabbitMQ, the default is false.
If the value of the ``bind_interface`` attribute is non-nil, then the
rabbit service will be bound to the first IP address on that interface.
If the value of the ``bind_interface`` attribute is nil, then the rabbit
service will be bound to the IP address specified in the host attribute.
Testing
=======
Please refer to the `TESTING.md`_ for instructions for testing the
cookbook.
.. _TESTING.md: cookbook-openstack-ops-messaging/src/branch/master/TESTING.md
Berkshelf
=========
Berks will resolve version requirements and dependencies on first run
and store these in ``Berksfile.lock``. If new cookbooks become available
you can run ``berks update`` to update the references in
``Berksfile.lock``. ``Berksfile.lock`` will be included in stable
branches to provide a known good set of dependencies. ``Berksfile.lock``
will not be included in development branches to encourage development
against the latest cookbooks.
License and Author
==================
+-----------------+-------------------------------------------+
| **Author** | John Dewey (john@dewey.ws) |
+-----------------+-------------------------------------------+
| **Author** | Matt Ray (matt@opscode.com) |
+-----------------+-------------------------------------------+
| **Author** | Craig Tracey (craigtracey@gmail.com) |
+-----------------+-------------------------------------------+
| **Author** | Ionut Artarisi (iartarisi@suse.cz) |
+-----------------+-------------------------------------------+
| **Author** | JieHua Jin (jinjhua@cn.ibm.com) |
+-----------------+-------------------------------------------+
| **Author** | Mark Vanderwiel (vanderwl@us.ibm.com) |
+-----------------+-------------------------------------------+
| **Author** | Jan Klare (j.klare@x-ion.de) |
+-----------------+-------------------------------------------+
| **Author** | Lance Albertson (lance@osuosl.org) |
+-----------------+-------------------------------------------+
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, Opscode, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, Craig Tracey |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013, SUSE Linux GmbH. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2014, IBM Corp. |
+-----------------+--------------------------------------------------+
| **Copyright** | Copyright (c) 2019-2021, 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
::
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.
For any further questions, please email
openstack-discuss@lists.openstack.org or join #openstack-dev on
OFTC.

View File

@ -1,39 +0,0 @@
task default: ['test']
task test: [:syntax, :lint, :unit]
desc 'Vendor the cookbooks in the Berksfile'
task :berks_prep do
sh %(chef exec berks vendor)
end
desc 'Run FoodCritic (syntax) tests'
task :syntax do
sh %(chef exec foodcritic --exclude spec -f any .)
end
desc 'Run RuboCop (lint) tests'
task :lint do
sh %(chef exec cookstyle)
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://opendev.org/openstack/cookbook-openstack-common/raw/branch/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,36 +0,0 @@
#
# Cookbook:: openstack-ops-messaging
# Recipe:: default
#
# Copyright:: 2013-2021, AT&T Services, Inc.
# Copyright:: 2013-2021, Chef Software, Inc.
# Copyright:: 2019-2021, 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
#
# 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.
#
default['openstack']['mq']['cluster'] = false
# Allow cluster_disk_nodes to be optionally set based upon a node role search.
# If set to false, mq cluster nodes can be added on-the-fly using the cluster command.
# see https://www.rabbitmq.com/clustering.html
default['openstack']['mq']['search_for_cluster_disk_nodes'] = true
normal['rabbitmq']['use_distro_version'] = true
if platform_family?('debian', 'suse')
normal['rabbitmq']['config'] = '/etc/rabbitmq/rabbitmq.config'
end
# Enable the rabbitmq management plugin by default
default['openstack']['mq']['rabbitmq']['enable_mgmt_console'] = true

View File

@ -1,17 +0,0 @@
name 'openstack-ops-messaging'
maintainer 'openstack-chef'
maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0'
description 'Provides the shared messaging configuration for Chef for OpenStack.'
version '20.0.0'
%w(ubuntu redhat centos).each do |os|
supports os
end
depends 'openstack-common', '>= 20.0.0'
depends 'rabbitmq', '>= 5.8.5'
issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-ops-messaging'
chef_version '>= 16.0'

View File

@ -1,102 +0,0 @@
#
# Cookbook:: openstack-ops-messaging
# Recipe:: rabbitmq-server
#
# Copyright:: 2013-2021, Chef Software, Inc.
# Copyright:: 2013-2021, AT&T Services, Inc.
# Copyright:: 2013-2021, Craig Tracey <craigtracey@gmail.com>
#
# 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
include ::Openstack
end
user = node['openstack']['mq']['user']
pass = get_password 'user', user
vhost = node['openstack']['mq']['vhost']
bind_mq = node['openstack']['bind_service']['mq']
bind_mq = bind_mq
bind_mq_address = bind_address bind_mq
# Used by OpenStack#rabbit_servers/#rabbit_server
node.default['openstack']['mq']['listen'] = bind_mq_address
if node['openstack']['mq']['rabbitmq']['use_ssl']
if node['rabbitmq']['ssl_port'] != bind_mq['port']
node.default['rabbitmq']['ssl_port'] = bind_mq['port']
else
Chef::Log.error "Unable to listen on the port #{bind_mq['port']} for RabbitMQ TCP, which is listened on by SSL!"
end
else
node.default['rabbitmq']['port'] = bind_mq['port']
end
node.default['rabbitmq']['address'] = bind_mq_address
node.default['rabbitmq']['nodename'] = "#{user}@#{node['hostname']}"
# Clustering
if node['openstack']['mq']['cluster']
node.default['rabbitmq']['clustering']['enable'] = node['openstack']['mq']['cluster']
node.default['rabbitmq']['erlang_cookie'] = get_password 'service', 'rabbit_cookie'
if node['openstack']['mq']['search_for_cluster_disk_nodes']
qs = "recipes:openstack-ops-messaging\\:\\:rabbitmq-server AND chef_environment:#{node.chef_environment}"
node.default['rabbitmq']['clustering']['use_auto_clustering'] = true
node.default['rabbitmq']['clustering']['cluster_nodes'] =
search(:node, qs).sort_by { |n| n['hostname'] }.map do |n|
{ name: "#{user}@#{n['hostname']}" }
end
end
end
include_recipe 'rabbitmq'
if node['openstack']['mq']['rabbitmq']['enable_mgmt_console']
include_recipe 'rabbitmq::mgmt_console'
else
rabbitmq_plugin 'rabbitmq_management' do
action :disable
end
end
rabbitmq_user 'add openstack rabbit user' do
user user
password pass
sensitive true
end
rabbitmq_user 'change openstack rabbit user password' do
user user
password pass
sensitive true
action :change_password
end
rabbitmq_vhost 'add openstack rabbit vhost' do
vhost vhost
sensitive true
end
rabbitmq_user 'set openstack user permissions' do
user user
vhost vhost
permissions '.* .* .*'
sensitive true
action :set_permissions
end
# Necessary for graphing.
rabbitmq_user 'set rabbit administrator tag' do
user user
tag 'administrator'
sensitive true
action :set_tags
end

View File

@ -1,17 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-ops-messaging::rabbitmq-server' do
ALL_RHEL.each do |p|
context "redhat #{p[:version]}" do
let(:runner) { ChefSpec::SoloRunner.new(p) }
let(:node) { runner.node }
cached(:chef_run) { runner.converge(described_recipe) }
include_context 'ops_messaging_stubs'
it 'does not set use_distro_version to true' do
expect(chef_run.node['rabbitmq']['use_distro_version']).to be_truthy
end
end
end
end

View File

@ -1,128 +0,0 @@
require_relative 'spec_helper'
describe 'openstack-ops-messaging::rabbitmq-server' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) { runner.converge(described_recipe) }
include_context 'ops_messaging_stubs'
it 'overrides default rabbit attributes' do
expect(chef_run.node['openstack']['endpoints']['mq']['port']).to eq('5672')
expect(chef_run.node['openstack']['mq']['listen']).to eq('127.0.0.1')
expect(chef_run.node['openstack']['mq']['rabbitmq']['use_ssl']).to be_falsey
expect(chef_run.node['rabbitmq']['port']).to eq('5672')
expect(chef_run.node['rabbitmq']['address']).to eq('127.0.0.1')
expect(chef_run.node['rabbitmq']['use_distro_version']).to be_truthy
end
context 'override rabbit and openstack image attributes' do
cached(:chef_run) do
node.override['openstack']['bind_service']['mq']['interface'] = 'enp0s3'
node.override['openstack']['bind_service']['mq']['port'] = '4242'
node.override['openstack']['endpoints']['mq']['port'] = '4242'
node.override['openstack']['mq']['user'] = 'foo'
node.override['openstack']['mq']['vhost'] = '/bar'
runner.converge(described_recipe)
end
it 'overrides rabbit and openstack image attributes' do
expect(chef_run.node['openstack']['mq']['listen']).to eq('33.44.55.66')
expect(chef_run.node['openstack']['mq']['image']['rabbit']['port']).to eq('4242')
expect(chef_run.node['openstack']['mq']['image']['rabbit']['userid']).to eq('foo')
expect(chef_run.node['openstack']['mq']['image']['rabbit']['vhost']).to eq('/bar')
end
end
context 'rabbit ssl' do
cached(:chef_run) do
node.override['openstack']['mq']['rabbitmq']['use_ssl'] = true
node.override['openstack']['bind_service']['mq']['port'] = '1234'
runner.converge(described_recipe)
end
it 'overrides rabbit ssl attributes' do
expect(chef_run.node['openstack']['mq']['rabbitmq']['use_ssl']).to be_truthy
end
end
context 'cluster' do
cached(:chef_run) do
node.override['openstack']['mq'] = { 'cluster' => true }
runner.converge(described_recipe)
end
it 'overrides cluster' do
expect(chef_run.node['rabbitmq']['clustering']['enable']).to be_truthy
end
it 'overrides erlang_cookie' do
expect(chef_run.node['rabbitmq']['erlang_cookie']).to eq(
'erlang-cookie'
)
end
it 'overrides and sorts cluster_disk_nodes' do
expect(chef_run.node['rabbitmq']['clustering']['cluster_nodes']).to eq(
[{ 'name' => 'openstack@host1' }, { 'name' => 'openstack@host2' }]
)
end
context 'search_for_cluster_disk_nodes false' do
cached(:chef_run) do
node.override['openstack']['mq'] = { 'cluster' => true }
node.override['openstack']['mq']['search_for_cluster_disk_nodes'] = false
runner.converge(described_recipe)
end
it 'does not search for cluster_disk_nodes' do
expect(chef_run.node['rabbitmq']['clustering']['cluster_nodes']).to eq([])
end
end
end
it 'includes rabbit recipes' do
expect(chef_run).to include_recipe 'rabbitmq'
expect(chef_run).to include_recipe 'rabbitmq::mgmt_console'
end
describe 'lwrps' do
context 'custom mq attributes' do
cached(:chef_run) do
node.override['openstack']['mq']['user'] = 'not-a-guest'
node.override['openstack']['mq']['vhost'] = '/foo'
runner.converge(described_recipe)
end
it 'adds openstack rabbit user' do
expect(chef_run).to add_rabbitmq_user(
'add openstack rabbit user'
).with(user: 'not-a-guest', password: 'rabbit-pass')
end
it 'changes openstack rabbit user password' do
expect(chef_run).to change_password_rabbitmq_user(
'change openstack rabbit user password'
).with(user: 'not-a-guest', password: 'rabbit-pass')
end
it 'adds openstack rabbit vhost' do
expect(chef_run).to add_rabbitmq_vhost(
'add openstack rabbit vhost'
).with(vhost: '/foo')
end
it 'sets openstack user permissions' do
expect(chef_run).to set_permissions_rabbitmq_user(
'set openstack user permissions'
).with(user: 'not-a-guest', vhost: '/foo', permissions: '.* .* .*')
end
it 'sets administrator tag' do
expect(chef_run).to set_tags_rabbitmq_user(
'set rabbit administrator tag'
).with(user: 'not-a-guest', tag: 'administrator')
end
end
end
end
end

View File

@ -1,51 +0,0 @@
require 'chefspec'
require 'chefspec/berkshelf'
RSpec.configure do |config|
config.color = true
config.formatter = :documentation
config.log_level = :warn
end
REDHAT_7 = {
platform: 'redhat',
version: '7',
}.freeze
REDHAT_8 = {
platform: 'redhat',
version: '8',
}.freeze
ALL_RHEL = [
REDHAT_7,
REDHAT_8,
].freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '18.04',
}.freeze
shared_context 'ops_messaging_stubs' do
before do
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
.with('lo')
.and_return '127.0.0.1'
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
.with('enp0s3')
.and_return '33.44.55.66'
allow_any_instance_of(Chef::Recipe).to receive(:search)
.with(:node, 'recipes:openstack-ops-messaging\\:\\:rabbitmq-server AND chef_environment:_default')
.and_return [
{ 'hostname' => 'host2' },
{ 'hostname' => 'host1' },
]
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', anything)
.and_return 'rabbit-pass'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'rabbit_cookie')
.and_return 'erlang-cookie'
end
end