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: I7a2655cab7bc4caad707f5f98174aae0b659fd4f
This commit is contained in:
parent
e7e76f07a2
commit
17c5f0c939
|
@ -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"
|
|
@ -1,9 +0,0 @@
|
|||
.bundle/
|
||||
berks-cookbooks/
|
||||
.kitchen
|
||||
.vagrant
|
||||
.coverage/
|
||||
*.swp
|
||||
Berksfile.lock
|
||||
Vagrantfile
|
||||
Gemfile.lock
|
|
@ -1,4 +0,0 @@
|
|||
Chef/Modernize/FoodcriticComments:
|
||||
Enabled: true
|
||||
Chef/Style/CopyrightCommentFormat:
|
||||
Enabled: true
|
|
@ -1,12 +0,0 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2020-05-29 17:16:13 -0700 using RuboCop version 0.82.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 2
|
||||
# Configuration parameters: CountKeywordArgs.
|
||||
Metrics/ParameterLists:
|
||||
Max: 6
|
|
@ -1,3 +0,0 @@
|
|||
- project:
|
||||
templates:
|
||||
- openstack-chef-jobs
|
22
Berksfile
22
Berksfile
|
@ -1,22 +0,0 @@
|
|||
source 'https://supermarket.chef.io'
|
||||
|
||||
solver :ruby, :required
|
||||
|
||||
[
|
||||
%w(client dep),
|
||||
%w(-common dep),
|
||||
%w(-dns integration),
|
||||
%w(-identity dep),
|
||||
%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}", group: group
|
||||
else
|
||||
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
|
||||
end
|
||||
end
|
||||
|
||||
metadata
|
|
@ -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
176
LICENSE
|
@ -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.
|
||||
|
230
README.rst
230
README.rst
|
@ -1,224 +1,10 @@
|
|||
OpenStack Chef Cookbook - image
|
||||
===============================
|
||||
This project is no longer maintained.
|
||||
|
||||
.. image:: https://governance.openstack.org/badges/cookbook-openstack-image.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 installs the OpenStack Image service **Glance** as part of
|
||||
an OpenStack reference deployment Chef for OpenStack. The `OpenStack
|
||||
chef-repo`_ contains documentation for using this cookbook in the
|
||||
context of a full OpenStack deployment. Glance is installed from
|
||||
packages, optionally populating the repository with default images.
|
||||
|
||||
.. _OpenStack chef-repo: https://opendev.org/openstack/openstack-chef
|
||||
|
||||
https://docs.openstack.org/glance/latest
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
- Chef 16 or higher
|
||||
- Chef Workstation 21.10.640 for testing (also includes Berkshelf for
|
||||
cookbook dependency resolution)
|
||||
|
||||
Platform
|
||||
========
|
||||
|
||||
- ubuntu
|
||||
- redhat
|
||||
- centos
|
||||
|
||||
Cookbooks
|
||||
=========
|
||||
|
||||
The following cookbooks are dependencies:
|
||||
|
||||
- 'openstackclient'
|
||||
- 'openstack-common', '>= 20.0.0'
|
||||
- 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
Please see the extensive inline documentation in ``attributes/*.rb`` for
|
||||
descriptions of all the settable attributes for this cookbook.
|
||||
|
||||
Note that all attributes are in the ``default['openstack']`` "namespace"
|
||||
|
||||
The usage of attributes to generate the ``glance-api.conf`` is described
|
||||
in the openstack-common cookbook.
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
openstack-image::api
|
||||
--------------------
|
||||
|
||||
- Installs the glance-api server
|
||||
|
||||
openstack-image::identity_registration
|
||||
--------------------------------------
|
||||
|
||||
- Registers the API endpoint and glance service Keystone user
|
||||
|
||||
openstack-image::image-upload
|
||||
-----------------------------
|
||||
|
||||
- Upload image to glance. If you want to upload image during openstack
|
||||
installation, you need to add this recipe or the os-image role to the
|
||||
run list in a certain role and ensure before this recipe or the
|
||||
os-image role glance api recipes have been executed.
|
||||
|
||||
openstack-image::swift_store
|
||||
----------------------------
|
||||
|
||||
- Install and configure swift glance packages
|
||||
|
||||
Glance Backend
|
||||
==============
|
||||
|
||||
The Glance cookbook currently supports file, swift, and Rackspace Cloud
|
||||
Files (swift API compliant) backing stores. NOTE: changing the storage
|
||||
location from cloudfiles to swift (and vice versa) requires that you
|
||||
manually export and import your stored images.
|
||||
|
||||
To enable these features set the following in the default attributes
|
||||
section in your environment:
|
||||
|
||||
Files
|
||||
-----
|
||||
|
||||
.. code:: json
|
||||
|
||||
"openstack": {
|
||||
"image": {
|
||||
"api": {
|
||||
"default_store": "file"
|
||||
},
|
||||
"upload_images": [
|
||||
"cirros"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Swift
|
||||
-----
|
||||
|
||||
.. code:: json
|
||||
|
||||
"openstack": {
|
||||
"image": {
|
||||
"api": {
|
||||
"default_store": "swift"
|
||||
},
|
||||
"upload_images": [
|
||||
"cirros"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Custom Resources
|
||||
================
|
||||
|
||||
image
|
||||
-----
|
||||
|
||||
Action: ``:upload``
|
||||
|
||||
- ``:image_url``: Location of the image to be loaded into Glance.
|
||||
- ``:image_name``: A name for the image.
|
||||
- ``:image_type``: ``unknown``, ``qcow``, ``ami``, ``vhd``, ``vmdk``,
|
||||
``vdi``, ``iso``, ``raw``. Defaults of ``unknown`` will use file
|
||||
extension '.gz', '.tgz' = ami, '.qcow2', '.img' = qcow.
|
||||
- ``:image_public``: Set image to be public or private
|
||||
- ``:image_id``: Set the image ID
|
||||
- ``:identity_user``: Username of the Keystone admin user.
|
||||
- ``:identity_pass``: Password for the Keystone admin user.
|
||||
- ``:identity_tenant``: Name of the Keystone admin user's tenant.
|
||||
- ``:identity_uri``: URI of the Identity API endpoint.
|
||||
- ``:identity_user_domain_name``: User domain name for Keystone admin
|
||||
user.
|
||||
- ``:identity_project_domain_name``: Project domain name for Keystone
|
||||
admin user.
|
||||
|
||||
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 Ray (matt@opscode.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Jay Pipes (jaypipes@att.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | John Dewey (jdewey@att.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Craig Tracey (craigtracey@gmail.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Sean Gallagher (sean.gallagher@att.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Mark Vanderwiel (vanderwl@us.ibm.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Salman Baset (sabaset@us.ibm.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Chen Zhiwei (zhiwchen@cn.ibm.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Eric Zhou (zyouzhou@cn.ibm.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Jian Hua Geng (gengjh@cn.ibm.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Ionut Artarisi (iartarisi@suse.cz) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Imtiaz Chowdhury (imtiaz.chowdhury@workday.com) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Jan Klare (j.klare@cloudbau.de) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Christoph Albers (c.albers@x-ion.de) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Author** | Lance Albertson (lance@osuosl.org) |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2012, Rackspace US, Inc. |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2012-2013, AT&T Services, Inc. |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2013, Craig Tracey craigtracey@gmail.com |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2013-2014, IBM Corp. |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **Copyright** | Copyright (c) 2014, SUSE Linux, GmbH. |
|
||||
+-----------------+----------------------------------------------------------+
|
||||
| **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.
|
||||
|
|
39
Rakefile
39
Rakefile
|
@ -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
|
30
TESTING.md
30
TESTING.md
|
@ -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.
|
|
@ -1,139 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright:: 2012-2021, Rackspace US, Inc.
|
||||
# Copyright:: 2013-2021, Craig Tracey <craigtracey@gmail.com>
|
||||
# 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.
|
||||
#
|
||||
|
||||
# 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']['image']['custom_template_banner'] = '
|
||||
# This file is automatically generated by Chef
|
||||
# Any changes will be overwritten
|
||||
'
|
||||
|
||||
# SSL Options
|
||||
# Enable SSL for glance api bind endpoints.
|
||||
default['openstack']['image']['ssl']['enabled'] = false
|
||||
# Enable SSL for glance api bind endpoint.
|
||||
default['openstack']['image']['ssl']['api']['enabled'] = node['openstack']['image']['ssl']['enabled']
|
||||
# Base directory for SSL certficate and key
|
||||
default['openstack']['image']['ssl']['basedir'] = '/etc/glance/ssl'
|
||||
|
||||
default['openstack']['image']['verbose'] = 'False'
|
||||
|
||||
# This is the name of the Chef role that will install the Keystone Service API
|
||||
default['openstack']['image']['identity_service_chef_role'] = 'os-identity'
|
||||
|
||||
# Gets set in the Image Endpoint when registering with Keystone
|
||||
default['openstack']['image']['region'] = node['openstack']['region']
|
||||
|
||||
# The name of the Chef role that knows about the message queue server
|
||||
# that Glance uses
|
||||
default['openstack']['image']['rabbit_server_chef_role'] = 'os-ops-messaging'
|
||||
default['openstack']['image']['service_project'] = 'service'
|
||||
default['openstack']['image']['service_user'] = 'glance'
|
||||
default['openstack']['image']['service_role'] = 'admin'
|
||||
|
||||
# Supported values for the 'container_format' image attribute
|
||||
default['openstack']['image']['api']['container_formats'] = %w(ami ari aki bare ovf ova docker dockerref)
|
||||
|
||||
# Supported values for the 'disk_format' image attribute
|
||||
|
||||
# Whether to use any of the default caching pipelines from the paste configuration file
|
||||
default['openstack']['image']['api']['caching'] = false
|
||||
default['openstack']['image']['api']['cache_management'] = false
|
||||
|
||||
# Directory for the Image Cache
|
||||
default['openstack']['image']['cache']['dir'] = '/var/lib/glance/image-cache/'
|
||||
# Number of seconds until an incomplete image is considered stalled an
|
||||
|
||||
# Number of seconds to leave invalid images around before they are eligible to be reaped
|
||||
default['openstack']['image']['cache']['grace_period'] = 3600
|
||||
|
||||
# Default configuration for image cache and scrubber
|
||||
default['openstack']['image_cache']['conf'] = {}
|
||||
default['openstack']['image_scrubber']['conf'] = {}
|
||||
|
||||
# Default Image Locations
|
||||
default['openstack']['image']['upload_images'] = ['cirros']
|
||||
default['openstack']['image']['upload_image']['artful'] = 'http://cloud-images.ubuntu.com/artful/current/artful-server-cloudimg-amd64-disk1.img'
|
||||
default['openstack']['image']['upload_image']['xenial'] = 'http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img'
|
||||
default['openstack']['image']['upload_image']['cirros'] = 'http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img'
|
||||
default['openstack']['image']['upload_image']['centos'] = 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2'
|
||||
# To override image type
|
||||
# The following disk format types are supported: qcow vhd vmdk vdi iso raw
|
||||
# Bare container format will be used.
|
||||
default['openstack']['image']['upload_image_type']['cirros'] = 'qcow'
|
||||
default['openstack']['image']['upload_image_id']['cirros'] = 'e1847f1a-01d2-4957-a067-b56085bf3781'
|
||||
# logging attribute
|
||||
default['openstack']['image']['syslog']['use'] = false
|
||||
default['openstack']['image']['syslog']['facility'] = 'LOG_LOCAL2'
|
||||
default['openstack']['image']['syslog']['config_facility'] = 'local2'
|
||||
|
||||
# vmware attributes
|
||||
default['openstack']['image']['api']['vmware']['secret_name'] = 'openstack_vmware_secret_name'
|
||||
|
||||
# cron output redirection
|
||||
default['openstack']['image']['cron']['redirection'] = '> /dev/null 2>&1'
|
||||
|
||||
# platform-specific settings
|
||||
case node['platform_family']
|
||||
when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
|
||||
default['openstack']['image']['user'] = 'glance'
|
||||
default['openstack']['image']['group'] = 'glance'
|
||||
default['openstack']['image']['platform'] = {
|
||||
'image_packages' => %w(openstack-glance cronie),
|
||||
'swift_packages' => ['openstack-swift'],
|
||||
'image_api_service' => 'openstack-glance-api',
|
||||
'image_api_process_name' => 'glance-api',
|
||||
'package_overrides' => '',
|
||||
}
|
||||
when 'suse'
|
||||
default['openstack']['image']['user'] = 'openstack-glance'
|
||||
default['openstack']['image']['group'] = 'openstack-glance'
|
||||
default['openstack']['image']['platform'] = {
|
||||
'image_packages' => ['openstack-glance'],
|
||||
'swift_packages' => ['openstack-swift'],
|
||||
'image_api_service' => 'openstack-glance-api',
|
||||
'image_api_process_name' => 'glance-api',
|
||||
'package_overrides' => '',
|
||||
}
|
||||
when 'debian'
|
||||
default['openstack']['image']['user'] = 'glance'
|
||||
default['openstack']['image']['group'] = 'glance'
|
||||
default['openstack']['image']['platform'] = {
|
||||
'image_packages' => %w(python3-glance glance),
|
||||
'swift_packages' => ['python3-swift'],
|
||||
'image_api_service' => 'glance-api',
|
||||
'package_overrides' => '',
|
||||
}
|
||||
end
|
||||
|
||||
# ******************** OpenStack Image Endpoints ******************************
|
||||
|
||||
# The OpenStack Image (Glance) endpoints
|
||||
%w(public internal).each do |ep_type|
|
||||
%w(image_api).each do |service|
|
||||
default['openstack']['endpoints'][ep_type][service]['scheme'] = 'http'
|
||||
default['openstack']['endpoints'][ep_type][service]['host'] = '127.0.0.1'
|
||||
default['openstack']['endpoints'][ep_type]['image_api']['path'] = ''
|
||||
default['openstack']['endpoints'][ep_type]['image_api']['port'] = 9292
|
||||
end
|
||||
end
|
||||
default['openstack']['bind_service']['all']['image_api']['host'] = '127.0.0.1'
|
||||
default['openstack']['bind_service']['all']['image_api']['port'] = 9292
|
|
@ -1,23 +0,0 @@
|
|||
default['openstack']['image_api']['conf'].tap do |conf|
|
||||
# [DEFAULT] section
|
||||
if node['openstack']['image']['syslog']['use']
|
||||
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
|
||||
else
|
||||
conf['DEFAULT']['log_file'] = '/var/log/glance/api.log'
|
||||
end
|
||||
conf['DEFAULT']['enabled_backends'] = 'file:file,http:http'
|
||||
|
||||
# [glance_store] section
|
||||
conf['glance_store']['default_backend'] = 'file'
|
||||
|
||||
# [paste_deploy] section
|
||||
conf['paste_deploy']['flavor'] = 'keystone'
|
||||
|
||||
# [keystone_authtoken] section
|
||||
conf['keystone_authtoken']['auth_type'] = 'password'
|
||||
conf['keystone_authtoken']['region_name'] = node['openstack']['region']
|
||||
conf['keystone_authtoken']['username'] = 'glance'
|
||||
conf['keystone_authtoken']['project_name'] = 'admin'
|
||||
conf['keystone_authtoken']['user_domain_name'] = 'Default'
|
||||
conf['keystone_authtoken']['project_domain_name'] = 'Default'
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
default['openstack']['image-cache']['conf'].tap do |conf|
|
||||
# [DEFAULT] section
|
||||
if node['openstack']['image']['syslog']['use']
|
||||
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
|
||||
else
|
||||
conf['DEFAULT']['log_file'] = '/var/log/glance/image-cache.log'
|
||||
end
|
||||
conf['DEFAULT']['image_cache_dir'] = '/var/lib/glance/image-cache/' # none in docs
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
default['openstack']['image-scrubber']['conf'].tap do |conf|
|
||||
# [DEFAULT] section
|
||||
conf['DEFAULT']['verbose'] = false
|
||||
if node['openstack']['image']['syslog']['use']
|
||||
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
|
||||
else
|
||||
conf['DEFAULT']['log_file'] = '/var/log/glance/scrubber.log'
|
||||
end
|
||||
end
|
|
@ -1,117 +0,0 @@
|
|||
from glance.client import V1Client
|
||||
from glance.common import exception
|
||||
|
||||
import collectd
|
||||
|
||||
global NAME, OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL, OS_AUTH_STRATEGY, VERBOSE_LOGGING
|
||||
|
||||
NAME = "glance_plugin"
|
||||
OS_USERNAME = "username"
|
||||
OS_PASSWORD = "password"
|
||||
OS_TENANT_NAME = "tenantname"
|
||||
OS_AUTH_URL = "http://localhost:5000/v2.0"
|
||||
OS_AUTH_STRATEGY = "keystone"
|
||||
VERBOSE_LOGGING = False
|
||||
|
||||
def get_stats(user, passwd, tenant, url, host=None):
|
||||
creds = {"username": user, "password": passwd, "tenant": tenant,"auth_url": url, "strategy": OS_AUTH_STRATEGY}
|
||||
client = V1Client(host,creds=creds)
|
||||
try:
|
||||
image_list = client.get_images_detailed()
|
||||
except exception.NotAuthenticated:
|
||||
msg = "Client credentials appear to be invalid"
|
||||
raise exception.ClientConnectionError(msg)
|
||||
else:
|
||||
# TODO(shep): this needs to be rewritten more inline with the keystone|nova plugins
|
||||
data = dict()
|
||||
data["count"] = int(len(image_list))
|
||||
data["bytes"] = 0
|
||||
data["snapshot.count"] = 0
|
||||
data["snapshot.bytes"] = 0
|
||||
data["tenant"] = dict()
|
||||
for image in image_list:
|
||||
data["bytes"] += int(image["size"])
|
||||
if "image_type" in image["properties"] and image["properties"]["image_type"] == "snapshot":
|
||||
data["snapshot.count"] += 1
|
||||
data["snapshot.bytes"] += int(image["size"])
|
||||
uuid = str(image["owner"])
|
||||
if uuid in data["tenant"]:
|
||||
data["tenant"][uuid]["count"] += 1
|
||||
data["tenant"][uuid]["bytes"] += int(image["size"])
|
||||
if "image_type" in image["properties"] and image["properties"]["image_type"] == "snapshot":
|
||||
data["tenant"][uuid]["snapshot.count"] += 1
|
||||
data["tenant"][uuid]["snapshot.bytes"] += int(image["size"])
|
||||
else:
|
||||
data["tenant"][uuid] = dict()
|
||||
data["tenant"][uuid]["count"] = 1
|
||||
data["tenant"][uuid]["bytes"] = int(image["size"])
|
||||
data["tenant"][uuid]["snapshot.count"] = 0
|
||||
data["tenant"][uuid]["snapshot.bytes"] = 0
|
||||
if "image_type" in image["properties"] and image["properties"]["image_type"] == "snapshot":
|
||||
data["tenant"][uuid]["snapshot.count"] += 1
|
||||
data["tenant"][uuid]["snapshot.bytes"] += int(image["size"])
|
||||
# debug
|
||||
#for key in data.keys():
|
||||
# if key == "tenant":
|
||||
# for uuid in data[key].keys():
|
||||
# for field in data[key][uuid]:
|
||||
# print "glance.images.tenant.%s.%s : %i" % (uuid, field, data[key][uuid][field])
|
||||
# else:
|
||||
# print "glance.images.%s : %i" % (key, data[key])
|
||||
##########
|
||||
return data
|
||||
|
||||
def configure_callback(conf):
|
||||
"""Received configuration information"""
|
||||
global OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL
|
||||
for node in conf.children:
|
||||
if node.key == "Username":
|
||||
OS_USERNAME = node.values[0]
|
||||
elif node.key == "Password":
|
||||
OS_PASSWORD = node.values[0]
|
||||
elif node.key == "TenantName":
|
||||
OS_TENANT_NAME = node.values[0]
|
||||
elif node.key == "AuthURL":
|
||||
OS_AUTH_URL = node.values[0]
|
||||
elif node.key == "Verbose":
|
||||
VERBOSE_LOGGING = node.values[0]
|
||||
else:
|
||||
logger("warn", "Unknown config key: %s" % node.key)
|
||||
|
||||
def read_callback():
|
||||
logger("verb", "read_callback")
|
||||
info = get_stats(OS_USERNAME, OS_PASSWORD, OS_TENANT_NAME, OS_AUTH_URL)
|
||||
|
||||
if not info:
|
||||
logger("err", "No information received")
|
||||
return
|
||||
|
||||
for key in info.keys():
|
||||
if key == "tenant":
|
||||
for uuid in info[key].keys():
|
||||
for field in info[key][uuid]:
|
||||
logger('verb', 'Dispatching glance.images.tenant.%s.%s : %i' % (uuid, field, int(info[key][uuid][field])))
|
||||
path = 'glance.images.%s.%s' % (uuid, field)
|
||||
val = collectd.Values(plugin=path)
|
||||
val.type = 'gauge'
|
||||
val.values = [int(info[key][uuid][field])]
|
||||
val.dispatch()
|
||||
else:
|
||||
logger('verb', 'Dispatching %s : %i' % (key, int(info[key])))
|
||||
path = 'glance.images.%s' % (key)
|
||||
val = collectd.Values(plugin=path)
|
||||
val.type = 'gauge'
|
||||
val.values = [int(info[key])]
|
||||
val.dispatch()
|
||||
|
||||
def logger(t, msg):
|
||||
if t == 'err':
|
||||
collectd.error('%s: %s' % (NAME, msg))
|
||||
if t == 'warn':
|
||||
collectd.warning('%s: %s' % (NAME, msg))
|
||||
elif t == 'verb' and VERBOSE_LOGGING == True:
|
||||
collectd.info('%s: %s' % (NAME, msg))
|
||||
|
||||
collectd.register_config(configure_callback)
|
||||
collectd.warning("Initializing glance plugin")
|
||||
collectd.register_read(read_callback)
|
18
metadata.rb
18
metadata.rb
|
@ -1,18 +0,0 @@
|
|||
name 'openstack-image'
|
||||
maintainer 'openstack-chef'
|
||||
maintainer_email 'openstack-discuss@lists.openstack.org'
|
||||
license 'Apache-2.0'
|
||||
description 'Installs and configures the Glance Image Registry and Delivery Service'
|
||||
version '20.0.0'
|
||||
|
||||
%w(ubuntu redhat centos).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends 'openstackclient'
|
||||
depends 'openstack-common', '>= 20.0.0'
|
||||
depends 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
issues_url 'https://launchpad.net/openstack-chef'
|
||||
source_url 'https://opendev.org/openstack/cookbook-openstack-image'
|
||||
chef_version '>= 16.0'
|
|
@ -1,121 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Provider:: image
|
||||
#
|
||||
# Copyright:: 2012-2021, Rackspace US, Inc.
|
||||
# Copyright:: 2013-2021, Chef Software, Inc.
|
||||
# Copyright:: 2020-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.
|
||||
#
|
||||
|
||||
include ::Openstack
|
||||
|
||||
action :upload do
|
||||
@user = new_resource.identity_user
|
||||
@pass = new_resource.identity_pass
|
||||
@tenant = new_resource.identity_tenant
|
||||
@ks_uri = new_resource.identity_uri
|
||||
@domain = new_resource.identity_user_domain_name
|
||||
@project_domain_name = new_resource.identity_project_domain_name
|
||||
name = new_resource.image_name
|
||||
url = new_resource.image_url
|
||||
public = new_resource.image_public
|
||||
id = new_resource.image_id
|
||||
|
||||
ep = public_endpoint 'image_api'
|
||||
api = ep.to_s.gsub(ep.path, '') # remove trailing /v2
|
||||
|
||||
type = new_resource.image_type
|
||||
type = _determine_type(url) if type == 'unknown'
|
||||
_upload_image(type, name, api, url, public ? 'public' : 'private', id)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _determine_type(url)
|
||||
# Lets do our best to determine the type from the file extension
|
||||
case ::File.extname(url)
|
||||
when '.gz', '.tgz'
|
||||
'ami'
|
||||
when '.qcow2', '.img'
|
||||
'qcow'
|
||||
else
|
||||
raise ArgumentError, "File extension not supported for #{url}, supported extensions are: .gz, .tgz for ami and .qcow2 and .img for qcow"
|
||||
end
|
||||
end
|
||||
|
||||
def _upload_image(type, name, api, url, public, id)
|
||||
case type
|
||||
when 'ami'
|
||||
_upload_ami(name, api, url, public, id)
|
||||
when 'qcow'
|
||||
_upload_image_bare(name, api, url, public, 'qcow2', id)
|
||||
else
|
||||
_upload_image_bare(name, api, url, public, type, id)
|
||||
end
|
||||
end
|
||||
|
||||
def _upload_image_bare(name, api, url, public, type, id)
|
||||
glance_cmd = "glance --insecure --os-username #{@user} --os-password #{@pass} --os-project-name #{@tenant} --os-image-url #{api} --os-auth-url #{@ks_uri} --os-user-domain-name #{@domain} --os-project-domain-name #{@project_domain_name}"
|
||||
c_fmt = '--container-format bare'
|
||||
d_fmt = "--disk-format #{type}"
|
||||
|
||||
execute "Uploading #{type} image #{name}" do # :pragma-foodcritic: ~FC041
|
||||
cwd '/tmp'
|
||||
sensitive true
|
||||
command "curl -L #{url} | #{glance_cmd} image-create --name #{name} #{"--id #{id}" unless id == ''} --visibility #{public} #{c_fmt} #{d_fmt}"
|
||||
not_if "#{glance_cmd} image-list | grep #{name}"
|
||||
end
|
||||
end
|
||||
|
||||
# TODO(chrislaco) This refactor is in the works via Craig Tracey
|
||||
def _upload_ami(name, api, url, public, id)
|
||||
glance_cmd = "glance --insecure --os-username #{@user} --os-password #{@pass} --os-project-name #{@tenant} --os-image-url #{api} --os-auth-url #{@ks_uri} --os-user-domain-name #{@domain} --os-project-domain-name #{@project_domain_name}"
|
||||
aki_fmt = '--container-format aki --disk-format aki'
|
||||
ari_fmt = '--container-format ari --disk-format ari'
|
||||
ami_fmt = '--container-format ami --disk-format ami'
|
||||
|
||||
bash "Uploading AMI image #{name}" do
|
||||
cwd '/tmp'
|
||||
user 'root'
|
||||
sensitive true
|
||||
code <<-EOH
|
||||
set -x
|
||||
mkdir -p images/#{name}
|
||||
cd images/#{name}
|
||||
|
||||
curl -L #{url} | tar -zx
|
||||
image_name=$(basename #{url} .tar.gz)
|
||||
|
||||
image_name=${image_name%-multinic}
|
||||
|
||||
kernel_file=$(ls *vmlinuz-virtual | head -n1)
|
||||
if [ ${#kernel_file} -eq 0 ]; then
|
||||
kernel_file=$(ls *vmlinuz | head -n1)
|
||||
fi
|
||||
|
||||
ramdisk=$(ls *-initrd | head -n1)
|
||||
if [ ${#ramdisk} -eq 0 ]; then
|
||||
ramdisk=$(ls *-loader | head -n1)
|
||||
fi
|
||||
|
||||
kernel=$(ls *.img | head -n1)
|
||||
|
||||
kid=$(#{glance_cmd} image-create --name "${image_name}-kernel" --visibility #{public} #{aki_fmt} < ${kernel_file} | grep -m 1 '^|[ ]*id[ ]*|' | cut -d'|' -f3 | sed 's/ //')
|
||||
rid=$(#{glance_cmd} image-create --name "${image_name}-initrd" --visibility #{public} #{ari_fmt} < ${ramdisk} | grep -m 1 '^|[ ]*id[ ]*|' | cut -d'|' -f3 | sed 's/ //')
|
||||
#{glance_cmd} image-create --name "#{name}" #{"--id #{id}" unless id == ''} --visibility #{public} #{ami_fmt} --property "kernel_id=$kid" --property "ramdisk_id=$rid" < ${kernel}
|
||||
EOH
|
||||
not_if "#{glance_cmd} image-list | grep #{name}"
|
||||
end
|
||||
end
|
172
recipes/api.rb
172
recipes/api.rb
|
@ -1,172 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Recipe:: api
|
||||
#
|
||||
# Copyright:: 2012-2021, Rackspace US, Inc.
|
||||
# Copyright:: 2012-2021, Chef Software, Inc.
|
||||
# Copyright:: 2012-2021, AT&T Services, Inc.
|
||||
# Copyright:: 2013-2021, Craig Tracey <craigtracey@gmail.com>
|
||||
# Copyright:: 2013-2021, IBM Corp.
|
||||
# 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
|
||||
|
||||
class ::Chef::Recipe
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
include_recipe 'openstack-common::client'
|
||||
|
||||
if node['openstack']['image']['syslog']['use']
|
||||
include_recipe 'openstack-common::logging'
|
||||
end
|
||||
|
||||
platform_options = node['openstack']['image']['platform']
|
||||
|
||||
platform_options['image_packages'].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options['package_overrides']
|
||||
end
|
||||
end
|
||||
|
||||
directory '/etc/glance' do
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode '700'
|
||||
end
|
||||
|
||||
if node['openstack']['image_api']['conf']['glance_store']['default_backend'] == 'file'
|
||||
node.default['openstack']['image_api']['conf']['glance_store']['filesystem_store_datadir'] =
|
||||
'/var/lib/glance/images'
|
||||
directory node['openstack']['image_api']['conf']['glance_store']['filesystem_store_datadir'] do
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode '750'
|
||||
recursive true
|
||||
end
|
||||
end
|
||||
|
||||
node.default['openstack']['image_api']['conf_secrets']
|
||||
.[]('keystone_authtoken')['password'] =
|
||||
get_password 'service', 'openstack-image'
|
||||
|
||||
identity_endpoint = internal_endpoint 'identity'
|
||||
auth_url = identity_endpoint.to_s
|
||||
|
||||
db_user = node['openstack']['db']['image']['username']
|
||||
db_pass = get_password 'db', 'glance'
|
||||
node.default['openstack']['image_api']['conf_secrets']
|
||||
.[]('database')['connection'] =
|
||||
db_uri('image', db_user, db_pass)
|
||||
|
||||
if node['openstack']['mq']['service_type'] == 'rabbit'
|
||||
node.default['openstack']['image_api']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'image'
|
||||
end
|
||||
|
||||
api_bind = node['openstack']['bind_service']['all']['image_api']
|
||||
api_bind_address = bind_address api_bind
|
||||
|
||||
node.default['openstack']['image_api']['conf'].tap do |conf|
|
||||
# [DEFAULT] section
|
||||
conf['DEFAULT']['bind_host'] = api_bind_address
|
||||
conf['DEFAULT']['bind_port'] = api_bind['port']
|
||||
# [keystone_authtoken] section
|
||||
conf['keystone_authtoken']['auth_url'] = auth_url
|
||||
end
|
||||
|
||||
# merge all config options and secrets
|
||||
glance_api_conf = merge_config_options 'image_api'
|
||||
glance_cache_conf = merge_config_options 'image_cache'
|
||||
glance_scrubber_conf = merge_config_options 'image_scrubber'
|
||||
|
||||
template '/etc/glance/glance-api.conf' do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode '640'
|
||||
sensitive true
|
||||
variables(
|
||||
service_config: glance_api_conf
|
||||
)
|
||||
end
|
||||
|
||||
template '/etc/glance/glance-cache.conf' do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode '640'
|
||||
variables(
|
||||
service_config: glance_cache_conf
|
||||
)
|
||||
end
|
||||
|
||||
template '/etc/glance/glance-scrubber.conf' do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode '640'
|
||||
variables(
|
||||
service_config: glance_scrubber_conf
|
||||
)
|
||||
end
|
||||
|
||||
%w(image_api image_cache image_scrubber).each do |service|
|
||||
# delete all secrets saved in the attribute
|
||||
# node['openstack']['pi]['conf_secrets'] after creating the glance-api.conf
|
||||
ruby_block "delete all attributes in node['openstack']['#{service}']['conf_secrets']" do
|
||||
block do
|
||||
node.rm('openstack', service, 'conf_secrets')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
execute 'glance-manage db_sync' do
|
||||
user node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
only_if { node['openstack']['db']['image']['migrate'] }
|
||||
end
|
||||
|
||||
# Configure glance-cache-pruner to run every 30 minutes
|
||||
cron 'glance-cache-pruner' do
|
||||
minute '*/30'
|
||||
command "/usr/bin/glance-cache-pruner #{node['openstack']['image']['cron']['redirection']}"
|
||||
end
|
||||
|
||||
# Configure glance-cache-cleaner to run at 00:01 everyday
|
||||
cron 'glance-cache-cleaner' do
|
||||
minute '01'
|
||||
hour '00'
|
||||
command "/usr/bin/glance-cache-cleaner #{node['openstack']['image']['cron']['redirection']}"
|
||||
end
|
||||
|
||||
# Ensure the owner/group of image cache directory is correct
|
||||
directory node['openstack']['image']['cache']['dir'] do
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
recursive true
|
||||
mode '755'
|
||||
end
|
||||
|
||||
service 'glance-api' do
|
||||
service_name platform_options['image_api_service']
|
||||
supports status: true, restart: true
|
||||
action [:enable, :start]
|
||||
subscribes :restart, [
|
||||
'template[/etc/glance/glance-scrubber.conf]',
|
||||
'template[/etc/glance/glance-cache.conf]',
|
||||
'template[/etc/glance/glance-api.conf]',
|
||||
], :immediately
|
||||
end
|
|
@ -1,91 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Recipe:: identity_registration
|
||||
#
|
||||
# Copyright:: 2013-2021, AT&T Services, Inc.
|
||||
# Copyright:: 2013-2021, Craig Tracey <craigtracey@gmail.com>
|
||||
# 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.
|
||||
#
|
||||
|
||||
class ::Chef::Recipe
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
identity_endpoint = internal_endpoint 'identity'
|
||||
auth_url = identity_endpoint.to_s
|
||||
|
||||
interfaces = {
|
||||
public: { url: public_endpoint('image_api') },
|
||||
internal: { url: internal_endpoint('image_api') },
|
||||
}
|
||||
|
||||
admin_user = node['openstack']['identity']['admin_user']
|
||||
admin_pass = get_password 'user', admin_user
|
||||
admin_project = node['openstack']['identity']['admin_project']
|
||||
admin_domain = node['openstack']['identity']['admin_domain_name']
|
||||
|
||||
service_pass = get_password 'service', 'openstack-image'
|
||||
service_project =
|
||||
node['openstack']['image_api']['conf']['keystone_authtoken']['project_name']
|
||||
service_user =
|
||||
node['openstack']['image_api']['conf']['keystone_authtoken']['username']
|
||||
service_role = node['openstack']['image']['service_role']
|
||||
service_domain_name = node['openstack']['image_api']['conf']['keystone_authtoken']['user_domain_name']
|
||||
region = node['openstack']['region']
|
||||
# TODO(ramereth): commenting this out until
|
||||
# https://github.com/fog/fog-openstack/pull/494 gets merged and released.
|
||||
# endpoint_type = node['openstack']['identity']['endpoint_type']
|
||||
|
||||
connection_params = {
|
||||
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_endpoint_type: endpoint_type,
|
||||
}
|
||||
|
||||
# Register Image Service
|
||||
openstack_service 'glance' do
|
||||
type 'image'
|
||||
connection_params connection_params
|
||||
end
|
||||
|
||||
interfaces.each do |interface, res|
|
||||
# Register Image Endpoints
|
||||
openstack_endpoint 'image' do
|
||||
service_name 'glance'
|
||||
interface interface.to_s
|
||||
url res[:url].to_s
|
||||
region region
|
||||
connection_params connection_params
|
||||
end
|
||||
end
|
||||
|
||||
# Register Service Tenant
|
||||
openstack_project service_project do
|
||||
connection_params connection_params
|
||||
end
|
||||
|
||||
# Register Service User
|
||||
openstack_user service_user do
|
||||
domain_name service_domain_name
|
||||
role_name service_role
|
||||
project_name service_project
|
||||
password service_pass
|
||||
connection_params connection_params
|
||||
action [:create, :grant_role]
|
||||
end
|
|
@ -1,64 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Recipe:: image_upload
|
||||
#
|
||||
# Copyright:: 2013-2021, IBM Corp.
|
||||
#
|
||||
# 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
|
||||
|
||||
if node['openstack']['image']['syslog']['use']
|
||||
include_recipe 'openstack-common::logging'
|
||||
end
|
||||
|
||||
include_recipe 'openstack-common::client'
|
||||
|
||||
package 'curl' do
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
identity_endpoint = public_endpoint 'identity'
|
||||
auth_url = identity_endpoint.to_s
|
||||
|
||||
# admin_user = node['openstack']['image_api']['conf']['keystone_authtoken']['username']
|
||||
# admin_pass = get_password admin_user, admin_pass
|
||||
admin_user = node['openstack']['identity']['admin_user']
|
||||
admin_pass = get_password 'user', admin_user
|
||||
admin_project_name = node['openstack']['image_api']['conf']['keystone_authtoken']['project_name']
|
||||
admin_project_domain_name = node['openstack']['image_api']['conf']['keystone_authtoken']['project_domain_name']
|
||||
admin_domain = node['openstack']['image_api']['conf']['keystone_authtoken']['user_domain_name']
|
||||
|
||||
node['openstack']['image']['upload_images'].each do |img|
|
||||
type = 'unknown'
|
||||
type = node['openstack']['image']['upload_image_type'][img.to_sym] if node['openstack']['image']['upload_image_type'][img.to_sym]
|
||||
id = ''
|
||||
id = node['openstack']['image']['upload_image_id'][img.to_sym] if node['openstack']['image']['upload_image_id'][img.to_sym]
|
||||
openstack_image_image "Image setup for #{img}" do
|
||||
image_url node['openstack']['image']['upload_image'][img.to_sym]
|
||||
image_name img
|
||||
image_type type
|
||||
image_public true
|
||||
image_id id
|
||||
identity_user admin_user
|
||||
identity_pass admin_pass
|
||||
identity_tenant admin_project_name
|
||||
identity_uri auth_url
|
||||
identity_user_domain_name admin_domain
|
||||
identity_project_domain_name admin_project_domain_name
|
||||
action :upload
|
||||
end
|
||||
end
|
|
@ -1,46 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Recipe:: swift_store
|
||||
#
|
||||
# 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
|
||||
|
||||
platform_options = node['openstack']['image']['platform']
|
||||
|
||||
platform_options['swift_packages'].each do |pkg|
|
||||
package pkg do
|
||||
action :upgrade
|
||||
options platform_options['package_overrides']
|
||||
end
|
||||
end
|
||||
|
||||
identity_endpoint = public_endpoint 'identity'
|
||||
swift_store_auth_address = identity_endpoint.to_s
|
||||
tenant = node['openstack']['image_api']['conf']['keystone_authtoken']['project']
|
||||
user = node['openstack']['image_api']['conf']['keystone_authtoken']['user']
|
||||
swift_store_user = "#{tenant}_#{user}"
|
||||
swift_user_tenant = nil
|
||||
node.default['openstack']['image_api']['conf_secrets']
|
||||
.[]('glance_store')['swift_store_key'] =
|
||||
get_password 'service', 'openstack-image'
|
||||
swift_store_auth_version = 2
|
||||
|
||||
node.default['openstack']['image_api']['conf']['glance_store'].tap do |store|
|
||||
store['default_backend'] = 'swift'
|
||||
store['swift_store_auth_version'] = swift_store_auth_version
|
||||
store['swift_store_auth_address'] = swift_store_auth_address
|
||||
store['swift_store_user'] = "#{swift_user_tenant}:#{swift_store_user}"
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
#
|
||||
# Cookbook:: openstack-image
|
||||
# Resource:: image
|
||||
#
|
||||
# Copyright:: 2012-2021, Rackspace US, Inc.
|
||||
# Copyright:: 2020-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.
|
||||
#
|
||||
|
||||
actions :upload
|
||||
default_action :upload
|
||||
unified_mode true
|
||||
|
||||
BOOLEAN = [TrueClass, FalseClass].freeze
|
||||
|
||||
attribute :image_url, kind_of: String
|
||||
attribute :image_type, kind_of: String, default: 'unknown', equal_to: %w(unknown ami qcow vhd vmdk vdi iso raw)
|
||||
attribute :image_name, kind_of: String, default: 'default'
|
||||
attribute :image_public, kind_of: BOOLEAN, default: true
|
||||
attribute :image_id, kind_of: String, default: ''
|
||||
attribute :identity_user, kind_of: String
|
||||
attribute :identity_pass, kind_of: String
|
||||
attribute :identity_tenant, kind_of: String
|
||||
attribute :identity_uri, kind_of: String
|
||||
attribute :identity_user_domain_name, kind_of: String
|
||||
attribute :identity_project_domain_name, kind_of: String
|
|
@ -1,34 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::api' do
|
||||
ALL_RHEL.each do |p|
|
||||
context "redhat #{p[:version]}" do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(p) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'image-stubs'
|
||||
|
||||
case p
|
||||
when REDHAT_7
|
||||
it 'does not upgrade keystoneclient package' do
|
||||
expect(chef_run).not_to upgrade_package('python-keystoneclient')
|
||||
end
|
||||
when REDHAT_8
|
||||
it 'does not upgrade keystoneclient package' do
|
||||
expect(chef_run).not_to upgrade_package('python3-keystoneclient')
|
||||
end
|
||||
end
|
||||
|
||||
it 'does not upgrade swift packages by default' do
|
||||
expect(chef_run).not_to upgrade_package('openstack-swift')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to enable_service('openstack-glance-api')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
208
spec/api_spec.rb
208
spec/api_spec.rb
|
@ -1,208 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::api' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'image-stubs'
|
||||
|
||||
it do
|
||||
expect(chef_run).to include_recipe('openstack-common::client')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to upgrade_package('glance')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_directory('/etc/glance')
|
||||
.with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '700'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_directory('/var/lib/glance/images')
|
||||
.with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '750',
|
||||
recursive: true
|
||||
)
|
||||
end
|
||||
|
||||
describe 'glance-api.conf' do
|
||||
let(:file) { chef_run.template('/etc/glance/glance-api.conf') }
|
||||
it do
|
||||
expect(chef_run).to create_template(file.name)
|
||||
.with(
|
||||
source: 'openstack-service.conf.erb',
|
||||
cookbook: 'openstack-common',
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
|
||||
[
|
||||
%r{^log_file = /var/log/glance/api.log$},
|
||||
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
|
||||
/^bind_host = 127.0.0.1$/,
|
||||
/^bind_port = 9292$/,
|
||||
/^enabled_backends = file:file,http:http$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('DEFAULT', line)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
%r{^filesystem_store_datadir = /var/lib/glance/images$},
|
||||
/^default_backend = file$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('glance_store', line)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
/^flavor = keystone$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('paste_deploy', line)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
/^auth_type = password$/,
|
||||
/^region_name = RegionOne$/,
|
||||
/^username = glance$/,
|
||||
/^project_name = admin$/,
|
||||
%r{^auth_url = http://127.0.0.1:5000/v3$},
|
||||
/^password = glance-pass$/,
|
||||
/^user_domain_name = Default$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('keystone_authtoken', line)
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
%r{^connection = mysql\+pymysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$},
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name)
|
||||
.with_section_content('database', line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'glance-cache.conf' do
|
||||
let(:file) { chef_run.template('/etc/glance/glance-cache.conf') }
|
||||
|
||||
it 'creates glance-cache.conf' do
|
||||
expect(chef_run).to create_template(file.name)
|
||||
.with(
|
||||
source: 'openstack-service.conf.erb',
|
||||
cookbook: 'openstack-common',
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'glance-scrubber.conf' do
|
||||
let(:file) { chef_run.template('/etc/glance/glance-scrubber.conf') }
|
||||
|
||||
it 'creates glance-scrubber.conf' do
|
||||
expect(chef_run).to create_template(file.name)
|
||||
.with(
|
||||
source: 'openstack-service.conf.erb',
|
||||
cookbook: 'openstack-common',
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_cron('glance-cache-pruner')
|
||||
.with(
|
||||
command: '/usr/bin/glance-cache-pruner > /dev/null 2>&1',
|
||||
minute: '*/30'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_cron('glance-cache-cleaner')
|
||||
.with(
|
||||
command: '/usr/bin/glance-cache-cleaner > /dev/null 2>&1',
|
||||
minute: '01',
|
||||
hour: '00'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_directory('/var/lib/glance/image-cache/')
|
||||
.with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: '755',
|
||||
recursive: true
|
||||
)
|
||||
end
|
||||
|
||||
%w(image_api image_cache image_scrubber).each do |service|
|
||||
it do
|
||||
expect(chef_run).to run_ruby_block(
|
||||
"delete all attributes in node['openstack']['#{service}']['conf_secrets']"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'db_sync' do
|
||||
let(:cmd) { 'glance-manage db_sync' }
|
||||
|
||||
it 'runs migrations' do
|
||||
expect(chef_run).to run_execute(cmd).with(user: 'glance', group: 'glance')
|
||||
end
|
||||
|
||||
context 'migration set to false' do
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it 'does not run migrations when openstack/image/db/migrate is false' do
|
||||
node.override['openstack']['db']['image']['migrate'] = false
|
||||
expect(chef_run).not_to run_execute(cmd)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to enable_service('glance-api')
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to start_service('glance-api')
|
||||
end
|
||||
|
||||
it do
|
||||
resource = chef_run.service('glance-api')
|
||||
expect(resource).to subscribe_to('template[/etc/glance/glance-api.conf]').on(:restart).immediately
|
||||
expect(resource).to subscribe_to('template[/etc/glance/glance-cache.conf]').on(:restart).immediately
|
||||
expect(resource).to subscribe_to('template[/etc/glance/glance-scrubber.conf]').on(:restart).immediately
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,85 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::identity_registration' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'image-stubs'
|
||||
|
||||
connection_params = {
|
||||
openstack_auth_url: 'http://127.0.0.1:5000/v3',
|
||||
openstack_username: 'admin',
|
||||
openstack_api_key: 'admin-pass',
|
||||
openstack_project_name: 'admin',
|
||||
openstack_domain_name: 'default',
|
||||
# openstack_endpoint_type: 'internalURL',
|
||||
}
|
||||
service_name = 'glance'
|
||||
service_type = 'image'
|
||||
service_user = 'glance'
|
||||
url = 'http://127.0.0.1:9292'
|
||||
region = 'RegionOne'
|
||||
project_name = 'admin'
|
||||
role_name = 'admin'
|
||||
password = 'glance-pass'
|
||||
domain_name = 'Default'
|
||||
|
||||
it "registers #{project_name} Project" do
|
||||
expect(chef_run).to create_openstack_project(
|
||||
project_name
|
||||
).with(
|
||||
connection_params: connection_params
|
||||
)
|
||||
end
|
||||
|
||||
it "registers #{service_name} service" do
|
||||
expect(chef_run).to create_openstack_service(
|
||||
service_name
|
||||
).with(
|
||||
connection_params: connection_params,
|
||||
type: service_type
|
||||
)
|
||||
end
|
||||
|
||||
context "registers #{service_name} endpoint" do
|
||||
%w(internal public).each do |interface|
|
||||
it "#{interface} endpoint with default values" do
|
||||
expect(chef_run).to create_openstack_endpoint(
|
||||
service_type
|
||||
).with(
|
||||
service_name: service_name,
|
||||
# interface: interface,
|
||||
url: url,
|
||||
region: region,
|
||||
connection_params: connection_params
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'registers service user' do
|
||||
expect(chef_run).to create_openstack_user(
|
||||
service_user
|
||||
).with(
|
||||
domain_name: domain_name,
|
||||
project_name: project_name,
|
||||
password: password,
|
||||
connection_params: connection_params
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to grant_role_openstack_user(
|
||||
service_user
|
||||
).with(
|
||||
project_name: project_name,
|
||||
role_name: role_name,
|
||||
password: password,
|
||||
domain_name: domain_name,
|
||||
connection_params: connection_params
|
||||
)
|
||||
end
|
||||
end
|
|
@ -1,110 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::image_upload' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS.merge(step_into: ['openstack_image_image'])) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
include_context 'image-stubs'
|
||||
|
||||
it do
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep cirros').and_return(false)
|
||||
expect(chef_run).to upgrade_package('curl')
|
||||
end
|
||||
|
||||
it 'uploads the cirros image' do
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep cirros').and_return(false)
|
||||
expect(chef_run).to upload_openstack_image_image('Image setup for cirros').with(
|
||||
image_url: 'http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img',
|
||||
image_name: 'cirros',
|
||||
image_type: 'qcow',
|
||||
image_public: true,
|
||||
image_id: 'e1847f1a-01d2-4957-a067-b56085bf3781',
|
||||
identity_user: 'admin',
|
||||
identity_pass: 'admin-pass',
|
||||
identity_tenant: 'admin',
|
||||
identity_uri: 'http://127.0.0.1:5000/v3'
|
||||
)
|
||||
end
|
||||
|
||||
context 'raises error for unsupported image extension type' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['image']['upload_images'] = ['image1']
|
||||
node.override['openstack']['image']['upload_image']['image1'] = 'http://download.net/image.xxx'
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it do
|
||||
expect { chef_run }.to raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
||||
context 'uploads the tar image' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['image']['upload_images'] = ['imageName']
|
||||
node.override['openstack']['image']['upload_image']['imageName'] = 'http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-uec.tar.gz'
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it do
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep imageName').and_return(false)
|
||||
expect(chef_run).to upload_openstack_image_image('Image setup for imageName').with(
|
||||
image_url: 'http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-uec.tar.gz',
|
||||
image_name: 'imageName',
|
||||
image_type: 'unknown',
|
||||
image_public: true
|
||||
)
|
||||
expect(chef_run).to run_bash('Uploading AMI image imageName')
|
||||
end
|
||||
end
|
||||
|
||||
%w(vhd vmdk vdi iso raw).each do |image_type|
|
||||
context "uploads the #{image_type} image" do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['image']['upload_images'] = ["#{image_type}_imageName"]
|
||||
node.override['openstack']['image']['upload_image']["#{image_type}_imageName"] = "image_file.#{image_type}"
|
||||
node.override['openstack']['image']['upload_image_type']["#{image_type}_imageName"] = image_type.to_s
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it do
|
||||
stub_command("glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep #{image_type}_imageName").and_return(false)
|
||||
expect(chef_run).to upload_openstack_image_image("Image setup for #{image_type}_imageName").with(
|
||||
image_url: "image_file.#{image_type}",
|
||||
image_name: "#{image_type}_imageName",
|
||||
image_type: image_type.to_s,
|
||||
image_public: true
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'uploads the raw and vdi images' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['image']['upload_images'] = %w(raw_imageName vdi_imageName)
|
||||
node.override['openstack']['image']['upload_image']['raw_imageName'] = 'image_file.raw'
|
||||
node.override['openstack']['image']['upload_image_type']['raw_imageName'] = 'raw'
|
||||
node.override['openstack']['image']['upload_image']['vdi_imageName'] = 'image_file.vdi'
|
||||
node.override['openstack']['image']['upload_image_type']['vdi_imageName'] = 'vdi'
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it do
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep raw_imageName').and_return(false)
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep vdi_imageName').and_return(false)
|
||||
expect(chef_run).to upload_openstack_image_image('Image setup for raw_imageName').with(
|
||||
image_url: 'image_file.raw',
|
||||
image_name: 'raw_imageName',
|
||||
image_type: 'raw',
|
||||
image_public: true
|
||||
)
|
||||
expect(chef_run).to upload_openstack_image_image('Image setup for vdi_imageName').with(
|
||||
image_url: 'image_file.vdi',
|
||||
image_name: 'vdi_imageName',
|
||||
image_type: 'vdi',
|
||||
image_public: true
|
||||
)
|
||||
end
|
||||
end
|
||||
# TODO(MRV) Need to add provider method testers in here.
|
||||
end
|
||||
end
|
|
@ -1,249 +0,0 @@
|
|||
require 'chefspec'
|
||||
require 'chefspec/berkshelf'
|
||||
require 'chef/application'
|
||||
|
||||
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
|
||||
|
||||
# Helper methods
|
||||
module Helpers
|
||||
# Create an anchored regex to exactly match the entire line
|
||||
# (name borrowed from grep --line-regexp)
|
||||
#
|
||||
# @param [String] str The whole line to match
|
||||
# @return [Regexp] The anchored/escaped regular expression
|
||||
def line_regexp(str)
|
||||
/^#{Regexp.quote(str)}$/
|
||||
end
|
||||
end
|
||||
|
||||
shared_context 'image-stubs' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
|
||||
.with('lo')
|
||||
.and_return('127.0.1.1')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:config_by_role)
|
||||
.with('rabbitmq-server', 'queue')
|
||||
.and_return(
|
||||
'host' => 'rabbit-host', 'port' => 'rabbit-port'
|
||||
)
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
|
||||
.and_return '1.1.1.1:5672,2.2.2.2:5672'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('token', 'openstack_identity_bootstrap_token')
|
||||
.and_return('bootstrap-token')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('token', 'openstack_vmware_secret_name')
|
||||
.and_return 'vmware_secret_name'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', 'glance')
|
||||
.and_return('db-pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('service', 'openstack-image')
|
||||
.and_return('glance-pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('user', 'guest')
|
||||
.and_return('mq-pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('user', 'admin')
|
||||
.and_return('admin-pass')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_transport_url)
|
||||
.with('image')
|
||||
.and_return('rabbit://guest:mypass@127.0.0.1:5672')
|
||||
allow(Chef::Application).to receive(:fatal!)
|
||||
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list --id e1847f1a-01d2-4957-a067-b56085bf3781 | grep cirros').and_return('')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'common-logging-recipe' do
|
||||
it 'does not include logging recipe by default' do
|
||||
expect(chef_run).not_to include_recipe('openstack-common::logging')
|
||||
end
|
||||
|
||||
it 'includes logging recipe if openstack/image/syslog/use attribute is true' do
|
||||
node.override['openstack']['image']['syslog']['use'] = true
|
||||
|
||||
expect(chef_run).to include_recipe('openstack-common::logging')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'common-packages' do
|
||||
it 'upgrades curl package' do
|
||||
expect(chef_run).to upgrade_package 'curl'
|
||||
end
|
||||
|
||||
it 'upgrades glance package' do
|
||||
expect(chef_run).to upgrade_package 'glance'
|
||||
end
|
||||
|
||||
it 'honors the platform name and option package overrides' do
|
||||
node.override['openstack']['image']['platform']['package_overrides'] = '-o Dpkg::Options:: = \'--force-confold\' -o Dpkg::Options:: = \'--force-confdef\' --force-yes'
|
||||
node.override['openstack']['image']['platform']['image_packages'] = ['my-glance']
|
||||
|
||||
expect(chef_run).to upgrade_package('my-glance').with(options: '-o Dpkg::Options:: = \'--force-confold\' -o Dpkg::Options:: = \'--force-confdef\' --force-yes')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'image-lib-cache-directory' do
|
||||
describe '/var/lib/glance/image-cache/' do
|
||||
let(:dir) { chef_run.directory('/var/lib/glance/image-cache/') }
|
||||
|
||||
it 'creates directory /var/lib/glance/image-cache' do
|
||||
expect(chef_run).to create_directory(dir.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 0o0755,
|
||||
recursive: true
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'glance-directory' do
|
||||
describe '/etc/glance' do
|
||||
let(:dir) { chef_run.directory('/etc/glance') }
|
||||
|
||||
it 'creates directory /etc/glance' do
|
||||
expect(chef_run).to create_directory(dir.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 0o0700
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'custom template banner displayer' do
|
||||
it 'shows the custom banner' do
|
||||
node.override['openstack']['image']['custom_template_banner'] = 'custom_template_banner_value'
|
||||
expect(chef_run).to render_file(file_name).with_content(/^custom_template_banner_value$/)
|
||||
end
|
||||
end
|
||||
|
||||
shared_context 'endpoint-stubs' do
|
||||
before do
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('service', 'openstack-image')
|
||||
.and_return('admin_password_value')
|
||||
end
|
||||
end
|
||||
|
||||
shared_context 'sql-stubs' do
|
||||
before do
|
||||
node.override['openstack']['db']['image']['username'] = 'db_username_value'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', 'glance')
|
||||
.and_return('db_password_value')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:db_uri)
|
||||
.with('image', 'db_username_value', 'db_password_value')
|
||||
.and_return('sql_connection_value')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'syslog use' do
|
||||
it 'shows log_config if syslog use is enabled' do
|
||||
node.override['openstack']['image']['syslog']['use'] = true
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^log_config = /etc/openstack/logging.conf$})
|
||||
end
|
||||
|
||||
it 'shows log_file if syslog use is disabled' do
|
||||
node.override['openstack']['image']['syslog']['use'] = false
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/#{log_file_name}$})
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'keystone attribute setter' do |version|
|
||||
it 'sets the identity_uri value' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^identity_uri = http://127.0.0.1:5000/$})
|
||||
end
|
||||
|
||||
context 'auth version' do
|
||||
it 'shows the version attribute if it is different from v3' do
|
||||
node.override['openstack']['api']['auth']['version'] = 'v3.0'
|
||||
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v3.0$/)
|
||||
end
|
||||
end
|
||||
|
||||
%w(project user).each do |attr|
|
||||
it "sets the auth admin #{attr} attribute" do
|
||||
node.override['openstack']["image-#{version}"]['conf']['keystone_authtoken']["admin_#{attr}"] = "service_#{attr}_value"
|
||||
expect(chef_run).to render_file(file.name).with_content(/^admin_#{attr} = service_#{attr}_value$/)
|
||||
end
|
||||
end
|
||||
|
||||
it 'sets the admin password attribute' do
|
||||
expect(chef_run).to render_file(file.name).with_content(/^admin_password = admin_password_value$/)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'messaging' do |version|
|
||||
context 'messaging' do
|
||||
before do
|
||||
node.override['openstack']['image']['notification_driver'] = 'messaging'
|
||||
end
|
||||
|
||||
it 'sets the notifier_strategy attribute' do
|
||||
node.override['openstack']["image-#{version}"]['conf']['DEFAULT']['notifier_strategy'] = 'default'
|
||||
expect(chef_run).to render_file(file.name).with_content(/^notifier_strategy = default$/)
|
||||
end
|
||||
|
||||
context 'commonly named attributes' do
|
||||
%w(notification_driver rpc_backend rpc_thread_pool_size
|
||||
rpc_conn_pool_size rpc_response_timeout control_exchange).each do |attr|
|
||||
it "sets the #{attr} attribute" do
|
||||
node.override['openstack']["image-#{version}"]['conf']['DEFAULT'][attr] = "#{attr}_value"
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^#{attr} = #{attr}_value$/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'rabbitmq' do
|
||||
before do
|
||||
node.override['openstack']["image-#{version}"]['conf']['DEFAULT']['rpc_backend'] = 'rabbit'
|
||||
node.override['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']['rabbit_userid'] = 'rabbit_userid_value'
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('user', 'rabbit_userid_value')
|
||||
.and_return('rabbit_password_value')
|
||||
end
|
||||
|
||||
%w(host port userid).each do |attr|
|
||||
it "sets the rabbitmq #{attr} attribute" do
|
||||
node.override['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']["rabbit_#{attr}"] = "rabbit_#{attr}_value"
|
||||
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_#{attr} = rabbit_#{attr}_value$/)
|
||||
end
|
||||
end
|
||||
|
||||
it 'sets the rabbitmq password' do
|
||||
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_password = mq-pass$/)
|
||||
end
|
||||
|
||||
it 'sets the rabbitmq vhost' do
|
||||
node.override['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']['rabbit_virtual_host'] = 'rabbit_vhost_value'
|
||||
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_virtual_host = rabbit_vhost_value$/)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,17 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::swift_store' do
|
||||
ALL_RHEL.each do |p|
|
||||
context "redhat #{p[:version]}" do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(p) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
include_context 'image-stubs'
|
||||
it do
|
||||
expect(chef_run).to upgrade_package('openstack-swift')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::swift_store' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
include_context 'image-stubs'
|
||||
it do
|
||||
expect(chef_run).to upgrade_package('python3-swift')
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue