Adds provides method to define name of resources
In Chef Infra Client 16.2, resources have to be named using the provides method. The resource_name method has not been changed in order to be compatible with Chef Infra Client <16.2. Also fix URI.encode and URI.decode deprecations. Update etcd depends to ~> 6.0 to fix Chef 16 deprecation warnings. Depends-On: https://review.opendev.org/747503 Change-Id: I24be89a3214207bac2df9eb360124871e0d8242f Closes-Bug: #1886985 Signed-off-by: Henrique Santos <hfigueiredosantos@tecnico.ulisboa.pt> Signed-off-by: Lance Albertson <lance@osuosl.org>
This commit is contained in:
committed by
Lance Albertson
parent
a45cea15d7
commit
455790e1e9
@@ -24,7 +24,7 @@ Requirements
|
|||||||
============
|
============
|
||||||
|
|
||||||
- Chef 15 or higher
|
- Chef 15 or higher
|
||||||
- Chef Workstation 0.18.3 for testing (also includes berkshelf for
|
- Chef Workstation 20.8.111 for testing (also includes berkshelf for
|
||||||
cookbook dependency resolution)
|
cookbook dependency resolution)
|
||||||
|
|
||||||
Platform
|
Platform
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module ::Openstack
|
|||||||
# @return [Hash] environment
|
# @return [Hash] environment
|
||||||
def openstack_command_env(name, project, user_domain, project_domain)
|
def openstack_command_env(name, project, user_domain, project_domain)
|
||||||
identity_endpoint = public_endpoint 'identity'
|
identity_endpoint = public_endpoint 'identity'
|
||||||
auth_url = ::URI.decode identity_endpoint.to_s
|
auth_url = identity_endpoint.to_s
|
||||||
|
|
||||||
pass = get_password 'user', name
|
pass = get_password 'user', name
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ module ::Openstack
|
|||||||
def encrypted_secret(bag_name, index)
|
def encrypted_secret(bag_name, index)
|
||||||
key_path = node['openstack']['secret']['key_path']
|
key_path = node['openstack']['secret']['key_path']
|
||||||
::Chef::Log.info "Loading encrypted databag #{bag_name}.#{index} using key at #{key_path}"
|
::Chef::Log.info "Loading encrypted databag #{bag_name}.#{index} using key at #{key_path}"
|
||||||
secret = ::Chef::EncryptedDataBagItem.load_secret key_path # ~FC086
|
secret = ::Chef::EncryptedDataBagItem.load_secret key_path
|
||||||
::Chef::EncryptedDataBagItem.load(bag_name, index, secret)[index] # ~FC086
|
::Chef::EncryptedDataBagItem.load(bag_name, index, secret)[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
def standard_secret(bag_name, index)
|
def standard_secret(bag_name, index)
|
||||||
::Chef::Log.info "Loading databag #{bag_name}.#{index}"
|
::Chef::Log.info "Loading databag #{bag_name}.#{index}"
|
||||||
::Chef::DataBagItem.load(bag_name, index)[index] # ~FC086
|
::Chef::DataBagItem.load(bag_name, index)[index]
|
||||||
end
|
end
|
||||||
|
|
||||||
def vault_secret(bag_name, index)
|
def vault_secret(bag_name, index)
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class Chef
|
|||||||
class Resource
|
class Resource
|
||||||
class Database < Chef::Resource
|
class Database < Chef::Resource
|
||||||
resource_name :database
|
resource_name :database
|
||||||
|
provides :database
|
||||||
|
|
||||||
default_action :create
|
default_action :create
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class Chef
|
|||||||
class Resource
|
class Resource
|
||||||
class DatabaseUser < Chef::Resource::Database
|
class DatabaseUser < Chef::Resource::Database
|
||||||
resource_name :database_user
|
resource_name :database_user
|
||||||
|
provides :database_user
|
||||||
|
|
||||||
default_action :create
|
default_action :create
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Chef
|
|||||||
class Resource
|
class Resource
|
||||||
class MysqlDatabase < Chef::Resource::Database
|
class MysqlDatabase < Chef::Resource::Database
|
||||||
resource_name :mysql_database
|
resource_name :mysql_database
|
||||||
|
provides :mysql_database
|
||||||
|
|
||||||
def initialize(name, run_context = nil)
|
def initialize(name, run_context = nil)
|
||||||
super
|
super
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Chef
|
|||||||
class Resource
|
class Resource
|
||||||
class MysqlDatabaseUser < Chef::Resource::DatabaseUser
|
class MysqlDatabaseUser < Chef::Resource::DatabaseUser
|
||||||
resource_name :mysql_database_user
|
resource_name :mysql_database_user
|
||||||
|
provides :mysql_database_user
|
||||||
|
|
||||||
def initialize(name, run_context = nil)
|
def initialize(name, run_context = nil)
|
||||||
super
|
super
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
require 'uri'
|
require 'uri'
|
||||||
|
require 'addressable/uri'
|
||||||
|
|
||||||
# URI methods
|
# URI methods
|
||||||
module ::Openstack
|
module ::Openstack
|
||||||
@@ -29,7 +30,7 @@ module ::Openstack
|
|||||||
# keys are used directly from the hash.
|
# keys are used directly from the hash.
|
||||||
def uri_from_hash(hash)
|
def uri_from_hash(hash)
|
||||||
if hash['uri']
|
if hash['uri']
|
||||||
::URI.parse ::URI.encode(hash['uri'])
|
::URI.parse Addressable::URI.encode(hash['uri'])
|
||||||
else
|
else
|
||||||
host = hash['host']
|
host = hash['host']
|
||||||
scheme = hash['scheme'] ? hash['scheme'] : 'http'
|
scheme = hash['scheme'] ? hash['scheme'] : 'http'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ version '20.0.0'
|
|||||||
supports os
|
supports os
|
||||||
end
|
end
|
||||||
|
|
||||||
depends 'etcd', '~> 5.6'
|
depends 'etcd', '~> 6.0'
|
||||||
depends 'mariadb', '~> 4.0'
|
depends 'mariadb', '~> 4.0'
|
||||||
depends 'memcached', '~> 6.0'
|
depends 'memcached', '~> 6.0'
|
||||||
depends 'selinux'
|
depends 'selinux'
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
# Original: https://github.com/chef-boneyard/database
|
# Original: https://github.com/chef-boneyard/database
|
||||||
|
|
||||||
resource_name :openstack_database
|
resource_name :openstack_database
|
||||||
|
provides :openstack_database
|
||||||
default_action :create
|
default_action :create
|
||||||
|
|
||||||
property :service, String, name_property: true
|
property :service, String, name_property: true
|
||||||
|
|||||||
Reference in New Issue
Block a user