Use glance::<service>::authtoken to configure keystone_authtoken
section in glance configs, with all parameters required
to configure keystonemiddleware.
Also changed auth_type to auth_strategy, because auth_type is
related to keystone authentication.
Change-Id: I722a1e41b2cee0b3040c37f07adfd13c33edaa5c
Closes-bug: #1604463
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
This reverts commit b76fbcbea3.
With 268370457c now merged, we need to go
back to looking for os_region_name in [glance_store] instead of
[DEFAULT].
Change-Id: I197d012387d630ca6fb3a38c48f0603add6c6de1
In ::glance::api, os_region_name is set in DEFAULT which work for both
Juno & Kilo.
'glance_store' section has been introduced in Kilo which breaks Juno.
Until we decide our policy to manage master, let's use DEFAULT so both
releases work well.
Change-Id: I1c519146d3fe62f8c8fc8c2d85805db11af21e4c
When we revert the change that moved os_region_name, we must also
revert this fix that resulted from that change.
Depends on https://review.openstack.org/#/c/174968/
This reverts commit 354ae692a5.
Change-Id: I65249b0734ae1a1bfbf0e5e153d19787f6aded5f
Commit e6e8f6a562 changed the section
where the os_region_name setting is placed from 'DEFAULT' to
'glance_store'. However, the provider was not updated to reflect
this change, so it broke.
Change-Id: I9e91faac2a45ac4eba4cc27c328e8dc67e619ab3
After https://review.openstack.org/152321 was merged, it was no
longer guaranteed that some now deprecated settings like auth_host
and auth_protocol would be present in glance-api.conf. This breaks
the Glance provider, which expects them to be present.
This patch adds support for identity_uri in provider, while
keeping backwards compatibility.
Change-Id: Ie8a2e45a4afea4828e02af36e64d65e7d4b7557e
This is pretty important in situations where Keystone contains information about
multiple regions. The holding assumption is that the glance::image etc are used
for image upload for the current region.
Change-Id: I0a24cd24ddf3e0b1fab94e693a2fac847cc7271c
Since this patch has been merged in python-glanceclient 0.14.1:
1dfce5301c
We have to update the way to call Glance Client.
This patch updates for glance image-list, image-show and the way to get
a token, and also the way the glance command output is parsed.
Change-Id: If3e1e42b1245dd064fa00e07037535afc9caa04c
The output of the glance show command in get_glance_image_attrs
does not get properly converted while being added to the
attrs array.
Change-Id: Ibe503b24ae3bfa10944537d5deaa068a01eaa5f3
Closes-Bug: #1199513
The python-glanceclient (glance) was updated to not report back
on the id of an uploaded image with the v2 API [1]. This broke
the parser for the glance_image provider. This change first checks
for the previous behavior (for performance and backwards
compatability), and failing that parses the results table and
pulls the id (if it exits) out of the results.
The new parse_table method was made to be generic so that any result
from the glance client could be parsed into an array of maps.
[1]
https://github.com/openstack/python-glanceclient/search?q=Added+new+image+with+ID&ref=cmdform
Change-Id: If7b5445c6f51d886427248827a73cc16b5a2e488
Glance client is getting the same warnings as Keystone client,
hence puppet-glance should use the same hack as puppet-keystone
until providers will be refactored to use API calls instead.
See https://bugzilla.redhat.com/show_bug.cgi?id=1043725 for more details
Change-Id: I99e4308d0731307c019ad6cab8db5feee1b0ed73
Python-glanceclient removed the --silent-upload some time ago (I
believe when the client was split out from Glance itself). It's no
longer valid and needs to be removed. Otherwise users will see
an error of the form:
glance: error: unrecognized arguments: --silent-upload
Change-Id: I417688872bd8e7c4bac7be13d0b0eb13a030fe29
Just b/c the glance service has started correctly does not
mean the service is actually running. Often, the service
is not operational and attempts to use the glance_image provider
results in connection errors.
This commit inserts code that allows the glance provider to
sleep for 10 seconds and perform a single retry.
The template for the code and tests was borrowed from keystone.
Change-Id: I565f1befea6ec3d2347f8e29c9aa05d5a312a827
Check if auth_admin_prefix is defined (passed as a parameter to api.pp)
before trying to access it in the settings data structure.
Change-Id: I61a3ae41dca2a5e5bd9e635b0a2ab9eb05b0326a
Fixes: bug #1190481