Skip to content

Fix: Puppet Unknown variable: 'mysql::params::exec_path' #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions manifests/db.pp
Original file line number Diff line number Diff line change
@@ -53,14 +53,20 @@
Enum['absent', 'present'] $ensure = 'present',
$import_timeout = 300,
$import_cat_cmd = 'cat',
$mysql_exec_path = $mysql::params::exec_path,
$mysql_exec_path = undef,
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fetch all the parameters from mysql::params you should inherit the params class. Use this line to do this:
inherits mysql::params. If you use this you will don't need to verify if $mysql_exec_path is defined or not.
Please try it and let us know if it's working for you

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is an example of how to use inheritance in puppet

) inherits mysql::params {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use inherits on a defined type I tried this on https://github.com/puppetlabs/puppetlabs-mysql/pull/1377/files as you can see but the pipeline failed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh you're right, please use include mysql::params.
Something like this https://puppet.com/docs/puppet/5.5/lang_defined_types.html#containment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not test this, but do you suggest to reverse my changes and only include the mysql::params ? Is this not already being covered by the include 'mysql::client' as this class is also including the mysql::params?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JvGinkel, I tested your changes and it's working! I will proceed to merge this PR.
Thanks for your contributions!

kind regards,
@adrianiurca

$table = "${dbname}.*"

$sql_inputs = join([$sql], ' ')

include 'mysql::client'

if ($mysql_exec_path) {
$_mysql_exec_path = $mysql_exec_path
} else {
$_mysql_exec_path = $mysql::params::exec_path
}

$db_resource = {
ensure => $ensure,
charset => $charset,
@@ -98,7 +104,7 @@
logoutput => true,
environment => "HOME=${::root_home}",
refreshonly => $refresh,
path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:${mysql_exec_path}",
path => "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:${_mysql_exec_path}",
require => Mysql_grant["${user}@${host}/${table}"],
subscribe => Mysql_database[$dbname],
timeout => $import_timeout,