Alex Schultz a981c38c16 Fix dependency references
With the deps migration, we left some of the dependency references in
place which was previously ignored by puppet unit tests. The latest
version of puppet now reports these as catalog failures so this change
removes the unnecessary Package and Service references since those are
already handled by manila::deps and fixes the invalid anchor reference
for the manila::type and manila::type_set resources.

Change-Id: Ie4dc0ae559e8f9bc9657fa6ed8ecf53ccda7852d
Closes-Bug: #1702964
2017-07-07 15:20:47 -06:00

89 lines
2.5 KiB
Puppet

# ==Define: manila::type
#
# Creates manila type and assigns backends.
#
# === Parameters
#
# [*os_password*]
# (required) The keystone tenant:username password.
#
# [*driver_handles_share_servers*]
# (required) If the driver handles share servers.
#
# [*set_key*]
# (optional) Must be used with set_value. Accepts a single string be used
# as the key in type_set
#
# [*set_value*]
# (optional) Accepts list of strings or singular string. A list of values
# passed to type_set
#
# [*os_tenant_name*]
# (optional) The keystone tenant name. Defaults to 'admin'.
#
# [*os_username*]
# (optional) The keystone user name. Defaults to 'admin.
#
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (optional) The keystone region name. Default is unset.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
define manila::type (
$os_password,
$driver_handles_share_servers,
$set_key = undef,
$set_value = undef,
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
) {
$volume_name = $name
include ::manila::deps
include ::manila::client
# TODO: (xarses) This should be moved to a ruby provider so that among other
# reasons, the credential discovery magic can occur like in neutron.
$manila_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
if $os_region_name {
$region_env = ["OS_REGION_NAME=${os_region_name}"]
}
else {
$region_env = []
}
exec {"manila type-create ${volume_name} ${driver_handles_share_servers}":
command => "manila type-create ${volume_name} ${driver_handles_share_servers}",
unless => "manila type-list | grep ${volume_name}",
environment => concat($manila_env, $region_env),
require => Anchor['manila::install::end'],
path => ['/usr/bin', '/bin'],
}
if ($set_value and $set_key) {
Exec["manila type-create ${volume_name} ${driver_handles_share_servers}"] ->
manila::type_set { $set_value:
type => $volume_name,
key => $set_key,
os_password => $os_password,
os_tenant_name => $os_tenant_name,
os_username => $os_username,
os_auth_url => $os_auth_url,
os_region_name => $os_region_name,
}
}
}