diff --git a/.delivery/project.toml b/.delivery/project.toml deleted file mode 100644 index 4066e55..0000000 --- a/.delivery/project.toml +++ /dev/null @@ -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" diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d7ee44a..0000000 --- a/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -.bundle/ -berks-cookbooks/ -.kitchen -.vagrant -.coverage/ -*.swp -Berksfile.lock -Vagrantfile -Gemfile.lock diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 389f270..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,4 +0,0 @@ -Chef/Modernize/FoodcriticComments: - Enabled: true -Chef/Style/CopyrightCommentFormat: - Enabled: true diff --git a/.zuul.yaml b/.zuul.yaml deleted file mode 100644 index f578684..0000000 --- a/.zuul.yaml +++ /dev/null @@ -1,3 +0,0 @@ -- project: - templates: - - openstack-chef-jobs diff --git a/Berksfile b/Berksfile deleted file mode 100644 index 6838cc4..0000000 --- a/Berksfile +++ /dev/null @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index bb03231..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -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 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/LICENSE +++ /dev/null @@ -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. - diff --git a/README.rst b/README.rst index 91767d6..6080cfb 100644 --- a/README.rst +++ b/README.rst @@ -1,204 +1,14 @@ -OpenStack Chef Cookbook - ops-database -====================================== +This project is no longer maintained. -.. image:: https://governance.openstack.org/badges/cookbook-openstack-ops-database.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 -=========== +(Optional:) +For an alternative project, please see at +. -This cookbook provides a reference example of database configuration for -the OpenStack deployment provided by Chef for OpenStack. It currently -supports MariaDB. - -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: - -- 'mariadb', '~> 5.0' -- 'openstack-common', '~> 20.0.0' - -Usage -===== - -The usage of this cookbook is optional, you may choose to set up your own -databases without using this cookbook. If you choose to do so, you will need to -do the following: - -- create the schema specified by the ``openstack-db`` recipe. -- create and upload encrypted data bags into your chef environment, as - specified by ``#get_password`` in the ``openstack-db`` recipe. - -Resources/Providers -=================== - -None - -Templates -========= - -None - -Recipes -======= - -client ------- - -- Installs client packages for the database used by the deployment. - -server ------- - -- Installs and configures server packages for the database used by the - deployment. - -mariadb-client --------------- - -- Installs MariaDB client packages. - -mariadb-server --------------- - -- Installs and configures MariaDB server packages. - -mariadb-cluster-client ----------------------- - -- Installs MariaDB Cluster client packages. - -mariadb-cluster-server ----------------------- - -- Installs and configures MariaDB Cluster server packages. - -openstack-db ------------- - -- Creates necessary tables, users, and grants for OpenStack. - -Attributes -========== - -The following attributes are defined in ``attributes/database.rb`` of the -common cookbook, but are documented here due to their relevance: - -- ``openstack['endpoints']['db']['host']`` - The IP address to bind the - database service to -- ``openstack['endpoints']['db']['port']`` - The port to bind the database - service to -- ``openstack['endpoints']['db']['bind_interface']`` - The interface name to - bind the database service to -- ``openstack['db']['root_user_key']`` - The key used to retrieve the root user - password; the key is both the name of the data-bag item and name of - the key containing the password value within the data-bag item. This - is defined in Common. - -If the value of the ``bind_interface`` attribute is non-nil, then the -database service will be bound to the first IP address on that -interface. If the value of the ``bind_interface`` attribute is nil, then -the database service will be bound to the IP address specified in the -host attribute. - -See the attributes ``mysql.rb`` file for the mysql specific attributes -that are available. - -For more information see: -http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html - -Testing -======= - -Please refer to the `TESTING.md`_ for instructions for testing the cookbook. - -.. _TESTING.md: cookbook-openstack-ops-database/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** | Justin Shepherd (justin.shepherd@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Jason Cannavale (jason.cannavale@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Ron Pedde (ron.pedde@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Joseph Breu (joseph.breu@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | William Kelly (william.kelly@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Darren Birkett (darren.birkett@rackspace.co.uk) | -+-----------------+---------------------------------------------------+ -| **Author** | Evan Callicoat (evan.callicoat@rackspace.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Matt Thompson (matt.thompson@rackspace.co.uk) | -+-----------------+---------------------------------------------------+ -| **Author** | Matt Ray (matt@opscode.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Sean Gallagher () | -+-----------------+---------------------------------------------------+ -| **Author** | John Dewey (jdewey@att.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Ionut Artarisi (iartarisi@suse.cz) | -+-----------------+---------------------------------------------------+ -| **Author** | Mark Vanderwiel (vanderwl@us.ibm.com) | -+-----------------+---------------------------------------------------+ -| **Author** | Jan Klare (j.klare@x-ion.de) | -+-----------------+---------------------------------------------------+ -| **Author** | Lance Albertson (lance@osuosl.org) | -+-----------------+---------------------------------------------------+ - -+-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. | -+-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. | -+-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2013, AT&T Services, Inc. | -+-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2013-2014, SUSE Linux GmbH | -+-----------------+---------------------------------------------------+ -| **Copyright** | Copyright (c) 2014-2015, 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. diff --git a/Rakefile b/Rakefile deleted file mode 100644 index 6ec521b..0000000 --- a/Rakefile +++ /dev/null @@ -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 diff --git a/TESTING.md b/TESTING.md deleted file mode 100644 index 1dd45c5..0000000 --- a/TESTING.md +++ /dev/null @@ -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. diff --git a/attributes/default.rb b/attributes/default.rb deleted file mode 100644 index 36b0482..0000000 --- a/attributes/default.rb +++ /dev/null @@ -1,25 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: default -# -# Copyright:: 2013-2021, AT&T Services, Inc. -# -# 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. -# - -# Set to some text value if you want templated config files -# to contain a custom banner at the top of the written file -default['openstack']['db']['custom_template_banner'] = ' -# This file is automatically generated by Chef -# Any changes will be overwritten -' diff --git a/attributes/mysql.rb b/attributes/mysql.rb deleted file mode 100644 index ad07f7e..0000000 --- a/attributes/mysql.rb +++ /dev/null @@ -1,57 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: default -# -# 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. -# - -# MySQL attributes that we select defaults for: - -# MariaDB version -default['openstack']['mariadb']['version'] = '10.3' -# Whether to set up mariadb repo -default['openstack']['mariadb']['setup_repo'] = true -# Storage engine, base OpenStack requires the InnoDB flavor -default['openstack']['mysql']['default-storage-engine'] = 'InnoDB' -# InnoDB lock mode for generating auto-increment values -default['openstack']['mysql']['innodb_autoinc_lock_mode'] = 1 -# InnoDB give each table its own file -default['openstack']['mysql']['innodb_file_per_table'] = 0 -# InnoDB thread concurrency -default['openstack']['mysql']['innodb_thread_concurrency'] = 0 -# InnoDB commit concurrency -default['openstack']['mysql']['innodb_commit_concurrency'] = 0 -# InnoDB number of read io threads -default['openstack']['mysql']['innodb_read_io_threads'] = 4 -# InnoDB number of commit transactions to flush log -default['openstack']['mysql']['innodb_flush_log_at_trx_commit'] = 1 -# InnoDB memory buffer for caching table data and indexes -default['openstack']['mysql']['innodb_buffer_pool_size'] = '134217728' -# InnoDB size of each log file in a log group -default['openstack']['mysql']['innodb_log_file_size'] = '5242880' -# InnoDB size of buffer for logs -default['openstack']['mysql']['innodb_log_buffer_size'] = '8388608' -# Skip name resolution -default['openstack']['mysql']['skip-name-resolve'] = false -# Character set -default['openstack']['mysql']['character-set-server'] = 'latin1' -# Memory allocated for caching query results -default['openstack']['mysql']['query_cache_size'] = '0' -# Maximum number of connections -default['openstack']['mysql']['max_connections'] = 307 -# Increased connect timeout to give services time to warm up -default['openstack']['mysql']['connect_timeout'] = 30 -# Default wait timeout -default['openstack']['mysql']['wait_timeout'] = 600 -# Default temp directory -default['openstack']['mysql']['tmpdir'] = '/var/tmp' diff --git a/files/default/clustercheck b/files/default/clustercheck deleted file mode 100644 index f37ab45..0000000 --- a/files/default/clustercheck +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash -# -# Script to make a proxy (ie HAProxy) capable of monitoring MariaDB Cluster nodes properly -# -# Author: Olaf van Zandwijk -# Author: Raghavendra Prabhu -# -# Documentation and download: https://github.com/olafz/percona-clustercheck -# -# Based on the original script from Unai Rodriguez -# -# Updated for MariaDB by: Jens Harbott -# - -if [[ $1 == '-h' || $1 == '--help' ]];then - echo "Usage: $0 " - exit -fi - -# if the disabled file is present, return 503. This allows -# admins to manually remove a node from a cluster easily. -if [ -e "/var/tmp/clustercheck.disabled" ]; then - # Shell return-code is 1 - echo -en "HTTP/1.1 503 Service Unavailable\r\n" - echo -en "Content-Type: text/plain\r\n" - echo -en "Connection: close\r\n" - echo -en "Content-Length: 51\r\n" - echo -en "\r\n" - echo -en "MariaDB Cluster Node is manually disabled.\r\n" - sleep 0.1 - exit 1 -fi - -MYSQL_USERNAME="${1-clustercheckuser}" -MYSQL_PASSWORD="${2-clustercheckpassword!}" -AVAILABLE_WHEN_DONOR=${3:-0} -ERR_FILE="${4:-/dev/null}" -AVAILABLE_WHEN_READONLY=${5:-1} -DEFAULTS_EXTRA_FILE=${6:-/etc/my.cnf} - -#Timeout exists for instances where mysqld may be hung -TIMEOUT=10 - -EXTRA_ARGS="" -if [[ -n "$MYSQL_USERNAME" ]]; then - EXTRA_ARGS="$EXTRA_ARGS --user=${MYSQL_USERNAME}" -fi -if [[ -n "$MYSQL_PASSWORD" ]]; then - EXTRA_ARGS="$EXTRA_ARGS --password=${MYSQL_PASSWORD}" -fi -if [[ -r $DEFAULTS_EXTRA_FILE ]];then - MYSQL_CMDLINE="mysql --defaults-extra-file=$DEFAULTS_EXTRA_FILE -nNE --connect-timeout=$TIMEOUT \ - ${EXTRA_ARGS}" -else - MYSQL_CMDLINE="mysql -nNE --connect-timeout=$TIMEOUT ${EXTRA_ARGS}" -fi -# -# Perform the query to check the wsrep_local_state -# -WSREP_STATUS=$($MYSQL_CMDLINE -e "SHOW STATUS LIKE 'wsrep_local_state';" \ - 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) - -if [[ "${WSREP_STATUS}" == "4" ]] || [[ "${WSREP_STATUS}" == "2" && ${AVAILABLE_WHEN_DONOR} == 1 ]] -then - # Check only when set to 0 to avoid latency in response. - if [[ $AVAILABLE_WHEN_READONLY -eq 0 ]];then - READ_ONLY=$($MYSQL_CMDLINE -e "SHOW GLOBAL VARIABLES LIKE 'read_only';" \ - 2>${ERR_FILE} | tail -1 2>>${ERR_FILE}) - - if [[ "${READ_ONLY}" == "ON" ]];then - # MariaDB Cluster node local state is 'Synced', but it is in - # read-only mode. The variable AVAILABLE_WHEN_READONLY is set to 0. - # => return HTTP 503 - # Shell return-code is 1 - echo -en "HTTP/1.1 503 Service Unavailable\r\n" - echo -en "Content-Type: text/plain\r\n" - echo -en "Connection: close\r\n" - echo -en "Content-Length: 43\r\n" - echo -en "\r\n" - echo -en "MariaDB Cluster Node is read-only.\r\n" - sleep 0.1 - exit 1 - fi - fi - # MariaDB Cluster node local state is 'Synced' => return HTTP 200 - # Shell return-code is 0 - echo -en "HTTP/1.1 200 OK\r\n" - echo -en "Content-Type: text/plain\r\n" - echo -en "Connection: close\r\n" - echo -en "Content-Length: 40\r\n" - echo -en "\r\n" - echo -en "MariaDB Cluster Node is synced.\r\n" - sleep 0.1 - exit 0 -else - # MariaDB Cluster node local state is not 'Synced' => return HTTP 503 - # Shell return-code is 1 - echo -en "HTTP/1.1 503 Service Unavailable\r\n" - echo -en "Content-Type: text/plain\r\n" - echo -en "Connection: close\r\n" - echo -en "Content-Length: 44\r\n" - echo -en "\r\n" - echo -en "MariaDB Cluster Node is not synced.\r\n" - sleep 0.1 - exit 1 -fi diff --git a/metadata.rb b/metadata.rb deleted file mode 100755 index 28b4c07..0000000 --- a/metadata.rb +++ /dev/null @@ -1,18 +0,0 @@ -name 'openstack-ops-database' -maintainer 'openstack-chef' -maintainer_email 'openstack-discuss@lists.openstack.org' -license 'Apache-2.0' -description 'Provides the shared database configuration for OpenStack' -version '20.0.0' - -%w(ubuntu redhat centos).each do |os| - supports os -end - -depends 'openstack-common', '>= 20.0.0' - -depends 'mariadb', '~> 5.0' - -issues_url 'https://launchpad.net/openstack-chef' -source_url 'https://opendev.org/openstack/cookbook-openstack-ops-database' -chef_version '>= 16.0' diff --git a/recipes/client.rb b/recipes/client.rb deleted file mode 100644 index 84b160b..0000000 --- a/recipes/client.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: client -# -# Copyright:: 2013-2021, Chef Software, Inc. -# Copyright:: 2013-2021, AT&T Services, Inc. -# -# 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. -# - -include_recipe "openstack-ops-database::#{node['openstack']['db']['service_type']}-client" diff --git a/recipes/mariadb-client.rb b/recipes/mariadb-client.rb deleted file mode 100644 index c3fd96f..0000000 --- a/recipes/mariadb-client.rb +++ /dev/null @@ -1,24 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: mariadb-client -# -# 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. -# -mariadb_client_install 'default' do - version node['openstack']['mariadb']['version'] - setup_repo node['openstack']['mariadb']['setup_repo'] -end - -node['openstack']['db']['python_packages']['mariadb'].each do |pkg| - package pkg -end diff --git a/recipes/mariadb-cluster-client.rb b/recipes/mariadb-cluster-client.rb deleted file mode 100644 index f2c1104..0000000 --- a/recipes/mariadb-cluster-client.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: mariadb-cluster-client -# -# 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. -# - -include_recipe 'openstack-ops-database::mariadb-client' diff --git a/recipes/mariadb-cluster-server.rb b/recipes/mariadb-cluster-server.rb deleted file mode 100644 index 03543ff..0000000 --- a/recipes/mariadb-cluster-server.rb +++ /dev/null @@ -1,77 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: mariadb-cluster-server -# -# 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 - -## INFO: to use this recipe, set node['openstack']['db']['service_type'] = 'mariadb-cluster' in your environment - -bind_db = node['openstack']['bind_service']['db'] -if bind_db['interface'].nil? - Chef::Log.fatal('Need to specify interface to bind to.') - raise -end -listen_address = address_for(bind_db['interface']) - -## CLUSTER SPECIFIC CONFIG -gmcast_listen_addr = "tcp://#{listen_address}:4567" -### find all nodes in the mariadb cluster -cluster_nodes = search(:node, 'recipes:"openstack-ops-database\:\:mariadb-cluster-server"').sort -# if it's the first node make sure that wsrep_cluster_address is set to nothing to be able to bootstrap. -is_first_node = cluster_nodes.empty? || (cluster_nodes.size == 1 && cluster_nodes.first['fqdn'] == node['fqdn']) -if is_first_node - gcomm_address = 'gcomm://' -else - # otherwise set the correct cluster address with all cluster nodes - family = node['openstack']['endpoints']['family'] - cluster_nodes_addresses = [] - cluster_nodes.each do |cluster_node| - bind_db_cluster_node = cluster_node['openstack']['bind_service']['db'] - if bind_db_cluster_node['interface'].nil? - Chef::Log.fatal('Need to specify interface to bind to.') - raise - end - address = address_for bind_db_cluster_node['interface'], family, cluster_node - cluster_nodes_addresses << address - end - cluster_address = cluster_nodes_addresses.join(',') - gcomm_address = "gcomm://#{cluster_address}" -end - -include_recipe 'openstack-ops-database::mariadb-server' - -provider_options = { 'gcache.size': '512M', - 'gmcast.listen_addr': gmcast_listen_addr } - -mariadb_galera_configuration 'MariaDB Galera Configuration' do - version node['openstack']['mariadb']['version'] - cluster_name 'openstack' - gcomm_address gcomm_address - wsrep_provider_options provider_options - wsrep_sst_method 'rsync' - notifies :restart, 'service[mysql]', :immediately -end - -# Install clustercheck tool -cookbook_file '/usr/bin/clustercheck' do - source 'clustercheck' - owner 'root' - group 'root' - mode '0755' - action :create_if_missing -end diff --git a/recipes/mariadb-server.rb b/recipes/mariadb-server.rb deleted file mode 100644 index 7439639..0000000 --- a/recipes/mariadb-server.rb +++ /dev/null @@ -1,87 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: mariadb-server -# -# 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 - -bind_db = node['openstack']['bind_service']['db'] - -listen_address = - if bind_db['interface'] - address_for bind_db['interface'] - else - bind_db['host'] - end - -super_password = get_password 'db', node['openstack']['db']['root_user_key'] - -include_recipe 'openstack-ops-database::mariadb-client' - -mariadb_server_install 'default' do - version node['openstack']['mariadb']['version'] - password super_password - setup_repo node['openstack']['mariadb']['setup_repo'] - action [:install, :create] -end - -# Using this to generate a service resource to control -service 'mysql' do - supports restart: true, status: true, reload: true - action :nothing -end - -mariadb_server_configuration 'default' do - innodb_buffer_pool_size node['openstack']['mysql']['innodb_buffer_pool_size'] - innodb_file_per_table node['openstack']['mysql']['innodb_file_per_table'] - innodb_log_buffer_size node['openstack']['mysql']['innodb_log_buffer_size'] - innodb_log_file_size node['openstack']['mysql']['innodb_log_file_size'] - innodb_options( - innodb_autoinc_lock_mode: node['openstack']['mysql']['innodb_autoinc_lock_mode'], - innodb_thread_concurrency: node['openstack']['mysql']['innodb_thread_concurrency'], - innodb_commit_concurrency: node['openstack']['mysql']['innodb_commit_concurrency'], - innodb_read_io_threads: node['openstack']['mysql']['innodb_read_io_threads'], - innodb_flush_log_at_trx_commit: node['openstack']['mysql']['innodb_flush_log_at_trx_commit'] - ) - mysqld_bind_address listen_address - mysqld_connect_timeout node['openstack']['mysql']['connect_timeout'] - mysqld_wait_timeout node['openstack']['mysql']['wait_timeout'] - mysqld_tmpdir node['openstack']['mysql']['tmpdir'] - mysqld_default_storage_engine node['openstack']['mysql']['default-storage-engine'] - mysqld_max_connections node['openstack']['mysql']['max_connections'] - mysqld_query_cache_size node['openstack']['mysql']['query_cache_size'] - mysqld_skip_name_resolve node['openstack']['mysql']['skip-name-resolve'] - mysqld_options( - 'character-set-server' => node['openstack']['mysql']['character-set-server'] - ) - version node['openstack']['mariadb']['version'] - notifies :restart, 'service[mysql]', :immediately -end - -# Remove anonymous localhost user -mariadb_user 'anonymous' do - username '' - host 'localhost' - ctrl_password super_password - action :drop -end - -# Remove test database -mariadb_database 'test' do - password super_password - action :drop -end diff --git a/recipes/openstack-db.rb b/recipes/openstack-db.rb deleted file mode 100644 index d7e1412..0000000 --- a/recipes/openstack-db.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: openstack-db -# -# Copyright:: 2012-2021, AT&T Services, Inc. -# -# 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 - -node['openstack']['common']['services'].each do |service, project| - old_services = %w(baremetal block-storage application-catalog - object-storage telemetry-metric) - next if old_services.include?(service) - begin - username = node['openstack']['db'][service]['username'] - password = get_password('db', project) - openstack_database service do - user username - pass password - end - rescue Net::HTTPClientException, ChefVault::Exceptions::KeysNotFound - Chef::Log.warn("No databag item containing the database password for #{project} was found, so no database was created") - end -end diff --git a/recipes/server.rb b/recipes/server.rb deleted file mode 100644 index e80ebd4..0000000 --- a/recipes/server.rb +++ /dev/null @@ -1,21 +0,0 @@ -# -# Cookbook:: openstack-ops-database -# Recipe:: server -# -# Copyright:: 2013-2021, Chef Software, Inc. -# Copyright:: 2013-2021, AT&T Services, Inc. -# -# 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. -# - -include_recipe "openstack-ops-database::#{node['openstack']['db']['service_type']}-server" diff --git a/spec/client_spec.rb b/spec/client_spec.rb deleted file mode 100644 index 4412c21..0000000 --- a/spec/client_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::client' do - describe 'ubuntu' do - include_context 'database-stubs' - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) { runner.converge(described_recipe) } - - it 'uses mariadb client recipe by default' do - node.override['openstack']['db']['service_type'] = 'mariadb' - expect(chef_run).to include_recipe 'openstack-ops-database::mariadb-client' - end - end -end diff --git a/spec/mariadb-client-redhat_spec.rb b/spec/mariadb-client-redhat_spec.rb deleted file mode 100644 index 2000733..0000000 --- a/spec/mariadb-client-redhat_spec.rb +++ /dev/null @@ -1,27 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::mariadb-client' do - ALL_RHEL.each do |p| - context "redhat #{p[:version]}" do - let(:runner) { ChefSpec::SoloRunner.new(p) } - let(:node) do - runner.node - end - cached(:chef_run) do - runner.node.override['openstack']['db']['service_type'] = 'mariadb' - runner.converge(described_recipe) - end - - case p - when REDHAT_7 - it do - expect(chef_run).to install_package('MySQL-python') - end - when REDHAT_8 - it do - expect(chef_run).to install_package('python3-PyMySQL') - end - end - end - end -end diff --git a/spec/mariadb-client_spec.rb b/spec/mariadb-client_spec.rb deleted file mode 100644 index c39cbd6..0000000 --- a/spec/mariadb-client_spec.rb +++ /dev/null @@ -1,23 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::mariadb-client' do - include_context 'database-stubs' - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) do - runner.node - end - cached(:chef_run) do - runner.node.override['openstack']['db']['service_type'] = 'mariadb' - runner.converge(described_recipe) - end - - it do - expect(chef_run).to install_mariadb_client_install('default').with(version: '10.3') - end - - it 'installs mariadb python client packages' do - expect(chef_run).to install_package('python3-mysqldb') - end - end -end diff --git a/spec/mariadb-cluster-server_spec.rb b/spec/mariadb-cluster-server_spec.rb deleted file mode 100644 index 76a3273..0000000 --- a/spec/mariadb-cluster-server_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::mariadb-cluster-server' do - describe 'ubuntu' do - include_context 'database-stubs' - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) do - node.override['openstack']['bind_service']['db']['interface'] = 'lo' - runner.converge(described_recipe) - end - - it 'includes mariadb recipes' do - expect(chef_run).to include_recipe('openstack-ops-database::mariadb-server') - end - - it do - expect(chef_run).to create_mariadb_galera_configuration('MariaDB Galera Configuration').with( - version: '10.3', - cluster_name: 'openstack', - gcomm_address: 'gcomm://', - wsrep_provider_options: { 'gcache.size': '512M', 'gmcast.listen_addr': 'tcp://127.0.0.1:4567' }, - wsrep_sst_method: 'rsync' - ) - end - - it do - expect(chef_run.mariadb_galera_configuration('MariaDB Galera Configuration')).to notify('service[mysql]').to(:restart).immediately - end - - it do - expect(chef_run).to create_if_missing_cookbook_file('/usr/bin/clustercheck').with( - source: 'clustercheck', - owner: 'root', - group: 'root', - mode: '0755' - ) - end - end -end diff --git a/spec/mariadb-server_spec.rb b/spec/mariadb-server_spec.rb deleted file mode 100644 index 3ee814c..0000000 --- a/spec/mariadb-server_spec.rb +++ /dev/null @@ -1,81 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::mariadb-server' do - describe 'ubuntu' do - include_context 'database-stubs' - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) { runner.converge(described_recipe) } - - it 'includes mariadb recipes' do - expect(chef_run).to include_recipe('openstack-ops-database::mariadb-client') - end - - it do - expect(chef_run).to install_mariadb_server_install('default').with( - version: '10.3', - password: 'abc123' - ) - end - - it do - expect(chef_run).to create_mariadb_server_install('default') - end - - it do - expect(chef_run).to modify_mariadb_server_configuration('default').with( - innodb_buffer_pool_size: '134217728', - innodb_file_per_table: 0, - innodb_log_buffer_size: '8388608', - innodb_log_file_size: '5242880', - innodb_options: { - innodb_autoinc_lock_mode: 1, - innodb_thread_concurrency: 0, - innodb_commit_concurrency: 0, - innodb_read_io_threads: 4, - innodb_flush_log_at_trx_commit: 1, - }, - mysqld_bind_address: '127.0.0.1', - mysqld_connect_timeout: 30, - mysqld_wait_timeout: 600, - mysqld_tmpdir: '/var/tmp', - mysqld_default_storage_engine: 'InnoDB', - mysqld_max_connections: 307, - mysqld_query_cache_size: '0', - mysqld_skip_name_resolve: false, - mysqld_options: { - 'character-set-server' => 'latin1', - }, - version: '10.3' - ) - end - - it do - expect(chef_run.mariadb_server_configuration('default')).to notify('service[mysql]').to(:restart).immediately - end - - it do - expect(chef_run).to drop_mariadb_user('anonymous').with( - username: '', - host: 'localhost', - ctrl_password: 'abc123' - ) - end - - it do - expect(chef_run).to drop_mariadb_database('test').with(password: 'abc123') - end - - context 'set db host to 192.168.1.1' do - cached(:chef_run) do - node.override['openstack']['bind_service']['db']['host'] = '192.168.1.1' - runner.converge(described_recipe) - end - it do - expect(chef_run).to modify_mariadb_server_configuration('default').with( - mysqld_bind_address: '192.168.1.1' - ) - end - end - end -end diff --git a/spec/openstack-db_spec.rb b/spec/openstack-db_spec.rb deleted file mode 100644 index 597027f..0000000 --- a/spec/openstack-db_spec.rb +++ /dev/null @@ -1,28 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::openstack-db' do - include_context 'database-stubs' - describe 'ubuntu' do - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) { runner.converge(described_recipe) } - - it 'creates all openstack service databases and the corresponding users' do - { - 'compute' => 'nova', - 'dashboard' => 'horizon', - 'database' => 'trove', - 'identity' => 'keystone', - 'image' => 'glance', - 'network' => 'neutron', - 'orchestration' => 'heat', - 'telemetry' => 'ceilometer', - }.each do |service, _project| - expect(chef_run).to create_openstack_database(service) - .with(user: node['openstack']['db'][service]['username'], pass: 'test-pass') - end - ## TODO: utilize _project and create test for rescue with specific log message - ## when databag does not exist - end - end -end diff --git a/spec/server_spec.rb b/spec/server_spec.rb deleted file mode 100644 index 11de810..0000000 --- a/spec/server_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require_relative 'spec_helper' - -describe 'openstack-ops-database::server' do - describe 'ubuntu' do - include_context 'database-stubs' - let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } - let(:node) { runner.node } - cached(:chef_run) { runner.converge(described_recipe) } - - it 'uses mariadb server recipe by default' do - node.override['openstack']['db']['service_type'] = 'mariadb' - expect(chef_run).to include_recipe('openstack-ops-database::mariadb-server') - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb deleted file mode 100644 index 629c73a..0000000 --- a/spec/spec_helper.rb +++ /dev/null @@ -1,53 +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 'database-stubs' do - before do - # for redhat - stub_command("/usr/bin/mysql -u root -e 'show databases;'") - # for debian - stub_command("\"/usr/bin/mysql\" -u root -e 'show databases;'") - stub_command("mysqladmin --user=root --password='' version") - - stub_search('node', 'recipes:"openstack-ops-database\:\:mariadb-cluster-server"').and_return([]) - - 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('all') - .and_return('0.0.0.0') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('db', anything) - .and_return('test-pass') - allow_any_instance_of(Chef::Recipe).to receive(:get_password) - .with('db', 'mysqlroot') - .and_return('abc123') - end -end