
This patch adds a dependency on the aimonb/aviator module and adds functionality to support interactions with the OpenStack services' API via aviator. The patch adds a parent provider that is intended for other providers to inherit from. The parent provider has methods to authenticate to openstack services, create session objects, and make requests. The authenticate method can accept credentials as an argument hash or infer credentials from the environment. It also adds a stub type parameter that allows types to incorporate basic parameters they need in order to support using aviator. Change-Id: I56b0d07ae8f4738037eda486b75a0f6e24fe80e7 Implements: blueprint use-aviator-in-module-resources
47 lines
1.0 KiB
Ruby
47 lines
1.0 KiB
Ruby
# Add the auth parameter to whatever type is given
|
|
module Puppet::Util::Aviator
|
|
def self.add_aviator_params(type)
|
|
|
|
type.newparam(:auth) do
|
|
|
|
desc <<EOT
|
|
Hash of authentication credentials. Credentials can be specified as
|
|
password credentials, e.g.:
|
|
|
|
auth => {
|
|
'username' => 'test',
|
|
'password' => 'passw0rd',
|
|
'tenant_name' => 'test',
|
|
'host_uri' => 'http://localhost:35357/v2.0',
|
|
}
|
|
|
|
or a path to an openrc file containing these credentials, e.g.:
|
|
|
|
auth => {
|
|
'openrc' => '/root/openrc',
|
|
}
|
|
|
|
or a service token and host, e.g.:
|
|
|
|
auth => {
|
|
'service_token' => 'ADMIN',
|
|
'host_uri' => 'http://localhost:35357/v2.0',
|
|
}
|
|
|
|
If not present, the provider will first look for environment variables
|
|
for password credentials and then to /etc/keystone/keystone.conf for a
|
|
service token.
|
|
EOT
|
|
|
|
validate do |value|
|
|
raise(Puppet::Error, 'This property must be a hash') unless value.is_a?(Hash)
|
|
end
|
|
end
|
|
|
|
type.newparam(:log_file) do
|
|
desc 'Log file. Defaults to no logging.'
|
|
defaultto('/dev/null')
|
|
end
|
|
end
|
|
end
|