Commit Graph

45 Commits

Author SHA1 Message Date
Zuul 4a3666c103 Merge "Support image property protections configuration" 2024-01-09 06:06:07 +00:00
Takashi Kajinami d1401c48ad Support image property protections configuration
This allows users to configure the image property protections
feature[1] using this module.

[1] https://docs.openstack.org/glance/latest/admin/property-protections.html

Closes-Bug: 2036732
Change-Id: I3b985b2b280e6d2b678078f4430db02dccca657c
2024-01-03 11:05:00 +09:00
Zuul daf01a83ba Merge "Fix wrong config file name described in type description" 2023-12-24 08:13:24 +00:00
Takashi Kajinami cf09386478 Fix wrong config file name described in type description
Trivial-Fix

Change-Id: I3ce5f8cec7852dbb8124d52df7ef2c429f4a0152
2023-12-24 13:12:01 +09:00
Takashi Kajinami 89513a4d61 glance_image: Enforce correct type for properties
This property supports only strings or hashes.

Change-Id: Icf25ce9e2d76c726d3299eb3b5833b3bb3dfc4f0
2023-11-26 02:26:10 +09:00
Takashi Kajinami 50e67be163 Stop reading keystone_authtoken options
Using credentials in keystone_authtoken options for glance_* resources
was deprecated some cycles ago[1].

[1] 17cc71c509

Change-Id: I57a2ecc763ccac52d9122afa86871ad74bca7450
2023-11-16 15:26:30 +09:00
Takashi Kajinami 1473037e7f Add support for rootwrap.conf
Change-Id: Ib28c3f1a8b46c439a16874c5695f121bf63c3bb9
2022-07-11 14:22:58 +00:00
Takashi Kajinami aaa352a3af Support more file backend parameters
This change improves coverage of the file backend parameters. Because
the filesystem_store_datadirs parameter is MultiStrOpt, support for
MultiStrOpt is also introduced to the glance_cache_config resource
type.

Change-Id: I5785605bf4224c0f189fd7700d5a9b05def058e8
2022-02-13 01:28:44 +09:00
Takashi Kajinami 983f6199d4 glance_image: Add support for project_id/name
This change adds the new project_id/name attribute to the glance_image
resource type, so that users can customize owner of glance images
managed by the resource.

Change-Id: I79c231d857079896bf101408aa758ef056669585
2021-11-25 18:45:46 +09:00
Takashi Kajinami 53b75099d0 Allow customizing separator for api-paste.ini
The api-paste.ini accepts not only "=" but also ":" and some services
like Barbican have been using ":" for their default api-paste.ini
files.

[composite:main]
use = egg:Paste#urlmap
/: barbican_version
/v1: barbican-api-keystone

This change allows users to use ":" so that they can update the ini
files with keeping it consistent with the default fules

Depends-on: https://review.opendev.org/813614
Change-Id: I200a971d120feed0afaa7833ee383f01bfe6b9b7
2021-10-15 12:04:41 +09:00
Takashi Kajinami 10872d13eb Add support for MultiStrOpt
This replaces the provider implementation of glance_api_config type
so that MultiStrOpt, which is used by several options like
 - oslo_messaging_notifications/driver
 - oslo_policy/policy_dirs
is handled correctly.

Change-Id: I6c0ea1276d16722c9908a20333890a4a17404b61
2021-05-08 12:02:31 +09:00
Thomas Goirand 36e09b4bb2 Add support for glance_api_uwsgi_config in Debian
This patch is adding the configuration of the number of workers,
threads, and the size of the listen queue in Debian, which uses
uwsgi to run Glance API. Therefore, this patch adds a new
glance_api_uwsgi_config provider as well as a new
glance::wsgi::uwsgi class.

Change-Id: If02def38d583f2255b8a0219dc53c26f0980521c
2021-04-09 23:43:59 +02:00
Takashi Kajinami 2ae1115e42 Clean up remaining items for glance-registry
This change drops remaining items about support for glance-registry.
These were deprecated by the removal patch[1] which was merged during
the previous cycle thus we are now ready to drop them.

[1] 11599ba429

Change-Id: If2d371a372cf4d95d84e3d71fb4ce272565ac659
2021-03-17 07:41:23 +09:00
Takashi Kajinami 11599ba429 Remove support for glance-registry service
This patch removes support for glance-registry service, because it has
been removed from glance [1].
 [1] https://review.opendev.org/#/c/738671/

Change-Id: Id05f736dbbddaff2cb90aa6678c777b9a0318e40
2020-07-28 19:41:10 +09:00
Takashi Kajinami 10a9cbe4d7 Use anchor to require necessary packages/services
... so that correct packages and services are required according
without re-defining them in resource implementations.

Change-Id: I03016890692b406ca86750d7ec8b3b3e1d276b1a
2020-05-04 02:15:52 +09:00
PranaliD 091c01b7b8 Enable image import conversion & image output format
Glance image conversion configuration is not enabled by
puppet-glance in glance-image-import.conf.

Adding image_import_plugins & output format parameters to enable
glance image conversion.

Change-Id: I098aa0cabf2518b8861d5b58b885d9bdef54a7f6
Closes-Bug: #1807366
2018-12-10 13:41:53 +05:30
Daniel Pawlik 896f4cebbd Added tag property for glance_image provider class
Change-Id: I1772a231c6e3c8ece7f13ca6935d38e3818d2990
2018-11-14 13:51:11 +00:00
Tobias Urdin 8a275afc76 Add proxy support to glance_image resource
The glance_image resource provides the ability to
download remote images using the source parameter.
Specifying the proxy parameter will allow one to
use a proxy server when downloading the image.

Change-Id: I540a29be3eb6c95b1c3975228c23c9154b1a0cbe
Closes-Bug: 1719874
2018-04-04 22:51:14 +02:00
Pierre Riteau 7fa183bd58 Fix Puppet syntax in glance_image example
Change-Id: If14aa8966d6cff3baad0529a029d210260a00fa9
2017-10-23 16:01:55 +01:00
Denis Egorenko 1123f79809 Drop Glare service from puppet-glance
Glare service is now totally dropped from Glance [1] and now should
be configured only with puppet-glare module.

[1] https://review.openstack.org/#/c/427535/

Change-Id: I695ad518285a92a80dd7a9d5bebd11e804359224
2017-09-20 20:31:08 +00:00
Evgeny Antyshev dea0beff1a Fix parsing of image properties
when more then one pair of key/value's are given
then this code shows wrong behavior:

vm_mode=exe,cinder_img_volume_type=vstorage
it makes this:
vm_mode=''exe',cinder_img_volume_type=vstorage'

Reason is the first conversion being to broad, and 2nd match matches
the whole string.

Change-Id: I5bcf23374b57197680b87b554392ee172bf90571
2017-06-13 15:35:50 +00:00
Evgeny Antyshev d66fa43019 Add ploop to supported disk formats
"ploop" image format is supported in upstream Glance:
https://review.openstack.org/341633
And also in python-openstackclient
in Ic79f29a1fe9ea5016d3d5520c2b06e39da01ff61

Change-Id: I2336687db363136e12c5fca5d46e9ce0ba5d791c
2017-01-18 13:24:29 +00:00
Alexander Arzhanov 804afb9c3e Fix typo in values for disk_format
Fix typo in value vmd to vmdk.

Closes-Bug: #1604829

Change-Id: I0f2a3b7e37a3adbde7fdfaf91e518e0b97a40679
2016-07-20 17:40:18 +03:00
Alfredo Moralejo 3079b7caae Add option id to glance_image
In glance, user can specify the desired id when creating
a new image. This can be convenient for some cases where
users want predictable ids for image, as referencing ramdisk_id
or kernel_id for AMI images.

Change-Id: I7868f2005041dea6ecd63cd601e9244cefd08e5b
2016-05-25 09:26:27 +00:00
Michael Polenchuk d0957fb622 Add ability to set properties with glance_image
This change updates the glance_image provider to support the ability to
specify properties for an image.  This change only adds the support for
setting properties. The conversion and update to using the v2 will
require further rework of this provider.

Change-Id: I22b92c5ccd0f77c837e9abe987cee07c7d90867e
Co-Authored-By: Alex Schultz <aschultz@mirantis.com>
2016-04-04 14:57:25 -06:00
Denis Egorenko da8a3aa022 Add Glance Glare API service
In Mitaka Glance v3 was moved to stand alone service [1] - now
it's called Glance Artifacts Repository (Glare).

This patch adds appropriate service managing, package installation,
configuration and related spec tests.

[1] I5b7bd4cdcc5f2a40fc4a5f74bcc422fd700c4fb0

Change-Id: I3371d1d57486e79ccfae565417f2195d3ae66bc9
Closes-bug: #1555697
2016-03-22 18:50:29 +03:00
Denis Egorenko c8b7d3319b Use glance-swift conf for swift backend
For working with Swift backend, Glance needs authentication parameters,
which are supplied to Swift when making calls to its storage system.
Glance will use information from the file specified under parameter
swift_store_config_file. When this parameter is set to the same file
(glance-api.conf), we have lot of non-critical errors in glance-api
log, because of 'Invalid format of swift store config'.

The same problem, when we have RadosGW.

Change-Id: I18ee8f68f7ce793d2580685e79ed636556c57ddd
Related-bug: #1540890
2016-02-02 17:34:33 +03:00
gcmalloc 7e2e1162d0 Add support for min ram and min disk
Add min_ram and min_disk properties to the glance_image resource.

Change-Id: I27202559bc73283a318575669c957238f5aee988
2016-01-25 17:54:41 -08:00
Cody Herriges b011f42591 Make sure Facter is only executed on agent
This commit moves conditionals based on values obtained from Facter
  inside code blocks that are only executed on agents and replaces
  the use of Facter['osfamily'].value with Facter.value:(:osfamily).

  Without this change we are returning values based off the master's
  facts, so if a Debian agent checks into a RedHat master then the type
  is currently making a decision based off of RedHat and not the actual
  OS of the agent running the catalog.  Code ran outside blocks is
  evaluated on masters and inside a block is evaluated by the agent when
  the catalog is executed.  We do not notice this because all our
  testing uses "puppet apply" and autorequire only matters when they
  find a matching resource name in the catalog.  The latter results
  in no error because the relationship is simply ignored on the Debian
  agent if a package resource with the RedHat name is not found.

  This issue was found by running facter 3, the C++11 re-implementation
  under the jruby and clojure implemented puppetserver.  The clojure
  jni shim written so that facter can be ran inside of puppetserver does
  not implement the [] method for the Facter module but the ruby shim
  does.  So I noticed that the code had an issue when
  Facter['osfamily'].value was executed on the master, which returned a
  not method error.  Once again, something we didn't notice becuase we
  do not test against a master.  I decided to migrate to
  Facter.value(:osfamily) to simply keep to an API that is consistent
  across both puppet and puppetserver but fixing where the code runs
  does actually solve the not method found error.

Change-Id: I773f20e0bc1e917f6ec5fa8830f5bbfa60b6cd8a
2015-11-12 14:59:21 -08:00
Dan Prince bce0eac01c Autorequire correct package based on the distro
Some distros (RHEL based) have a single glance package. On those
distros the ensure_package/autorequire stuff doesn't quite work
correctly as per the type code it is assumed two packages 'glance-api'
and 'glance-registry'

This commit makes sure that on RHEL based distros type only autorequire
'openstack-glance' while on other distros it correctly autorequire
'glance-api' and 'glance-registry'

Change-Id: I17c84b2282beadaec80f4db42fa5696b7967159f
Closes-bug: #1493442
Co-Authored-By: Yanis Guenane <yguenane@redhat.com>
2015-09-09 12:37:30 +02:00
Yanis Guenane 8db8143c89 Reflect provider change in puppet-openstacklib
With the creation of the new openstack_config provider, some processing
that was done in glance_api_config has been centralized in
openstack_config.

The same changes apply for glance_registry_config and
glance_cache_config

Impacted methods are :

  * section
  * setting
  * separator

Also, this commit adds the fact that, when passing a specific string
(ensure_absent_val) the provider will behave as if ensure => absent was
specified. '<SERVICE DEFAULT>' is the default value for
ensure_absent_val.

The use case is the following :

glance_api_config { 'DEFAULT/foo' : value => 'bar' } # will work as usual

glance_api_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>' } # will mean absent

That means that all the current :

if $myvar {
  glance_api_config { 'DEFAULT/foo' : value => $myvar }
} else {
  glance_api_config { 'DEFAULT/foo' : ensure => absent }
}

can be removed in favor of :

glance_api_config { 'DEFAULT/foo' : value => $myvar }

If for any reason '<SERVICE DEFAULT>' turns out to be a valid value for
a specific parameter. One could by pass that doing the following :

glance_api_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>',
ensure_absent_val => 'foo' }

Change-Id: I3bbdf63d1b9b5a2daba30fd4ba897db703f979ae
Depends-On: I0eeebde3aac2662cc7e69bfad7f8d2481463a218
2015-08-19 12:42:38 +02:00
Yanis Guenane d769137e38 Rely on autorequire for config resource ordering
Currently we specify the ordering of config resources wherever it is
necessary based on the presence of the file it will write to, or the
presence of the package in charge of providing the file it will write
to.

Those kind of ordering can be specified directly at the resource level
using the autorequire mechanism. With this patch, any config resource
will make sure the package in charge of providing the file will be
installed first.

Change-Id: Idb19da25958e79787b0c66e4ae275216849a9a2e
2015-08-19 12:41:16 +02:00
Colleen Murphy ed81166320 Append openstacklib/lib to load path for type
As we discovered before[1] with puppet-keystone, rspec-puppet has
trouble loading paths in some circumstances. This patch updates the
$LOAD_PATH in the newly rewritten glance_image type so that unit tests
in other modules can properly load the openstacklib backend.

[1] https://bugs.launchpad.net/puppet-keystone/+bug/1408531

Change-Id: Ifa3cbd46b8b32695848d4c2e8f837881c46a7d98
2015-08-11 17:48:33 -07:00
Colleen Murphy 39b58df7a8 Use OpenstackClient for glance_image auth
This patch changes the glance_image provider to use
puppet-openstacklib's authentication methods, which use
python-openstackclient as an interface, instead of the glance command
line client. The benefits of this is:

- Code reduction. This patch reduces the amount of code in the
  glance parent provider and glance_image provider by reusing code from
  Puppet::Provider::Openstack instead of implementing authentication,
  retries, and response parsing in the provider.
- Presumed reduction in sudden API changes that require quick fixes in
  this module, such as f377c0229c.
- Ability to set project-based access control for images

Additional reasoning for this change is in the blueprint.

Important note: this change does not work on Ubuntu under Juno due to a
major bug in the version of python-openstackclient shipped in UCA [1].
This change targets the Kilo releases.

Note about performance: the self.instances and instances methods make
API requests for each image found in the list of instances. This is not
a change from how this was implemented before. The --long formatted
list, either from the glance client or openstackclient, does not
provide all information needed to query an instance and populate
setters. Future patches could possibly improve on this.

Other details of this change:

- Removes auth_glance method, replaced by the request and
  glance_request methods
- Removes auth_glance_stdin method which was not being used
- Removes parse_table which is now unnecessary because openstackclient
  formats its responses as CSV and Puppet::Provider::Openstack#request
  returns the results a hash
- Removes remove_warnings methods which are handled by
  Puppet::Provider::Openstack#request
- Removes list_glance_images and get_glance_image_attr which are
  sufficiently replaced by using the 'list' and 'show' commands with
  Puppet::Provider::Openstack's request method.
- Removed self.prefetch since we can't populate auth parameters during
  a prefetch. Instead we prepopulate the list via the instances method.
- Added a flush method to do updates more efficiently
- Changed is_public property to accept true/false in addition to yes/no
  and to munge to a symbol instead of a capitalized string, for
  consistency with keystone_tenant's enabled property
- Move the reset method into the spec tests since it is only necessary
  for testing
- Added tests for glance_image, which did not exist before
- Removed connection retry test since this is taken care of in
  openstacklib

[1] https://bugs.launchpad.net/python-openstackclient/+bug/1269821

blueprint use-openstackclient-in-module-resources

Change-Id: Iceab5e1c6138e7aba0f883ed4acb8f7ecbcd2830
2015-06-29 17:35:23 -07:00
Colleen Murphy 1d0a8ba83d Change location to be a param, not a property
The location property of the glance_image type has nearly identical
functionality as the source param, yet one is a param and one is a
property. It is possible to change either of these for a glance image,
but only if it is as of yet unset, and therefore unsaved. It is not
possible to change the location of a glance image once it has been
saved, nor is it possible to query it afterward. Since having location
be a property when it is usually unsettable and is always unqueryable
does not make much sense, we change it to be a param to be consistent
with the source param.

Change-Id: I686c3fec9bf571d18e282888c626d795c9958a6b
2015-04-10 15:18:34 -07:00
Javier Pena 06182be5f7 Fix is_public munge
Commit 031609b572 changed the way
is_public was munged. However, when testing it it looks like it
was always seen as an empty string after this, so all created
images were private. Changing the way the 'if' block is done fixes
it.

Change-Id: If2eb52a6d0d9be89c9323702616f62f8ecba5e02
2014-12-19 00:51:52 +01:00
Francois Deppierraz 031609b572 Correctly munge glance_image is_public property
glance expects True/False values whereas this type uses Yes/No.

Without this patch, puppet would return the following message with an
existing glance image with is_public attribute already set to 'True'.

puppet-agent[18190]: (/Stage[main]/Site::Controller/Glance_image[raring-server-cloudimg-amd64]/is_public) is_public changed 'True' to 'Yes'

Change-Id: I532e08e6815a8b03f5eb6a9495d886b9855762c8
2014-11-27 21:49:28 +01:00
Stefano Zilli a0c5c271ef Hide secrets from puppet logs
Currently secrets like rabbit_password or admin_password are displayed in
puppet logs when changed. This commit changes glance_*_config and
glance_*_ini types adding a new parameter that triggers obfuscation of
the values in puppet logs.

Change-Id: I31f974a9afadef42939ee092ecba3b8f4333bb8b
Closes-Bug: #1328448
2014-07-12 02:42:13 +02:00
Pradeep Kilambi 93d02bb115 Include iso as supported disk_format
iso is a supported type for disk_format, include it as
a supported property value

Change-Id: I7026a8e4bae235acaae0a9856fab8a47ccb3e49e
2013-08-12 11:41:12 -04:00
Robert Starmer dc503dacbb Fix the glance_image type example so that it can actually be used.
Change-Id: I10dd74f4ed38f33e344cdd96d0c763fb9b97ac1a
2013-08-01 00:19:58 -07:00
Mathieu Gagné f126d462ab Capitalize boolean values in config files
This patch allows the usage of Puppet boolean values and still
configure values with OpenStack boolean style: True/False.

Change-Id: I1f96bf979e67fd7fb8fd1d984809fd072783224c
2013-05-21 19:30:22 -04:00
Aimon Bustardo 7f73e9fe81 Fic syntax error 2012-11-07 02:21:45 -08:00
Dan Bode db7de69bd5 Convert to ini file management
- Add native types to manage all existing ini files
- remove all unused templates
- convert all concat with ini_setting resources
- remove all concat code
2012-10-03 22:04:00 -07:00
Joe Topjian 69ffc7424e Slight changes. 2012-08-04 12:38:29 -06:00
Joe Topjian 242a424561 First attempt at creating a glance_image type 2012-08-04 02:46:37 -06:00